XZibit's picture

Performant way to draw pixels in OGL?

Hi there

in an earlier project we tried to draw Bitmaps on the screen by using glWritePixels but this was very very very slow. Is there any other solution known to draw pixels (like bitmaps or so on) on the screen in a performer way than pushing pixels over the bus to the gpu?

Is there any buffer existing to put pixels in or can i just youse display lists to do that and if so, does anyone have an example of how to do this?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
iliak's picture

Mayby Pixel Buffer Object alias PBO => http://www.songho.ca/opengl/gl_pbo.html

Iliak

www.mimicprod.net
www.dungeoneye.net : Open source remake of Eye of the Beholder II

iliak's picture

Maybe Pixel Buffer Object alias PBO => http://www.songho.ca/opengl/gl_pbo.html

Iliak

www.mimicprod.net
www.dungeoneye.net : Open source remake of Eye of the Beholder II

XZibit's picture

In which version they were first/last supported?

iliak's picture

Google and OpenGL are your friends.... http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt

Dependencies

Written based on the wording of the OpenGL 2.0 specification.

Assumes support for (at least) OpenGL 1.5 or the
ARB_vertex_buffer_object extension.

NV_pixel_data_range affects the definition of this extension.

EXT_pixel_buffer_object interacts with this extension.

Iliak

www.mimicprod.net
www.dungeoneye.net : Open source remake of Eye of the Beholder II

Stefan Monov's picture
  1. Rather than using glDrawPixels, upload your data to a texture with glTexSubImage2D (or maybe PBO, I haven't used that), and draw it onto a quad primitive
  2. In texture upload use pixel type GL_UNSIGNED_INT_8_8_8_8_REV, pixel format GL_BGRA and pixel internal format GL_RGBA. This tends to be the best combination on most videocards.
  3. Alternatively, use GL_ALPHA or GL_LUMINANCE as your pixel format and pixel internal format, if those suit your needs, as they're faster than the above.
  4. Consider another approach - generate your data on the GPU to avoid sending it over from the CPU. For example, you can create a FBO and render to it, then use the resulting texture to render to the screen.