View Full Version : Sizing primitives in opengl
06-07-2010, 07:51 PM
Hey I just recently started looking at the opengl library after I coded with allegro for a few months. I'm going to start by attempting a 2d tile map editor. I just figured out how to load jpeg images into a texture and I can map them easily to a quad. However, I can't figure out how to size my quads. I have a 32x32 pixel jpeg image and I would like to map it to a 32x32 pixel quad. Working with the vertexes is new to me and i'm still a little confused. Any help?
06-08-2010, 02:07 AM
There is one extra level of indirection in OpenGL, it has to do with modelview and projection transformation.
If fact, you can choose to work with float coordinates between 0 and 1 for x and y, to be resolution independent and let your 2D graphics scale easily.
Or use pixel coordinates if you really want to, see the links below :
http://www.opengl.org/wiki/Viewing_and_T...3D_rendering.3F (http://www.opengl.org/wiki/Viewing_and_Transformations#How_do_I_draw_2D_contr ols_over_my_3D_rendering.3F)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.