X and Y coordinates and OpenGL

Started by
1 comment, last by Zongo 18 years, 4 months ago
I've just began OpenGL and gotten to texture mapping and all, but I was curious... Can you make the X and Y values optimized for 2D (Ex. 300x200 instead of 1.0fx0.0f)?
=============================All knowledge is good; only the way it is put to use is good or evil.
Advertisement
Yes. Switch to ortho mode and then you have it. Use the something like that glVertex2i. (i) stands for integer.
-----"Master! Apprentice! Heartborne, 7th Seeker Warrior! Disciple! In me the Wishmaster..." Wishmaster - Nightwish
If it's for texture coordinates, I guess you could just add a texture matrix transform:

glMatrixMode( GL_TEXTURE );glScalef( 1.f / size_texture_X, 1.f / size_texture_Y, 1.f );glMatrixMode( GL_MODELVIEW );// Draw your 2D stuff here ...// Restore the texture matrix for 3D drawingglMatrixMode( GL_TEXTURE );glLoadIdentity();glMatrixMode( GL_MODELVIEW );


HTH.

[Edited by - Zongo on December 18, 2005 4:10:19 AM]

This topic is closed to new replies.

Advertisement