PDA

View Full Version : A Question!



Balajee
06-14-2002, 06:08 AM
Hi all,
I am a beginning opengl programmer. I am trying to understand about drawing bitmaps using the glBitmap procedure. I would like to know if it requires projection as it draws directly on the buffer. When I looked into the opengl RedBook I found in the example given, the code contains a reshape function where the ortho projection is written.
Kindly help me out in this,

Thanks,
-B.

MrShoe
06-15-2002, 01:55 AM
Ortho projection is just that objects furhter away dont appear smaller, unlike in the perspective projection...
I think thats it, ive never actually use ortho...

Deiussum
06-17-2002, 04:17 AM
MrShoe is correct on the Ortho projection. So far as using glBitmap to display "bitmaps," it is used for bitmaps where there is a series of 0's and 1's where 0 is an "off" pixel and 1 is an "on" pixel. If what your trying to do is display BMP files, then you'll need to look at other methods, such as textured quads or glDrawPixels.

Balajee
06-18-2002, 01:53 PM
Dear Sir,
Thanks a lot for replying. What I am trying to do is to do volume rendering using raytracing, i.e, Trace rays from the eye point towards the volume through each pixel in the view window and for those rays hitting the volume compute the color for the particular pixel in the view window and draw them.

So eventually I'll have as many color values as the size of the view window. So instead of drawing them using the "glVertex", I thought I could use "glBitMap" which draws directly on the frame buffer. Hence does it require projection?

I would appreciate if you could throw me some light in this..

Thanks,

-B


Originally posted by Deiussum:
MrShoe is correct on the Ortho projection. So far as using glBitmap to display "bitmaps," it is used for bitmaps where there is a series of 0's and 1's where 0 is an "off" pixel and 1 is an "on" pixel. If what your trying to do is display BMP files, then you'll need to look at other methods, such as textured quads or glDrawPixels.

Deiussum
06-19-2002, 04:40 AM
Well... if you want more than 1 colors (the current raster color for "on" bits) you definitely do NOT want to use glBitmap. You'd be better off using glDrawPixels.

You don't technically need to do anything special with the projection matrix. It's generally a bit more intuitive if you setup an orthographic projection with glOrtho or gluOrtho2d, however. It's definitely not required to do so, though.

Where your pixels get drawn depends on the raster position. The raster position is also affected by the modelview and projection matrices. You should read up on glRasterPos in MSDN or the OpenGL specifications if you want more details.