Advertisement

Stupid question....

Started by October 23, 2000 04:54 PM
1 comment, last by KappaMic 24 years, 1 month ago
Simple stupid questio... I want to draw a bitmapped rectangle... must the bitmap be rectangle too? (of the same aspect ratio i mean) Does OpenGL support non square bitmaps? Sorry for the stupid question... If I draw a bitmapped quad, what''s happen if the bitmap is not square?
u can draw rectangles in gl. eg load a texture 256x256
glBegin(GL_QUADS);
glTexCoord2f(0,0); glVertex2f(0,0);
glTexCoord2f(1,0); glVertex2f(10,0);
glTexCoord2f(1,1); glVertex2f(10,20);
glTexCoord2f(0,1); glVertex2f(0,20);
glEnd();
this''ll draw a rectangle twice as high as it is wide the texture will stretch over it.
glBegin(GL_QUADS);
glTexCoord2f(0,0); glVertex2f(0,0);
glTexCoord2f(0.5,0); glVertex2f(10,0);
glTexCoord2f(0.5,1); glVertex2f(10,20);
glTexCoord2f(0,1); glVertex2f(0,20);
glEnd();
now the texture should maintain the same aspect ratio

also u can load in images that aint powers of two with glTexSubImage2D(..)


http://members.xoom.com/myBollux
Advertisement
see the size and the ratio of the bitmap matters as long as you are not usin MipMap function in GL the gluBuild2DMipmap(......) function then it will adjust the bitmap it self, but then you have to be careful in assigning the bitmap on the quad.

quote: Original post by KappaMic

Simple stupid questio...
I want to draw a bitmapped rectangle... must the bitmap be rectangle too? (of the same aspect ratio i mean)
Does OpenGL support non square bitmaps?

Sorry for the stupid question...

If I draw a bitmapped quad, what''s happen if the bitmap is not square?





This topic is closed to new replies.

Advertisement