Reputation: 9240
I am trying to setup shadow mapping in OpenGL using cube maps so I can do shadows for point lights.
The following throws a GL_INVALID_ENUM
at me:
for (uint32_t i = 0; i < 6; i++)
GLCALL(glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT32, windowWidth, windowHeight, 0, GL_DEPTH_COMPONENT32, GL_FLOAT, 0));
According to the docs, it is probably because of this:
GL_INVALID_ENUM is generated if target is one of the six cube map 2D image targets and the width and height parameters are not equal.
And I get if the width/height are different, they aren't really a cube, but when I have a screen resolution like 1920x1080 or any other resolution this is a problem.
Perhaps though I have missunderstod what to supply to the function call - isn't it the window width/height? What are the parameters supposed to be?
Upvotes: 0
Views: 1021
Reputation: 162317
Perhaps though I have missunderstod what to supply to the function call - isn't it the window width/height?
How in the world you think that the window resolution influences texture sizes is beyond me. You normally render shadow mapping depth maps using a framebuffer object, so the window dimensions are irrelevant.
What are the parameters supposed to be?
For a cube map: The edge length of the cube map texture.
Upvotes: 1