Jump to content
  • Advertisement
Sign in to follow this  

[SOLVED ] Troubles with Cube Maps

This topic is 5203 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've been having a bit of trouble getting cube maps to work properly. The code here has been pared back to a very simple test of correctness: the cube map is all red, so the sphere should be also. Unfortunately, it stays white (or green, or blue, if I change the glColor3f call). I assume I'm overlooking something very simple, but I have no idea what it is. Any help would be welcome.
GLuint texture;

void init_render()


	GLubyte blank[256][256][3];
	glGenTextures(1, &texture);
	glBindTexture(GL_TEXTURE_CUBE_MAP_EXT, texture);
	for (int i = 0; i < 256; i++)
		for (int j = 0; j < 256; j++)
			blank[j][0] = (GLubyte) 255;
			blank[j][1] = (GLubyte) 0;
			blank[j][2] = (GLubyte) 0;
	for (int i = 0; i < 6; i++)
		glTexImage2D(face, 0, GL_RGB, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, blank);



void render(Camera camera)
	GLUquadricObj* quadric = gluNewQuadric();
	gluQuadricOrientation(quadric, GLU_OUTSIDE);
	gluSphere(quadric, 1, 50, 50);

[Edited by - AnarchicBunny on July 20, 2005 9:02:54 PM]

Share this post

Link to post
Share on other sites
its white cause the texture didnt get setup correctly, try glgeterror().
also check the gl spec (the part about texture correctness) -- heres a bit
3.8.10 Texture Completeness
A texture is said to be complete if all the image arrays and texture parameters
required to utilize the texture for texture application is consistently defined. The
definition of completeness varies depending on the texture dimensionality.
For one-, two-,

(read the rest)

Share this post

Link to post
Share on other sites
It says the requirements are:
•The levelbase arrays of each of the six texture images making up the cube
map have identical, positive, and square dimensions.
• The levelbase arrays were each specified with the same internal format.
• The levelbase arrays each have the same border width.

Now, correct me if I'm wrong, but aren't all of these satisfied by the above code? And as I said, it's not just white, it's any color I set it to. I know that a white texture generally points to some error in how I set the textures up, but that doesn't seem to be the case here.

Share this post

Link to post
Share on other sites
Wrapping doesn't change anything, and glGetError returns 0 every frame.

glIntercept, on the other hand, demonstrated something odd. I noticed the nVidia demos don't generate or bind any textures, and yet somehow work. Even odder still, when I take out either the glGenTexture or glBindTexture calls, my cube maps work. When both of them are called, though, it's back to the blank sphere.

I have to admit, I'm more confused than ever.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!