This topic is now archived and is closed to further replies.


OpenGL Help me....Weird OpenGL bug...

Recommended Posts

I have just loaded a bitmap and am displaying it on screen in ortho 2d mode: glOrtho(0, SCREEN_WIDTH - 1, 0, SCREEN_HEIGHT - 1, -1, 1); So I''m using the glRasterPos2i() function to place the bitmap appropriately. Now, since I want to give a coordinate for the TOP-LEFT of my bitmap and since glRasterPos2i() is the BOTTOM-LEFT of the bitmap, heres how I write my code: DrawBitmap(int x, int y) { // Set the position of the bitmap glRasterPos2i(x, (SCREEN_HEIGHT - (y + header.biHeight))); // Draw the bitmap glDrawPixels(header.biWidth, header.biHeight, GL_RGB, GL_UNSIGNED_BYTE, image); } So now to place my bitmap in the top left corner of the screen all I have to do is call DrawBitmap(0, 0). Right? Well, in my case I tested it with two bitmaps. One of size 32x32 and one with size of 256x256. When I tested them both with DrawBitmap(1, 1) I got different results. The 256x256 bitmap worked as it should. However, with the 32x32 bitmap, there was no single strip on the top of the bitmap! It was as if I had placed it with DrawBitmap(1, 0). Whats going on? If anyone can help, please do so. Thanks!

Share this post

Link to post
Share on other sites