Question

I'm trying to build something but I don't think it's feasible. Is it possible to attach non-power of two images using a cubemap in OpenGL? I'm working with:

for(int k = 0; k < 6; k++){
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + k, 0, GL_RGBA32F, 
m_iWidth, m_iHeight, 0, GL_RGBA, GL_FLOAT, NULL);
//other code
}

If the values of m_iWidth, m_iHeight are NPOT, then obviously it doesn't works. Is there any way to do that? My goal is about made an environment map dynamically on size (depending of the viewport).

The binding and parameters are GL_TEXTURE_CUBE_MAP. Other details: this is not OpenGL ES or hoping compatibility ;-)

Was it helpful?

Solution

Cubemaps don't have to be powers-of-two in size, but they must be squares. So they can't be sized "depending of the viewport". And there's no reason for them to be either.

If you're trying to make an environment map, then the size of the texture should not be dependent on the exact size of the rendered image. You probably want to scale up the texture with higher resolutions, but you don't want the environment map to match the destination image size.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top