Sign in to follow this  
Rosalia

DevIL Cubemaps

Recommended Posts

I'm using the following code to load a cubemap using DevIL. I know the problem is here because it is the only change I made in the following working code, which used glaux. http://www.codesampler.com/usersrc/usersrc_8.htm#oglu_per_pixel_reflective_environment_mapping

	ilInit();
	iluInit();
	ilutRenderer(ILUT_OPENGL);

	ILuint image;
	ilGenImages(1, &image);
	ilBindImage(image);

	glGenTextures( 1, &g_uiCubemapTexture );
	glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, g_uiCubemapTexture );

	int j;
	for ( j=0; j < 6; j++ )
	{
		ilLoadImage((const ILstring)g_cCubemaps[j]);
		ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);

		// Build textures and mipmaps
		glTexImage2D( g_uiCubeMapConstants[j], 0, ilGetInteger(IL_IMAGE_BPP), 
			ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), 0, GL_RGB,
			 ilGetInteger(IL_IMAGE_FORMAT), ilGetData());
		gluBuild2DMipmaps( g_uiCubeMapConstants[j], ilGetInteger(IL_IMAGE_BPP), 
			ilGetInteger(IL_IMAGE_WIDTH), ilGetInteger(IL_IMAGE_HEIGHT), GL_RGB,
			ilGetInteger(IL_IMAGE_FORMAT), ilGetData());

		ilDeleteImages(1, &image);

	}


if I move

	ILuint image;
	ilGenImages(1, &image);
	ilBindImage(image);


inside the loop, I only get a gray screen. (Otherwise I get a white background and a black skull - it should be a textured background and a reflective skull) Thanks, Rosália

Share this post


Link to post
Share on other sites
Because this is not my code, I just downloaded it at http://www.codesampler.com/usersrc/usersrc_8.htm#oglu_per_pixel_reflective_environment_mapping and changed glaux code for devIL code.

Then it stopped working.

Any ideas?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this