Anyone have a clue why glGenRenderbuffersEXT() would segfault? I’m using Qt QGLWidget.
ScreenItem::ScreenItem(int img) : Manager()
{
mTexImg = img;
glEnable(GL_TEXTURE_2D);
// create a texture object
glGenTextures(1, &mTexBack);
glBindTexture(GL_TEXTURE_2D, mTexBack);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); // automatic mipmap
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, SysInfo::width(), SysInfo::height(), 0,
GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);
printf("P %d
", &mDepth);
// create a renderbuffer object to store depth info
glGenRenderbuffersEXT(1, &mDepth);
printf("dP
");
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mDepth);
printf("ddP
");
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
SysInfo::width(), SysInfo::height());
printf("dP
");
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
printf("P
");
// create a framebuffer object
glGenFramebuffersEXT(1, &mFBO);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO);
printf("P
");
// attach the texture to FBO color attachment point
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, mTexBack, 0);
printf("P
");
// attach the renderbuffer to depth attachment point
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, mDepth);
printf("P
");
}
output:
f
gggggga
adddddd
P 144564912
Segmentation fault