tags:

views:

69

answers:

2

Am I doing something wrong here?

I am drawing a quad over the whole screen with glRectf( -1, -1, 1, 1 )

Per rect the FPS of my program go down by roughly 5000.

  • What is happening?

This is my OpenGL initialization:

  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  glViewport( 0, 0, width, height );
  glOrtho( 1, -1, 1, -1, 1, -1 );
  glMatrixMode( GL_MODELVIEW );
  glDisable( GL_DEPTH_TEST );
+2  A: 

If glRectf(-1, -1, 1, 1) is the only thing you are doing, then you are experiencing a bad case of premature framerate freakout. Shawn Hargreaves covers this very nicely on his blog.

The fact is that it takes quite some time to spin up the graphics pipeline and draw a frame. As compared to not drawing anything (as I suspect you are doing), the framerate is going to drop by a huge amount, since doing anything is much more expensive than doing nothing.

To test my hypothesis, try:

for (int i = 0; i < 1000; ++i)
    glRectf(-1, -1, 1, 1);

Then see if your framerate changes at all. It probably won't.

Travis Gockel
I have seriously tested this, right now. I get 7 to 11 FPS. I'm not kidding!
Rax
Also, I have tested drawing small to mid-sized polygons as well as quads before - there is no noticeable change in the FPS rate. However, as the covered area on the screen gets bigger than 50% the FPS start dropping by 1000 per 10% area covered.
Rax
I'm guessing your performance problems still lie outside of drawing the quad. Perhaps post some more code in your question?
Travis Gockel
This is basically everything. I have tested it with and without drawing the full-screen quad. I have tried drawing small quads, which resulted in nearly no change in the original, high FPS. The FPS rate drops similarily when I draw two polygons which together cover the whole screen.
Rax
Well, you're certainly doing more than initialization ;-). But I tried this on my computer just to be sure and it works with excessive speed.
Travis Gockel
This is strange then D:
Rax
A side note: I am using Delphi with SDL as window manager for OpenGL
Rax
Hmm...I just did a quick one-off in C, although I'm just as confused as you are. Perhaps it's your graphics card? Or something Delphi is doing?
Travis Gockel
+2  A: 

1920x1080 is a lot of pixels. 7-11 fps seems pretty fast for the code snippet suggested by Travis G:

for (int i = 0; i < 1000; ++i)
    glRectf(-1, -1, 1, 1);

Let's do the math:

1920 * 1080 * 1000 * 11 pixels / 1 second = 22.8 Gpix/s

Wikipedia has tables of headline figures for ATI cards here: http://en.wikipedia.org/wiki/Comparison_of_AMD_graphics_processing_units and for nVidia cards here: http://en.wikipedia.org/wiki/Comparison_of_Nvidia_graphics_processing_units

I'm going to guess you have a Radeon HD 5850 just because they're popular and the numbers fit (the 5850 apparently has 23 Gpix/s fillrate)

dave