PDA

View Full Version : FPS problem



Tomsi
01-12-2009, 01:47 AM
Hello everyone.

I recently decided to continue work on my old project (game). So I installed MSVC++ 6.0 (OS = Vista), opened the project and compiled it without a problem.

Now here is the problem:

I draw a grid of quads 32*32 by using GL_QUADS (4 vertices per quad, no shared vertices) and everything works fast as it should. Each quad is drawn seperately.

Then I tried to draw 256*256 grid and my FPS dropped down to 10-12 frames per second. I find this strange since I can play games such as Doom 3, Far Cry 2, Gothic 3 with max quality without a problem and I'm sure that these games show much more triangles than this 256*256 quad grid.

I tought the problem might be in vista, but fps drop down in Win XP too. Could the problem be in MSVC++ 6.0? Here is a pseudo code for the drawing:



for(x = 0; x < 256; x++) {
for(z = 0; z < 256; z++) {
glBindTexture(GL_TEXTURE_2D, some_tex);
glBegin(GL_QUADS);
// draw the quad here. 1 normal per quad
// 4 vertices using x and z values, y = 0 and texture
// coorinate for each vertex
glEnd();
}
}


Any suggestions?

ZbuffeR
01-12-2009, 02:26 AM
Very similar problem, solved here :
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=251247

Tomsi
01-12-2009, 03:50 AM
Okay, thanks for the quick answer. I'll look into this later when I'm home. I tought it might be something with all those immidiate calls. I'm not really new to OpenGL but It's been few years since I used it in any application. Looks like I'll have to read that OpenGl bible again ;)

satan
01-12-2009, 06:25 AM
I'll look into this later when I'm home. I tought it might be something with all those immidiate calls.
Spot on. The thread ZbuffeR refers to will show you the 'correct solution(tm)'.
But as a quick fix you can just move the glBegin/glEnd out of the for-loops, which should give you at least a little speed boost.

Looks like I'll have to read that OpenGl bible again ;)
If you don't have a very recent version, there is no gain. :)

Tomsi
01-13-2009, 06:40 AM
Well I found some tutorials on the net about the VBOs and now it works now with the super speed :D

I haven't check the OGL Bible yet, but I have SAMS OpenGL Super Bible 3rd edition (2004). And yes, as I remeber there's nothing about VBO's there. I might be wrong though.