Talk:GLES

From Pandora Wiki
(Redirected from Talk:OpenGL ES 1.1 Tutorial)
Jump to: navigation, search

OpenGL ES 1.1 does not support the option GL_QUADS. The only supported drawing primitives are GL_POINTS, GL_LINES, GL_LINE_LOOP, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN.

static void DrawSprite(GLuint sprite, float X, float Y, float Z, float W, float H)
{
	glBindTexture(GL_TEXTURE_2D,sprite);
  
	GLfloat box[] = {X,Y + H,Z,  X + W,Y + H,Z,  X,Y,Z,  X + W, Y, Z};
	GLfloat tex[] = {0,0, 1,0, 0,1, 1,1} ;
 
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
	glVertexPointer(3, GL_FLOAT, 0,box);
	glTexCoordPointer(2, GL_FLOAT, 0, tex);
 
	glDrawArrays(GL_TRIANGLE_STRIP,0,4);
 
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}