ok i am a pain,
no doubt on that, but since i am stuck, i’ll bother u once more. I have to make a nice app, consisting in radiosity and env maps. I am focusing on env maps, as for now.
I am not really advanced yet, but still i have that task to do… I am getting a bit confused on the cubemapping and texturing stuff.
Ok i have a nice skybox all around… now i make the cubemap: i take the 6 shots of the scene with 6 separate renders (no optimization for now, i just want to get the basics).
Now where the hell i store the rendered images? I kinda figure out that i need to convert them in a texture (somehow) and then sick the same texture on my reflective objects.
Now I have 6 different shots of the env, but i need to melt them in just one texture (spherical?).
I am completely lost. Here is the code that i am using:
void DynamycCubeMap()
{
glViewport(0,0,128,128);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90,1.0,1,5000);
glMatrixMode(GL_MATRIX_MODE);
for (int k;k<6;k++)
{
glClear(GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glRotatef(CubeMapRots[k][0], CubeMapRots[k][1], CubeMapRots[k][2], CubeMapRots[k][3]);
RenderSkyBox();
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
>now, i am using this global texture. I know
>that this way it doesn’t work, still
>since i had no clue about how to make it
>correct, i left it as u can see.
>global-texID was dfined with a simple
>glTexGen(GL_TEXTURE_CUBE_MAP_ARB,global-texID);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB,
global.texID);
glCopyTexImage2D(GL_TEXTURE_CUBE_MAP_ARB,0,GL_RGB,0,0,128,128,0);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
}
Reshape(global_width,global_height);
}
void Display ()
{
glPushMatrix();
DynamycCubeMap();
glPopMatrix();
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glColor3f(1.0,1.0,1.0);
RenderSkyBox();
glPopMatrix();
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glPushMatrix();
//Enable cube mapping
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glMatrixMode(GL_TEXTURE);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB,global.texID);
//BISOGNA CARICARE LA TEXTURE!!!
glPushMatrix();
//Render the main sphere!
gluSphere(sphere, 6.0f, 64, 64);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
glPushMatrix();
RenderSphere();
glPopMatrix();
glutSwapBuffers();
glutPostRedisplay();
}
this chunk was taken from the http://opengl.nutty.org
dynamic cubemapping demo.
I didn’t use the full code
cause:
a) i am not working under win
b) actually i wanna UNDERSTAND
how this stuff works.
thank you everyone for the help…
just one more thing:
if u wanna help me, keep it simple i am (still) really lame