View Full Version : render to pbuffer with GLSL
04-06-2005, 11:46 PM
i have a probem now. i cannot render any image to pbuffer with GLSL. i ain't sure yet about the correct procedure. i did it in this way
1. initialize pbuffer, attribute: 2d texture, share lists
2.set texture parameters, draw a rectangular and map the texture coordinates
3.compile and link the shader program
4. make pbuffer as current DC
5. use shader program.
6. back to normal DC
then i binded the pbuffer to texture unit 1, (texture unit 0 is alreay mapped). then only the texture unit 0 is shown. what i expect is that unit 1 covers unit0.
anyone has any ideas about this problem?
04-07-2005, 01:39 AM
You did not create the programs while the p-buffer rendering context was current and probably didn't use wglShareLists to share objects of the main and p-buffer rendering context.
If that's the case, the p-buffer context knows nothing about your GLSL programs then.
Checked the glGetError return value? It should have returned an invalid_value because the program id was unknown in glUseProgram.
04-07-2005, 02:24 AM
hi thx for ur kind reply!
i use wglShareLists so soon as the pbuffer is created. i think the shade programs are also shared, right? therefore, i don't need to complie and link the shader programs after switching the render context to pbuffer. is it correct? and when i call glUseProgramObjectARB there is no error msg. ( if i dont sharelists, there is.)what do you mean by "create the programs"? do you mean compile and link?
anyway i tried to compile and link the shader program while pbuffer is set to current. the same result:-(
could anyone kindly offer some sode samples for glsl+pbuffer?
04-07-2005, 02:58 AM
Ok, that sounds reasonable. I missed the "share lists" in step one before.
With create I meant generating the program object ID. This is per render context if not shared. Your error checking showed that sharing worked.
Does you p-buffer rendering work with fixed function pipeline rendering? That is, you're sure that the p-buffer itself is not containing the image?
The final multitexture drawing alone works, too?
Did you test with another texture in tex unit 1?
For more ideas, post the relevant code for both drawing actions.
04-07-2005, 05:12 AM
i found the problem. after pbuffer is set to current, i forgot to draw the rectangular, onto which the texture should be mapped. huhu, kinda stupid. focused on image processing too much, forgot the very foundamental thing. anyway thx a lot:-)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.