render to texture (pBuffer) with fragment shader ?

Started by
3 comments, last by GameDev.net 17 years, 1 month ago
Hi, I'm trying to render to a pBuffer using a fragment shader and I end up having a crash ... I do the following : create pBuffer some openGL calls copy pBuffer to ram using glReadPixels that works fine without the fragment shader, but if i add glUseFragmentProgram(_shader_Fragment_Program); before my openGL calls, the glReadPixel crashes ... I reduced my fragment shader to a simple gl_FragColor = vec4(0,1,0,1); for test purposes ... I also use rectangle texture via the NV/ARB extension. anyone has any idea ? Thanks a lot !
Advertisement
does the fragment shader exist in the pbuffer's context?
If you are going to use a lot of render to texture, shaders and various buffer objects, then i suggest that you drop the p-buffer and use FBO instead.
It's much more flexible and you don't have to worry about textures and programs being attached to the right context.

thanks for the answers,
it was my problem didn't share my program...
works fine now with wglShareLists in it

is the FBO supported by NV and ATI ?
and what speed can i expect when copying from
an FBO to cpu memory ?

Thanks a lot !
glReadPixels is like the slowest call there is so FBOs should be faster period.

This topic is closed to new replies.

Advertisement