Skip to main content
gamedev.net
🔒 Locked

cube map question

Started by hello_there Jun 1, 2004 at 1:12 AM 5 replies 500+ views
Original Post
hello_there
hello_there
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?
____________How could hell be worse?
hello_there
hello_there
Someone must know what i''m rambling on about?
____________How could hell be worse?
Bouga
Bouga
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);
"A screen buffer is worth a thousand char's" - me
hello_there
hello_there
Ahh thanks i found out the answer to my other question to.
____________How could hell be worse?
hello_there
hello_there
what does GL_RGB8 mean?
____________How could hell be worse?
_the_phantom_
_the_phantom_
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)
hello_there
hello_there
ahh i see.

Anyone know where i can find a tutorial on loading dds files?
____________How could hell be worse?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.