Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Pre vertexshader vertex transformation???

This topic is 4411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I got a strange problem with OpenGL. I'm doing some projective texture mapping in my shaders amongst other things. It work quite fine if I use Modelview and Projection matrices calculated with gluPerspective and gluLookAt. Unfortunately I have to calculate my on matrices based on some data I get from OpenCV. Displaying a mesh works fine, but projective texture mapping wont :(. I tried long and hard to find out what went wrong and if there maybe was something wrong with my matrices, but I don't have clue so far. I managed to 'fix' the problem by circumventig it: I used to calculate texture coordiantes depending on the vertex positions: Vertexshader: [...] gl_TexCoord[0] = gl_TextureMatrix[0] * gl_Vertex; [...] Fragmentshader: [...] gl_FragColor = texture2DRectProj( texProjectiveTextures, gl_TexCoord[0] ); [...] But that didn't work. I wrote the vertex positions into a texture and discoverd, that the positions in the vertex shader differ from the ones I input with glVertex! So I used glTexCoord to set the per vertex tex coords to the same values as the vertex position: [...] glVertex4f( x, y, z, w ) glTexCoord4f( x, y, z, w ) [...] Vertexshader: [...] gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; [...] and it works fine... Does anyone have any idea what could be causing this problem? I would rather avoid setting the texcoords in my program, since I would have to change mesh handling for that (which is an other part of the project and reused elsewhere) Any help would be welcome, Striker

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!