Advertisement

glDrawPixels

Started by April 23, 2002 11:56 AM
1 comment, last by french man 22 years, 10 months ago
hi....can someone explain me how to use glDrawPixels??? a simple source code example would be great(because i''m french...i understand code better than english lol) thanx
I''ve actually never seriously used OpenGL before, but checking the OpenGL Bluebook, I can guess at how to do this.

// Create data array
float data[400];
// Fill array with data
for( int i = 0; i < 400; ++i ) data = 1.0f;
// Reset the transformation matrix
glLoadIdentity();
// Set raster position for top,left of data to be drawn
glRasterPos2d( -10, -10 );
// Draw a 20x20 array of pixels onto the blue of the screen
glDrawPixels( 20, 20, GL_BLUE, GL_FLOAT, data );

I''m at school right now so I can''t try to compile it myself... I''ll have to try later. What it *should* do is draw a 20x20 square of blue in the middle of the screen... but I really have no idea what it''ll do (if anything!) ^_^;;
Advertisement
glDrawPixels is pretty slow.
Rendering textured quad will be much faster.

This topic is closed to new replies.

Advertisement