The issue you’re having is that there are actually four coordinate spaces (object, world, view, clip) and only two matrix stacks. What you would like is this:

```
<object coords>
(x model matrix)
<world coords>
(x view matrix)
<eye coords>
(x projection matrix)
<clip coords>
```

However, in OpenGL, the model matrix and view matrix are implicitly concatenated (hence, the term modelview matrix) and therefore, you don’t really have access to world coordinates. What you really have is:

```
<object coords>
(x model-view matrix)
<eye coords>
(x projection matrix)
<clip coords>
```

The good news is that, because you’re using shaders, the matrix stacks don’t necessarily have to be used for the purposes they are named for. There’s a few options I can think of:

[ul][li] Use the model-view matrix stack as a model matrix and use bake your world-eye coordinate transformation into the projection matrix. Essentially, you’re creating a gl_Model matrix and a gl_ViewProjection matrix. That means, do all your glTranslatef, glRotatef, etc. calls that take your vertices from world space to eye space on your projection matrix, and only use the model-view matrix for object to world coordinate transformation. Then, your world coordinates will simply be:[/li]

```
gl_ModelViewMatrix * gl_Vertex
```

Of course, then you’d lose your eye coordinates (which are often needed for lighting). It would also break some other stuff like gl_NormalMatrix.[li] Abuse one of the other matrix stacks (such as the texture matrices). Use the model-view matrix as just a model matrix, use a texture matrix as your view matrix. This is kind of hacky, but as this is all shader code and you can use the matrices for whatever you want, you should be good to go.[*] Don’t use GL’s matrix stacks at all. Roll your own matrix class and pass the matrices to the shader as uniforms. That way, you can have as many matrices and coordinate spaces as you need. In fact, the matrix stacks are deprecated in GL 3.0+ for precisely this reason - fixed function is gone and in shaders, the built-in matrices don’t necessarily have a defined meaning.[/ul][/li]Cheers,

Graham