Jump to content
  • Advertisement
Sign in to follow this  
supagu

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!