# cube map following camera?

This topic is 5463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

seems my cube map is following me when it shouldnt be as can be seen in the screenshots:
// code to set up my cube map, this is called 6 //times, after:
//glGenTextures(1, &texture);
//glBindTexture(GL_TEXTURE_CUBE_MAP, texture);
// that is

void TextureCube::GenerateTextureFace(int face, char* image, int width, int height, GLint type)
{
GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;

glTexImage2D(target, 0, type, width, height, 0, type, GL_UNSIGNED_BYTE, image);

glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_REPEAT);

glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}

top: http://mathewstwins.customer.netspace.net.au/temp/top1.JPG bottom: http://mathewstwins.customer.netspace.net.au/temp/bottom.JPG see how the main blue section (the sky) can be seen from the top and bottom, in roughly the same position?

##### Share on other sites
u need to uupdate the cubemap for the new position (every frame or 3)

##### Share on other sites
There can be 2 possible problems, can you explain better what problem you have?
Small piece of code you posted seems to be not relevant to the problems , it would be relevant if you don't see cubemap at all or have garbage instead of textures, or if textures is incorrectly oriented, or something similar.
I can interpret your problem in 2 ways:
1: You don't load texture matrices as you should and as result your cubemap is in local coordinate system of camera, so it looks like your cubemap rotate together with camera.
To fix, you need to get any cubemap example and study how it works.

2: your cubemap is static, that is, it doesn't change when object is moved. It's correct behavior, if you don't want it you need to update cubemap.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 17
• 46