PDA

View Full Version : glloadidentity



12-21-2002, 08:11 AM
where exactly does glLoadIdentity take you? I thought it took you to the center of the window you've drawn but when I use it it actually shows up not at the center but a couple units to the right and couple units up from the exact center of the screen. And when I draw triangles or polygons the units are from the bottom left corner from the screen. does anyone know why that is?

roffe
12-21-2002, 10:45 AM
No offense, but you seem to be a bit lost.

I would suggest that you read chapter 3 of the red book to start with. Here is a link. http://fly.cc.fer.hr/~unreal/theredbook/

When you've read it, have a glance in appendix G. After this, I think you can answer your own question http://www.opengl.org/discussion_boards/ubb/smile.gif If not, come back.

nexusone
12-21-2002, 11:09 AM
The center in openGL is 0,0,0 and loadidenity resets the matrix() to that.

Now what is happing is that you are thinking in terms of your screen center and not the openGL world center.


Ortho, perspective modes, these only set the view area.
glOrtho(0.0f, width, hight, 0.0f,-10.0f,10.0f), set's width = 640, hight = 480. of the viewing area.

So what is happing is correct in that your object is being drawn at a corner which is where the openGL center is located.

You translate your object to the position wanted on the screen. which in the case of my example is 320, 240.



Originally posted by opengl newbie:
where exactly does glLoadIdentity take you? I thought it took you to the center of the window you've drawn but when I use it it actually shows up not at the center but a couple units to the right and couple units up from the exact center of the screen. And when I draw triangles or polygons the units are from the bottom left corner from the screen. does anyone know why that is?