Original Post
I've got one major problem ...
I'm coding new OpenGL engine and there's problem with rendering.
I've made some high-resolution timer and message loop with WNDPROC and so on ... Engine is built using classes (why not?), but I think thats not problem ... I'm in point where I can create window, set and count exact framerate with float precison and etc., no prob..
But when it comes to rendering function (to make it easy, I put NeHe's rotating pyramid and cube from lesson05 there), it's terribly slow ... I realy do not know why ...
I've got no problems running any of games (Quake III Arena, UT 2003...) and I have latest Detonator drives (GeForce 2 GTS 64MB) and whatever ... So why is it so slow??? Can sombody tell me how fast NeHe's tuts. run on your comp.??? Just to know if this isn't some weird "bug"...
I think it may be SwapBuffers function (or wglSwapBuffers....)
This is rendering code....
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(-1.5f,0.0f,-6.0f); glRotatef(rtri,0.0f,1.0f,0.0f); glBegin(GL_TRIANGLES); glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( 1.0f,-1.0f, -1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f( 1.0f,-1.0f, -1.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(-1.0f,-1.0f, -1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(-1.0f,-1.0f,-1.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glEnd(); glLoadIdentity(); glTranslatef(1.5f,0.0f,-7.0f);
glRotatef(rquad,1.0f,0.0f,0.0f); glBegin(GL_QUADS); glColor3f(1.0f,0.0f,0.0f); glVertex3f( 1.0f, 1.0f,-1.0f); glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f, 1.0f,-1.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glColor3f(1.0f,0.0f,0.0f); glVertex3f( 1.0f,-1.0f, 1.0f); glColor3f(0.0f,1.0f,0.0f); glVertex3f(-1.0f,-1.0f, 1.0f); glColor3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f,-1.0f,-1.0f); glVertex3f( 1.0f,-1.0f,-1.0f); glColor3f(1.0f,0.0f,0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glColor3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glVertex3f(-1.0f,-1.0f, 1.0f); glColor3f(1.0f,0.0f,0.0f); glVertex3f( 1.0f,-1.0f, 1.0f); glColor3f(1.0f,1.0f,0.0f); glVertex3f( 1.0f,-1.0f,-1.0f); glVertex3f(-1.0f,-1.0f,-1.0f); glColor3f(1.0f,0.0f,0.0f);
glColor3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f, 1.0f,-1.0f); glVertex3f( 1.0f, 1.0f,-1.0f);
glColor3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glColor3f(1.0f,0.0f,0.0f); glVertex3f(-1.0f, 1.0f,-1.0f); glVertex3f(-1.0f,-1.0f,-1.0f); glColor3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f,-1.0f, 1.0f);
glColor3f(1.0f,0.0f,0.5f); glColor3f(1.0f,0.0f,0.0f); glVertex3f( 1.0f, 1.0f,-1.0f); glColor3f(0.0f,0.0f,1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glVertex3f( 1.0f,-1.0f, 1.0f); glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f,-1.0f); glEnd(); rtri+=2.0f;
rquad-=1.5f;
SwapBuffers (p_hDC);
return OK;
}
it takes about 350 milliseconds to render ?!?!? .....
Sorry for the look of code... I'm lazy to do some formatting.... :-)))
Dante77
[edited by - Dante77 on November 2, 2002 1:20:19 PM]