PDA

View Full Version : glGenRenderbuffersEXT() segfault? Need help...



MrUNOwen
08-04-2011, 01:18 AM
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\n", &mDepth);
// create a renderbuffer object to store depth info
glGenRenderbuffersEXT(1, &mDepth);
printf("dP\n");
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mDepth);
printf("ddP\n");
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
SysInfo::width(), SysInfo::height());
printf("dP\n");
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
printf("P\n");
// create a framebuffer object
glGenFramebuffersEXT(1, &mFBO);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO);
printf("P\n");
// attach the texture to FBO color attachment point
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, mTexBack, 0);
printf("P\n");
// attach the renderbuffer to depth attachment point
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, mDepth);
printf("P\n");
}

output:

f
gggggga
adddddd
P 144564912
Segmentation fault

Alfonse Reinheart
08-04-2011, 01:22 AM
Did you load the glGenRenderbuffersEXT function pointer (http://www.opengl.org/wiki/Load_OpenGL_Functions)?

MrUNOwen
08-04-2011, 10:36 AM
So.... if I understand that correctly I have to call that function with "glGenRenderbuffersEXT()" as the argument and then typedef what it returns as glGenRenderbuffersEXT()?

Also... is this available for the iphone too and if so is it the same method as the mac?

MrUNOwen
08-04-2011, 11:43 AM
Didn't work: obj/ScreenItem.cc:10: error: ‘glXGetProcAddress’ was not declared in this scope

What do I need to include? I already have GLEW GLEXT included....

obj/ScreenItem.cc:10: error: ‘glXGetProcAddress’ was not declared in this scope

Alfonse Reinheart
08-04-2011, 12:53 PM
Did you include glx.h?