View Full Version : uv question i want to set by pixels not by float coord

12-07-2005, 03:14 PM
is there any function in opengl to set the uvs by PIXEL numbers and not by floats or integers? i mean the integers equals a pixel or what?? i have an image with 4 images say this image is 256x256 and there are 4 images inside that one how can i set the uvs if i know the size of each image ?? that wy i want a pixel function and not to set some floats or stuff like that 'cos its harder that way

with pxiels itis easi

12-07-2005, 03:28 PM
Specify coordinates that map some numbers to pixels.

Texgen in eyespace can also be useful especially with a projective matrix.

12-07-2005, 05:21 PM
your tech answer didnt help me srry
can u show me somethin practical?
btw thx!

12-08-2005, 04:48 AM
Set a texture matrix that scales the coordinates by the reciprocal of the texture size.

glScale(1.0/256.0, 1.0/256.0, 1.0);Or simply do it by hand.

glTexCoord2f(x/256.0, y/256.0); ARB_texture_rectangle (http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_rectangle.txt) textures also use non-normalized texture coordinates.