PDA

View Full Version : opengl draw



milton
10-31-2011, 06:55 AM
i make a small game with SDL+OpenGL
and now i have this problem

how to draw only a single part of an GLuint texture(like clips in SDL)

BionicBytes
10-31-2011, 08:29 AM
what's a 'single part of a texture'?
You could use a smaller range for your texture coordinates rather than 0.0 --> 1.0. You can now render anything from a single texel to the entire texture.

milton
10-31-2011, 09:08 AM
i mean a small part of an image

V-man
10-31-2011, 06:00 PM
You can't draw a texture. You can only draw polygons and apply a texture to them. How the texture appears depends on texture coordinates. You might want to read the OpenGL programming guide. It teaches the basics.

Basically, you use coordinates such as {0.0, 0.5}