Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

hello_there

cube map question

This topic is 5283 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

I''m learning cg and i''m reading the cg tutorial. I''m up to the bit on bump mapping and i was wondering for uniform samplerCUBE normalizeCube could you use the same cubemap for every object you want to render? If so can you point me somewhere where i can get one. I''ve never used cubemaps before. is there anything you have to do in opengl to set them up?

Share this post


Link to post
Share on other sites
Advertisement
Hi,

heres how you set up a cube map...


glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, SkyCubeMap);

glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, GL_RGB8, SkyBoxTexture[0].Width,SkyBoxTexture[0].Height,
GL_RGB, GL_UNSIGNED_BYTE, SkyBoxTexture[0].Data);

gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, GL_RGB8, SkyBoxTexture[1].Width,SkyBoxTexture[1].Height,
GL_RGB, GL_UNSIGNED_BYTE, SkyBoxTexture[1].Data);

gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, GL_RGB8, SkyBoxTexture[2].Width,SkyBoxTexture[2].Height,
GL_RGB, GL_UNSIGNED_BYTE, SkyBoxTexture[2].Data);

gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, GL_RGB8, SkyBoxTexture[3].Width,SkyBoxTexture[3].Height,
GL_RGB, GL_UNSIGNED_BYTE, SkyBoxTexture[3].Data);

gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, GL_RGB8, SkyBoxTexture[4].Width,SkyBoxTexture[4].Height,
GL_RGB, GL_UNSIGNED_BYTE, SkyBoxTexture[4].Data);

gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, GL_RGB8, SkyBoxTexture[5].Width,SkyBoxTexture[5].Height,
GL_RGB, GL_UNSIGNED_BYTE, SkyBoxTexture[5].Data);


But before you do, you should check if it is availeable:


const GLubyte* str = glGetString(GL_EXTENSIONS);
if(strstr((const char*)str, "GL_ARB_texture_cube_map") == NULL)
{MessageBox(NULL,"Your OpenGL Implementation Doesn''t Support Cube-Mapping!","Extension Missing!",MB_OK); return false;}


And you enable disable it just like GL_TEXTURE_2D:

glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);

Share this post


Link to post
Share on other sites
it means use an internal buffer format of Reg-Green-Blue with 8 bits per color channel, used to enforce 32bit color on textures (older ATI drivers for one seemed to select 16bit mode when only told to give GL_RGB, even if the window was in 32bit mode)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!