Advertisement

Migrating to GLKit Skybox Effect not working.

Started by October 18, 2011 12:15 PM
0 comments, last by EnlightenedOne 13 years, 1 month ago
Hey all,

I have been migrating from OGLES2 Oolong to GLKit

Has anyone got a GLKSkyboxEffect to work? I am keen for an example of what people plug into the transforms, I have very little to go on.

Here is all code relating to the skybox effect.

glkSkyShader = [[GLKSkyboxEffect alloc] init];

glkSkyShader.textureCubeMap.name = [uzEngineState getVolWeather]->getCubeTexture(i);
[glkSkyShader setCenter:GLKVector3Make(0, 0,0)];
[glkSkyShader setXSize:SKYBOXSIZE];
[glkSkyShader setYSize:SKYBOXSIZE];
[glkSkyShader setZSize:SKYBOXSIZE];

Draw Loop:

glkSkyShader.transform.projectionMatrix = GLKMatrix4MakePerspective((float)CAMERAFOV, (float)460/(float)320, (float)1, (float)10);

glkSkyShader.transform.modelviewMatrix = GLKMatrix4MakeLookAt(3, 1, 0, 0, 0, 0, 0, -1, 0);

[glkSkyShader prepareToDraw];

[glkSkyShader draw];

Is there something you have to bind before you draw it? The resulting mess of pixels looks vaguely like a view frustum/one of my models. Below is the skybox and the model it looks like. The textures shown are from Oolong engine I do not own them.

[attachment=5778:screenshot.jpg]

Thanks
EnlightenedOne
No one has read this and I have solved it after realising the skybox was using the vertex data from a model built after itself.

I just had to add a call to glBindVertexArrayOES(0); after drawing the skybox.

I do wish the delete thread button was reinstated for these embarrassing moments :P

This topic is closed to new replies.

Advertisement