PDA

View Full Version : glBegin



09-28-2001, 01:11 PM
I'm making a little 3d engine and I got to the point where I want to make it faster. I found out that when I use opengl it seems to use the zbuffer also with polygons that are completely behind the camera (my back), so it calculates those poligons as well, I thought about testing the polygons by creating a plane with normal equal to the target of the camera and a valid point from this plane at the position of the camera, so if I use the equation Ax+By+Cz+D=0 and calculate A B C D, then use this equation with the faces in the world, if all the points of the face are in the back of the camera, the equation will be less than 0.
But it stayed slow and with some problems, so I decided to use matrices to multiply the points before rendering , then test all the faces, if all the points of a face had an z component greater than 0 it ment that the face was behind the camera,now the engine feels faster.
The question is, since I'm multiplying the points myself and not using the opengl tranformation matrix,
but I use glBegin(GL_TRIANGLE) to draw the faces of the world, does opengl still multiply the points that it draws by the tranformation matrix, I use glLoadIdentity() before drawing, since I rotated all the points by myself I don't need to use any calls like glRotated(), etc. But even with the identity matrix loaded in the opengl transformation matrix, does opengl still multiply this tranformation matrix by the point it will draw?.. if it does.. is there a way of switching it off so it only draws a point and ignores the transformation matrix???

thank you

DFrey
09-28-2001, 01:53 PM
It may, or it may not. All depends if the OpenGL implementation has been made to take advantage of such an optimization. However I would suggest you cull your faces at a high level rather than individually if possible. Then you'll likely see significant improvement.