void MySprite :: draw () {
glLineWidth (5);
glColor4f (1.0, 0.0, 0.0, 1.0);
glDisable (GL_TEXTURE_2D);
glDisableClientState (GL_TEXTURE_COORD_ARRAY);
glDisableClientState (GL_COLOR_ARRAY);
GLfloat ver [4] = {100,50,200,50};
/ / GlVertexAttribPointer (0, 2, GL_FLOAT, GL_FALSE, 0, ver);
glVertexPointer (2, GL_FLOAT, 0, ver);
glDrawArrays (GL_LINES, 0, 3);
glEnableClientState (GL_COLOR_ARRAY);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glEnable (GL_TEXTURE_2D);
} I xcode eyed opengles es1
Why do I use glVertexPointer () This method does not qualify for a draw. But I glVertexAttribPointer can draw to qualify, but the line color is gray instead of red, how else to you. Expert help
Reply:
Unlike you OpenGLES of this code, but rather the OpenGL
Reply:
Talk OpenGL ES1 and OpenGL ES2 use there is a difference:
/ / OpenGL ES 1.1 wrote:
glVertexPointer (2, GL_FLOAT, ...);
glColorPointer (4, GL_FLOAT, ...);
/ / OpenGL ES 2.0 become so
glVertexAttribPointer (positionSlot, 2, GL_FLOAT, ...);
glVertexAttribPointer (colorSlot, 4, GL_FLOAT, ...);
Do not confuse the two friends
No comments:
Post a Comment