Can i disble the modelview transformation?


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.

But can i disbale it with glDisable()? Or is there another command?

Thanks again for you answer

No, read what Bob wrote. glLoadIdentity is enough.

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.

ok thanks. Another question how do I transform world coordinates in screen coordinates ?

(vtx.x / vtx.w) * screenheight?

Thanks for your answer.

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.

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.

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.

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.

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