Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dante77

Some weird problem ...

This topic is 5709 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
The code you have posted runs fine. The only odd thing about it is the p_hDC in the SwapBuffers. Is it a pointer? SwapBuffers just takes the HDC unless you cast the pointer.

Share this post


Link to post
Share on other sites
Yeah, and here comes sh**. If this runs fine snd smooth on your PC, then why it runs so slow on mine??
I really got no idea. All "classic" stuff works nice, but this simple code works weird (I mean that gamez, 3D Studio Max, benchmark ... all work fine).

No, no p_HDC just means:
private: HDC p_hDC

What about function glSwapBuffers??? Any dfference in functionality ??

Share this post


Link to post
Share on other sites
At this moment I cannot tell you why your program is running slow. There seems to be no problem with the code you have provided. So you must do a bit of debbuging. Elimination is the best way to handle this. First compile NeHe''s tutorial on your machine and run it. If it run''s slow then your problem is most likely not your code. If the tutorial runs fine then you need to narrow down the possibilities. Some thoughts on what could be slowing the process down is your high-resolution timer. Comment out the sections of code and run again. Another problem could be how your engine is set up. I am sorry if my answers are not percise, but the information you have provided is very limited.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!