Segmentation fault while using PBO

Well. I am not sure whether is my fragment shader program got error or the pointer of the PBO is wrong.

Here is my shader:

static const char *fragment_source = {

“uniform sampler2DRect texture;”

“void main()”
//Read texture coordinates
“vec2 texCoord = gl_TexCoord[0].xy;”
//Read value of texture of current pixel
“vec4 color = text2DRect(texture,texCoord.x);”
//Perform pattern matching
“gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);”
“else if(color==‘r’)”
“gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);”
“else if(color==‘o’)”
“gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);”
“else if(color==‘j’)”
“gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);”
“else if(color==‘a’)”
“gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);”
“else if(color==‘n’)”
“gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);”
“gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);”

The gl_Fragcolor will output red color in that fragment on the frame buffer right?

When I want to read pixels into PBO from frame buffer. It comes out the segmentation error.

/Read values back/
//Set the target framebuffer to read
//Read the packet payload from framebuffer to PBO
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboread);
printf("Data after roundtrip:

//Map the PBO to process its data by CPU
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboread);

	for (i=0; i<noOfpacket*size; i++)




Is it my code got problems? Please correct me as well.

Which point do you get the segfault at? glReadBuffer? glBindBuffer? glReadPixels?

Have you run it in a debugger and checked the values of variables and function pointers? Doing so should clue you in on what’s wrong very quickly.

Otherwise can you post your PBO creation code? And where exactly do you call glMapBuffer anyway?

I got try use debugger. But I cant solve the debugger problem.

The following system libraries are missing:

Please ask your system administrator to install the missing libraries or create symbolic links from the above paths to the place where the libraries are installed.

It shows me this message when I want to debug my program.

I try to fix it by installing the library using getlibs.

root@goo5257-laptop:~/Desktop# getlibs
libGL is installed from video drivers, please install or reinstall your video drivers

Ask me to reinstall the driver!!!Sweat ~~~