Drawing backgrounds

Hi all,
I need to draw an image as the background of mine rendering, I’m cheating with glDrawPixels but seems that nothing wanna appear on the DC… can someone help me ??
I MUST use (I think) the DrawPixels bcos I have a 640X480 image to paint…

I have a buffer defined as GLuint test[640][640][3] and filled with the picture RGB values…

This is mine initialization code :

glEnable(GL_TEXTURE_2D);
glShadeModel(GL_FLAT);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHintGL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);

And this is the drawing routine :

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

glRasterPos2i(0,0);
glDisable( GL_BLEND);
glDrawPixels(640,640,GL_RGB,GL_UNSIGNED_INT,test);
glFlush();

Thanks to every1 who will help me…

The problem can be your raster position. All rasterpositions are multiplied with the current modelview matrix. I assume you have the modelview matrix activated when calling glLoadIdentity before drawing. This will place the rasterposition at the world origin (as projected on screen). But after loading the identity, the world origin is outside the viewfrustum, unless you are using ortgographic projection because then it can be inside, and will be clipped (=not drawn). Try placing the rasterposition inside the view frustum.

But why not add some extra pixels in the edges, so the fill out to a 1024x512 sized image, perfect for uploading as a texture. Then blast it onto a quad with the edges outisde the screen. No distorion at all, and WAY faster that glDrawPixels.

Or if you don’t require that much image quality, you can downsample the image to, say 512x512 or even 256x256 (less memory), and draw that texture on a quad. The texels might look a little blurry, but the aspect ratio of the image will be the same.

Tnaks for the hint, but I noticed both drawing using drawpixels (with the right coords this time) and drawing big textured quads slow down dramatically the whole thing…

maybe I must “tile” the picture and texture every “piece” on a different quad putting them near each others…

dunno…