Vanarajan
Vanarajan

Reputation: 539

COCOS2DX open GL issue 2.0

I use COCOS2DX. I tried to change the following syntax cocos2d to cocos2dx.

What is the use of "glTexCoordPointer" in OpenGL1.0?

What is the same syntax in Open GL 2.0?

Can you assist me?

Upvotes: 0

Views: 210

Answers (1)

Vanarajan
Vanarajan

Reputation: 539

After long search, i got this for ES 2.0

The same syntax in OpenGL 2.0 is "glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, coordinates);" The code syntax:

ccGLBindTexture2D (tongue->getName());

ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords);

glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, vertices);

glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, coordinates)

glDrawArrays(GL_TRIANGLES, 0, 4);

glEnableVertexAttribArray(GL_TEXTURE_2D);

Upvotes: 1

Related Questions