Very slow glDrawPixels() - Please help

Hi,

I am trying to draw 640x480 RBG pixls with a reasonable frame rate. I use GLUT and tested with Linux and Windows. I the my GLUT idleFunc() I do the following:

void redraw() {
glClear(GL_COLOR_BUFFER_BIT);

glDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_DITHER);
glDisable(GL_FOG);
glDisable(GL_LIGHTING);
glDisable(GL_LOGIC_OP);
glDisable(GL_STENCIL_TEST);
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1);
glPixelTransferi(GL_RED_BIAS, 0);
glPixelTransferi(GL_GREEN_SCALE, 1);
glPixelTransferi(GL_GREEN_BIAS, 0);
glPixelTransferi(GL_BLUE_SCALE, 1);
glPixelTransferi(GL_BLUE_BIAS, 0);
glPixelTransferi(GL_ALPHA_SCALE, 1);
glPixelTransferi(GL_ALPHA_BIAS, 0);

    ...
glRasterPos2i(0,480-1);
glDrawPixels(640,480,GL_RGB,GL_UNSIGNED_BYTE,pixels);
    ...
    glutSwapBuffers();

}

I have an Athlon 800 with a GeForce and can get at most 20 frames per second with only one 640x480 glDrawPixels() call out of this! With my rendering overhead I have 4 or 5 frames. So I tried this:

void redraw() {
glClear(GL_COLOR_BUFFER_BIT);

    glutSwapBuffers();

}

This does ~1200 frames under windows and ~115 frames under Linux (My monitor does only run with 85Hz so I don’t know how this works…)

What can I do to speed this up a LOT? I need 20 frames per second including my rendering overhead.

Thanks in advance

Eddy

Simple: glDrawPixels is always going to be slow. You should use textures to draw images to the screen.

Originally posted by Korval:
Simple: glDrawPixels is always going to be slow. You should use textures to draw images to the screen.

Thanks, here is how I tried it:
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,6480,480,0,GL_RGB,GL_UNSIGNED_BYTE,pixels)
With only this in my redraw() function I get 20 Frames per second. This is still very slow. Is this the fastest way of getting pixels on the screen? OpenGL really can’t be that slow.

Eddy

[This message has been edited by eddyilg (edited 01-07-2002).]

hi!

you should enable 3d acceleration under linux :wink:

This does ~1200 frames under windows and ~115 frames under Linux (My monitor does only run with 85Hz so I don’t know how this works…)

either you have to install drivers from your graphics card vendor, or enable it (kernel or X settings).

good luck!
Tolga.

Don’t update the texture every frame unless you have to. Use texture objects instead and only upload the texure to the card (using glTexImage2d) when you need to (once for static data). If you’re playing an animation use glTexSubImage2d to update an existing texture object.