cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Seikilos
Journeyman III

RenderMonkey: Screen Aligned Quad: Wrong uv coordinates?

I was using the screen aligned quad from the media of RenderMonkey to render some effect on the entire view space by setting the vertex shader to

void main(void)
{
 
    gl_Position =  gl_Vertex;
   
}

The quad is seen as expected, but when I applied a texture onto it, like Earth.jpg from the media directory the earth gets displayed wrong. basically it gets displayed rotated 180 ° arround the Z-axis.

I am a kind of a newbie and ask myself if one of the semantic variables provided with render monkey does help me to rotate it?

It looks for me like the uv texture coordinates are somehow either mapped in the wrong direction or the vertex shader above is missing some view dependent rotation.

I solved this by creation a custom mat4 rotation matrix and set up a 180° rotation around the Z-axis and multiplied that with th gl_Position in the vertex shader. But is there some datatype that already has this transformation? (I think its my fault since a "screen aligned quad" would be quite buggy with wrong texture coords)

0 Likes
1 Reply
bpurnomo
Staff

I believe the texture UV coordinates are setup for DX9, which has a different origin than OpenGL. An easy way to rotate the uv coordinates is to flip both u and v coordinates.

 

0 Likes