I am using pyopengl (using Opengl version 3.3)
I have the following code (part of a larger codeset where I project the depth around a location onto a cubemap). When I run the entire code it runs fine. However, now that I am tidying up and completing the code I run into a problem of an incomplete framebuffer.
The code is as follows:
# CREATE EMPTY CUBEMAP
######################
side = 2000
# create framebuffer for cube face
depth_map_fbo = glGenFramebuffers(1)
glBindFramebuffer(GL_FRAMEBUFFER, depth_map_fbo)
# CREATING A TEXTURE FOR THE ENTIRE CUBE
distance_cube_tex = glGenTextures(1)
glBindTexture(GL_TEXTURE_CUBE_MAP, distance_cube_tex)
for i in range(6):
glTexImage2D(
GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_R32F, side, side, 0, GL_RED, GL_FLOAT, None
)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST) # or GL_LINEAR?
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)
# attach depth texture to fbo depth buffer
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, distance_cube_tex, 0)
# CREATING A TEXTURE FOR A CUBE FACE
depth_cube_face_tex = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, depth_cube_face_tex)
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32F, side, side,
0, GL_DEPTH_COMPONENT, GL_FLOAT, None)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) # or GL_LINEAR?
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
# attach texture(=image) to the framebuffer
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_cube_face_tex, 0)
# check for errors *ERROR*
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE):
print(glCheckFramebufferStatus(GL_FRAMEBUFFER))
raise RuntimeError("ERROR.FRAMEBUFFER. Framebuffer is not complete!")
# unbind depth map framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, 0)
The code blows up when it gets to the ERROR checking. Now, in order to find the exact nature of the error I printed glCheckFramebufferStatus(GL_FRAMEBUFFER)
(as shown in the code). I get a value of 36264 which in hex is 8DA8. Unfortunately when I look through the opengl codes I get no match for this hexadecimal value??
Can anyone see something obvious that I am missing?