glLoadIdentity

Is there any reason that the function glLoadIdentity() seems to be the kiss of death for the glBegin/glEnd drawing functions?

Whenever I evoke that function anywhere near where I have the glBegin/glEnd functions, I can’t see what I have drawn.

Also, can you have a glBegin/glEnd that coexists with a glWire<shape> ? I’ve had no success with this either.

you need to read up on howOpenGL utilizes matrices. glLoadIdentity() resets the current matrix, whether it be GL_MODELVIEW or GL_PROJECTION. when you render objects make sure your in GL_MODELVIEW state.
also in your render function dont call glLoadIdentity() then glPushMatrix()/glPopMatrix() that doesnt work.
i suggest reading http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/

this is the OpenGL Programming Guide, also known as the red book.

Good Luck

[This message has been edited by Warrior (edited 04-14-2001).]

I’ve been programming in OpenGL for a couple of weeks now, and I’ve come across this

glLoadIdentity();

This is used in conjunction with 2 other functions called glMatrixMode(GL_PROJECTION) and glMatrixMode(GL_MODELVIEW). These functions are used to reset various matrices dealing with the viewing volume and any transformations of models drawn before and after the resizing of your window

(example)

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

//Establish clipping volume
glOrtho(left, right,…)

glMatrixMode(GL_MODELVIEW)
glLoadIdentity();

I hope this example helps you.

hi…
well…sometime the glLoadIdentity() might be what BobDole said (the kiss of death because it reset the current matrix.
so, in order to avoid the “kiss”, the program should be arrange in a safe order,
some sort like use the glPushMatrix() and glPopMatrix() to avoid the previous matrix value gone “kapoomm!!”.
try to read about the push and pop data structure usage.