I'm having a hard time getting a simple program to work right. I'm just trying to draw a rectangle and then apply a texture map to it. The rectangle comes out fine, but it's not textured; also strange is that it's colored a sort of brownish-orange color for no good reason that I can tell. The color of the rectangle seems to depend on which bitmap I use to try to texture the surface with. Anyway, here's the code...I'd be VERY grateful for any help you could give me. Oh - before anyone asks - yes, my bitmap's dimensions are powers of 2 (256 x 256, to be exact). http://www.opengl.org/discussion_boards/ubb/smile.gif

Nothing immediately jumps out as wrong there either, although I will say that #pragma is evil. That's a Visual C++-ism. You should really use:

struct BITMAPFILEHEADER
{
....
} __attribute__((packed));

etc.

instead.

When I get home I'll grab your source and try it out to see if there's something going on that I'm just not noticing in a cold code reading.

03-28-2001, 12:59 PM

Originally posted by rts:
Nothing immediately jumps out as wrong there either, although I will say that #pragma is evil. That's a Visual C++-ism. You should really use:

struct BITMAPFILEHEADER
{
....
} __attribute__((packed));

etc.

instead.

When I get home I'll grab your source and try it out to see if there's something going on that I'm just not noticing in a cold code reading.

Hmm. Okay - I didn't know about the __attribute__ thing. Can you tell I haven't been programming under Linux much? http://www.opengl.org/discussion_boards/ubb/smile.gif But thank you very much for looking at this for me - it's been driving me CRAZY. I appreciate it. http://www.opengl.org/discussion_boards/ubb/smile.gif

-Will

03-28-2001, 01:14 PM

BTW - here's that typedefs.h file; it's not too hard to figure out what's in it, but this'll save you from having to type it out, anyway. http://www.opengl.org/discussion_boards/ubb/smile.gif

Step away from the quad... http://www.opengl.org/discussion_boards/ubb/smile.gif

Change your gluLookAt to something like:

gluLookAt(320.0, 240.0, 500.0,
320.0, 240.0, -1.0,
0.0, 1.0, 0.0);

(Note the 500.0). You were standing really really close to your quad.

03-28-2001, 07:11 PM

God. Thank you. I was working on solving the problem myself just now and had just managed to narrow it down to a problem with my viewing. Now that I think about it, it makes perfect sense - I was so close that the brownish-orange I was seeing was the color of a small part of the bitmap, blown up to fill the entire field of vision. Sigh. http://www.opengl.org/discussion_boards/ubb/smile.gif