Difference between Raster and texturing

Hi all

I am able to display an image using glRaster2i() and gluTex2DImage() as well. Both are doing well. What is the difference between them?

Having used neither, I can only observe that one is from GL, in other words from the driver, and the other from GLU.
The GLU routines are more programmer-friendly shells around the raw GL routines.
You can probably use more intuitive arguments in that gluTex2DImage call. Also, since it has “Tex” in it, I guess it uses a texture somewhere.
For the details use the reference pages on the site ( http://www.opengl.org/sdk/docs/man/ )

gluTex2DImage()? Never heard of that one…


it is not gluTex2DImage().
Actually it is glTexImage2D() and raster display is also by the function glRasterPos2i()…

Ah, but those two functions do entirely different things.
I take it you’re only looking at 2D functionality at the moment.

glTexImage2D uploads a bitmap to the graphics card so it can be used for texture mapping. It does not render anything.
You only see the bitmap data when you render some polygons with this texture enabled. glRasterPos has no effect on this.

glRasterPos places the ‘cursor’ for 2D overlay work (the functions glBitmap, glDrawPixels, and glCopyPixels.)
You do not need to upload any textures for this functionality, however these functions operate directly on the framebuffer, and they have to get their data from CPU memory instead of from the video card, which makes them slower.

The alternative, which is what you would be needing glTexture… functions for, is to render screen-aligned texture-mapped quads.
You would probably want to use glOrtho to set up a 1 to 1 mapping between screen coordinates and glVertex coordinates.

The advantage of the Raster operations is that you can be certain that the image on screen is going to be exactly the same as the image in your bitmap, exactly positioned and without blurring.
The disadvantages are that they are slow, <s>cannot be blended with other stuff already in the framebuffer,</s>(they can be blended, sorry about that) and that they cannot be scaled by OpenGL.