What data type should I use for my texture coordinates in OpenGL ES?
        Posted  
        
            by Matthew Chen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Matthew Chen
        
        
        
        Published on 2009-11-20T22:12:55Z
        Indexed on 
            2010/06/13
            15:12 UTC
        
        
        Read the original article
        Hit count: 316
        
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);
© Stack Overflow or respective owner