Remcod
Remcod

Reputation: 41

glDrawArrays from iOS to OSX

I'm trying to get a game I made for iOS work in OSX. And so far I have been able to get everything working except for the drawing of some random generated hills using a glbound texture.

It works perfectly in iOS but somehow this part is the only thing not visible when the app is run in OSX. I checked all coords and color values so I'm pretty sure it has to do with OpenGL somehow.

glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);

glBindTexture(GL_TEXTURE_2D, _textureSprite.texture.name);
glColor4f(_terrainColor.r,_terrainColor.g,_terrainColor.b, 1);    
glVertexPointer(2, GL_FLOAT, 0, _hillVertices); 
glTexCoordPointer(2, GL_FLOAT, 0, _hillTexCoords);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)_nHillVertices);   

glEnableClientState(GL_COLOR_ARRAY);    
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D); 

Upvotes: 4

Views: 180

Answers (2)

Remcod
Remcod

Reputation: 41

Appearantly it was being drawn after all, only as a 1/2 pixel line. Somehow there is some scaling on the vertices in effect, will have to check my code.

Upvotes: 0

datenwolf
datenwolf

Reputation: 162164

You're disabling the texture coordinate (and color) array along with the texturing unit, yet are binding a texture coordinate pointer.

Is this really what you intend to do?

Upvotes: 2

Related Questions