Jump to content
  • Advertisement
Sign in to follow this  
Rosalia

DevIL Cubemaps

This topic is 3341 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 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
Advertisement
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
Sign in to follow this  

  • 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!