PDA

View Full Version : byte/short vertex/texture coordinate



murphychen
02-03-2005, 08:18 PM
In OpenGL / OpenGL ES Spec, the byte/short vertex/texture coordinate conversion seems not be defined.

If OpenGL Spec 1.5, there is a table (2.9) describing how to convert byte/short value to float value for color, normal, and depth components.

But there is no such table for vertex and texture coordinates.

If I have a vertex array:
GLshort point[] = {1, 1, 1}
Does it means {1.0F, 1.0F, 1.0F}?

How about texture array?
If GLshort point[] = {1, 1} means {1.0F, 1.0F}, how can I represent texture coordinate such as {0.5F, 0.5F} by GLshort?

flame
02-03-2005, 11:32 PM
Hi.

That is correct. Only way you can have 0.5 texture coordinate with shorts is to use texture matrix with scaling for s and t.

If you just want 0.5 to be represented, then have a scale of 0.5 -> short of 1 will mean 0.5, short of 2 will mean 1.0 etc..

Of course the more usual scales are for example 1/4096 or 1/256.

--jani;

flame
02-03-2005, 11:34 PM
Still adding to my previous response.

There is a 32-bit fixed point format for all vertex data. With that format you don't need texture matrix to do the scaling (identity) for you. Downside is that it is a 32-bit representation -> takes more memory etc.

--jani;

V-man
02-16-2005, 05:38 AM
How can I convert a model and it's textures and normals to GLfixed?

Does the projection, modelview and texture matrix need to be modified in a certain way?