Advertisement

How do u use glBitmap() and glDrawPixels()?

Started by April 04, 2001 08:06 PM
11 comments, last by Corillian 23 years, 7 months ago
I am currently loading a bitmap into an AUX_RGBImageRec and drawing like this: //draw bitmap from left corner of the screen glRasterPos2i(0, 0); glBitmap(bmp->sizeX, bmp->sizeY, 0, bmp->sizeY, 0, 0, bmp->data); All this does currently is give me an illegal error, could it be in my bmp loading code or is my drawing code totally wrong? Thanks, -Corillian
glBitmap draws a array of bits. bits can either be on or off, thus youre stuck with 2 colours.

check out the opengl FAQ http://www.frii.com/~martz/oglfaq/

2.130
What is the AUX library?
Very important: Don''t use AUX. Use GLUT instead.
The AUX library was developed by SGI early in OpenGL''s
life to ease creation of small OpenGL demonstration programs.
It''s currently neither supported nor maintained. Developing
OpenGL programs using AUX is strongly discouraged. Use the
GLUT instead. It''s more flexible and powerful and is
available on a wide range of platforms.

personally to load images ild go with something like the openil library (if its still called that) www.openil.org it loads windows "bmp" files as well as jpg, png etc.

once youre loaded your image draw it with
glRasterPos2i(0, 0);
glDrawPixels(..)

or better yet.
enabled texture mapping and draw an opengl primitive (triangle,quad) with the image on it


http://members.xoom.com/myBollux
Advertisement
I already tried textured quad. The image is a 24 bit 800x600 1.5 mb bitmap. OGL won''t draw it as a textured quad for some reason...
try mip mapping it. if not, then the dimension of a texture has to be a power of two, like 64x64, 128x64, 256x32, etc.


thuned

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)
That doesn''t work either. I tried mip-mapping + texture and mip-mapping on different resolutions. Could someone pls tell me how to use glBitmap() and/or glDrawPixels()?
Download the Microsoft Platform SDK, specificlly the graphics section. They have a help file for OpenGL which includes detailed descriptions of all the functions, their parameters, and what they do. In fact, this information should be in the version of MSDN you got with VC++ (if that''s what you''re using)... If you''re not using windows, I don''t know what the unix/mac equivalent is, but you could always browse the MSDN library online.

As for drawing an 800x600 bitmap as a texture on a quad, textures must be powers of two, so you could create a 1024x1024 texture, and only use the top-left 800x600 pixels, but that is a lot of overkill.
Advertisement
800x600, youre not wanting to use this texture as a background are you?
if so check out my latest opengl extension demo.
also on my site plenty of examples of loading textures and displaying them on quads

http://members.xoom.com/myBollux
A background is exactly what I want to use this texture for. Which is why I want to know how to use glDrawPixels() and why the .bmp is so big.
800x600? Opengl only supports textures that are actual powers of two, such as 4x4, 256x512, etc (OpenGL Superbible, pg. 276). That could be a big part of your problem, if you really are just trying to bind an 800x600 image to a texture.
for a background like i said see the latest opengl example example on my site (wgl_buffer_region) it saves and restores surfaces (with depth info) very quick

http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement