Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wondering how I can get the final position of a vertex. I use glTranslate in my render code, and I'm not getting the world-coordinates correct. My world is devided in chunks and my position get's screwed up.

I have tried multiplying the position with the 3 built-in matrices, but no success.

share|improve this question
Sorry, I ment glTranslate ofcourse. I edited the post. – Basaa May 23 '13 at 20:08
The thing is, that I use voxel chunks in my world. In the render code for each chunk, I use glTranslatef to translate the chunk-coordinates to world-coordinates. But, in my shader I now want to use the world-coordinate. – Basaa May 23 '13 at 20:10
up vote 1 down vote accepted

Unless you are pre-transforming all of your vertex data, vertices should come into the vertex shader in object/model space. This is typically where the vertices are converted into screen space by transforming the vertex by the world, view, and projection matrices. If you want to perform operations on the vertices in world space, then either pass through the objects world transformation matrix in addition to a pre-multiplied world-view-projection matrix. Or pass in the world, view, and projection matrices separate from each other. You would then transform the vertex by the world matrix, perform all necessary operations on it, and then transform it by the view, and projection matrices before passing it through to the pixel shader.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.