PDA

View Full Version : bitmap



06-21-2002, 12:13 PM
I am reading "OpenGL Super Bible" by Richard Wright. I am trying to understand how to put bitmap as texture on the object. The example in chapter 12 "pencil" works OK with the bitmap provided by the book. But after I modified the size of the bitmap, the texture didn't work any more. Is there any relation between the size of the object they draw
and the size of the bitmap as texture? below are the functions used to load the bitmap.

thanks a lot.

jim


GLubyte * /* O - Bitmap data */
LoadDIBitmap(const char *filename, /* I - File to load */
BITMAPINFO **info) /* O - Bitmap information */


GLuint /* O - Texture object or 0 on error */
TextureLoad(char *filename, /* I - Bitmap file to load */
GLboolean alpha, /* I - Generate alpha for bitmap */
GLenum minfilter, /* I - Minification filter */
GLenum magfilter, /* I - Magnification filter */
GLenum wrap) /* I - Repeat or clamp */

PencilTexture = TextureLoad("pencil.bmp", GL_FALSE, GL_LINEAR, GL_LINEAR,
GL_REPEAT);

satan
06-21-2002, 12:20 PM
Originally posted by jim2002:
But after I modified the size of the bitmap, the texture didn't work any more.

If you reread chapter 8 it should be no problem to answer your question yourself.

06-21-2002, 12:45 PM
I actually enlarged the bitmap a little bit then change the size back exactly acoording to the original size, but it still doesn't work. I checked the bitmap header, the width and height are the same.

thanks.

jim

satan
06-22-2002, 02:08 AM
So it looks like it's not a problem of the size of the texture. Are you sure your bitmap loads correctly?
You said your texture didn't work anymore, what does this mean - white or distorted?

I never did anything with the Super Bible examples (some just refused to work and others looked just horrible).
I would recommend to just write a little texture prog on your own (just start with a textured quad or a cube) and play around with your own code and not these (in my opinion) bad examples.
Btw, the book itself is great for getting the basics for OpenGL programming.


[This message has been edited by satan (edited 06-22-2002).]