OpenGL ES code for GL_Quads

Im facing problems in changing this code to openGL ES.
glBegin(GL_QUADS);
{
glColor4fv(c0);
glTexCoord2f(s0, t1); glVertex2i(x, y);
glTexCoord2f(s1, t1); glVertex2i(x + w, y);

        glColor4fv(c1);
        glTexCoord2f(s1, t0); glVertex2i(x + w, y + h);
        glTexCoord2f(s0, t0); glVertex2i(x,     y + h);

}
glEnd();

c0,c1(pointers) are passed through function…

This is my code in openGL ES:-

GLfloat ColorVertices[]= {(c0+1),(c0+2),(c0+3),
(c0+1),(c0+2),
(c0+3),
(c1+1),(c1+2),(c1+3),
(c1+1),(c1+2),
(c1+3)};

glEnableClientState (GL_COLOR_ARRAY);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glEnableClientState (GL_VERTEX_ARRAY);

		glColorPointer (4,GL_FLOAT,0,ColorVertices);
		glTexCoordPointer (2,GL_FLOAT,0,TexVertices2);
		glVertexPointer (2,GL_INT,0,QuadVertices2);
		glDrawArrays (GL_TRIANGLE_FAN,0,4);	

		glDisableClientState (GL_COLOR_ARRAY);
		glDisableClientState (GL_TEXTURE_COORD_ARRAY);
		glDisableClientState (GL_VERTEX_ARRAY);

Plz help its really urgent…

You’re only using three colour channels in your ColorVertices array but tell GL to use 4 so your colours will be wrong. And GL_INT is not a valid type for glVertexPointer. Use GLshort if the range is sufficient, otherwise use GLfloat.

Sorry… it was my mistake… Im using like this only…
GLfloat ColorVertices[]= {c0,(c0+1),(c0+2),(c0+3),
c0,(c0+1),(c0+2),(c0+3),
c1,(c1+1),(c1+2),(c1+3),
c1,(c1+1),(c1+2),(c1+3)};

text is missing… wat could be the reason ??? :cry:

Did you try changing the type of your position array?

yaa… i’hv try that but result is still the same… i.e. no text :frowning:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.