View Full Version : Can i disble the modelview transformation?
11-20-2007, 02:37 AM
I have this question, can i disable the modelview and projection trasformation? If i use glLoadIdentity, OpenGl perform always the transformation?
Thanks for your answer and excuse me for my English.
glLoadIdentity will effectively disable the modelview matrix, as the output is identical to the input. Whether or not the driver is smart enough to not do anything is an implementation detail you neither can nor should know about.
11-20-2007, 03:09 AM
But can i disbale it with glDisable()? Or is there another command?
Thanks again for you answer
But can i disbale it with glDisable()?
No, read what Bob wrote. glLoadIdentity is enough.
11-20-2007, 04:10 AM
I guess if you really don't want the modelview matrix to do anything, you would write a vertex shader that doesn't use it at all. But setting it to identity would be the preferred solution.
11-20-2007, 04:44 AM
ok thanks. Another question how do I transform world coordinates in screen coordinates ?
(vtx.x / vtx.w) * screenheight?
Thanks for your answer.
11-20-2007, 06:27 AM
Transforming world coords into screen coords is a bit more involved than what you propose. In fact, it involves using the modelview matrix. The function gluProject(...) will perform the transformation for you if you provide it with the information it needs.
Perhaps you should start a new topic for this question? Also, it is likely that it has been answered before, so do a careful search.
11-20-2007, 02:10 PM
If you're considering this for performance, just create your own view-projection matrix to ensure it's compact (drivers may do this anyway, but if you want to be sure, you can do your own). So just pass a mat4 to your vertex shader and do your multiplication there. It amounts to 4 instructions.
11-22-2007, 02:19 AM
The problems is this, my clip matrix(Modelview or Porjection) changes between glBegin and glEnd and i cant call glLoadMatrix and i cant call gluProject.Otherwise I used the api of OpenGl.
Another way to get the coordinates?
Thanks advance for your answer and excume for my English.
11-22-2007, 02:52 AM
You cannot change the GL matrices bewteen the Begin...End paradigm. Look into the specification how the transformations are applied (the exact formula is there somewhere), and transform the vertices yourself.
11-22-2007, 04:21 AM
I know it, in fact i multiply my vertex with current clip matrix and then i call glVertex. The question : How i can tranform this vertex in to screen coordinates? My program is btw glBegin and glEnd?
Thanks for your answer
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.