What data type should I use for my texture coordinates in OpenGL ES?
- by Matthew Chen
I notice that the default data type for texture coordinates in the OpenGL docs is GLfloat, but much of the sample code I see written by experienced iphone developers uses GLshort or GLbyte. Is this an optimization?
GLfloat vertices[] = {
// Upper left
x1, y2,
// Lower left
x1, y1,
// Lower right
x2, y1,
// Upper right
x2, y2,
};
glTexCoordPointer(2, GL_FLOAT, 0, iconSTs);
vs.
GLbyte vertices[] = {
// Upper left
x1, y2,
// Lower left
x1, y1,
// Lower right
x2, y1,
// Upper right
x2, y2,
};
glTexCoordPointer(2, GL_BYTE, 0, iconSTs);