PDA

View Full Version : PBuffer RTT & shaders



Aeluned
10-21-2004, 10:42 AM
hey,

I'm rendering a scene to a pbuffer, binding the pbuffer to a texture object with a texture target of GL_TEXTURE_RECTANGLE_ARB. no problems there, however I'm now trying to sample the texture in a fragment shader (written in glsl). My guess is that it's failing altogether to perform the texture sample in the fragment shader. I'm guessing this because after i bind the pbuffer-texture I enable the shader and draw a quad over the entire scene textured with the pbuffer-texture. My goal is to perform a filtering on the texture in the fragment shader, however...nothing appears on the quad and all fragments are transparent. Is there anything i should be aware of when trying to do this?

valoh
10-21-2004, 11:22 AM
Have you already used pbuffers without glsl or other texture formats? pbuffers are a little bit tricky.

It is not quite clear to me from you description, are you rendering to the same pbuffer which you bind to the texture? According to the pbuffer spec rendering to a pbuffer and using it as a texture is mutual exclusive.

All return error codes tested, pbuffer lost tested, shader validation?

Haven't tested with GL_TEXTURE_RECTANGLE_ARB but hadn't problems with GL_TEXTURE_2D and glsl (other than some strange driver crashes (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=012617) :mad: )

Perhaps another thing to check: haven't used GL_TEXTURE_RECTANGLE_ARB but afaik it hasn't normalized texture coordinates but [0..width][0..height] mapping.

Aeluned
10-21-2004, 11:32 AM
yep,
i have used pbuffers before extensively, and with multiple texture targets, shaders, blah blah.

I'm aware of everything you wrote....hmmm....

everything seems to check out I just don't get what's going on here.

One interesting thing is that I've tried to sample a non-power-of-two texture in a shader and unless I normalize the texture coordinates the sample repeats. glsl doesn't like texture rectangles?

either way, that's a different problem.
glsl seems to not be seeing textures using bound pbuffers.

:(

valoh
10-21-2004, 11:38 AM
Have you tried with GL_TEXTURE_2D? Perhaps it some issue regarding GL_TEXTURE_RECTANGLE_ARB format?

Aeluned
10-21-2004, 11:57 AM
GL_TEXTURE_2D works just fine...it always has.
GL_TEXTURE_RECTANGLES work as well, but I apparently have to normalize the texture coordiantes - no biggie.

what doesn't work is sampling a texture in a glsl shader that defines its data with a bound pbuffer.

that's the heart of my problem.

valoh
10-21-2004, 12:18 PM
Originally posted by Aeluned:
GL_TEXTURE_2D works just fine...it always has.
GL_TEXTURE_RECTANGLES work as well, but I apparently have to normalize the texture coordiantes - no biggie.

what doesn't work is sampling a texture in a glsl shader that defines its data with a bound pbuffer.

that's the heart of my problem.I understand your problem, at least I think so. What I asked was, if a GL_TEXTURE_2D format bound pbuffer also don't work. To see if that is a common pbuffer/glsl binding problem you have or if it is somehow related to the GL_TEXTURE_RECTANGLES/pbuffer/glsl combination.

Have you set the glsl sampler uniform to the texture unit you bound your texture object which is bound to the pbuffer?

Do you use a floating point pixel format with filtering other than GL_NEAREST? (But I guess that would result in a sw fallback...)

else I'm also out of ideas...

Aeluned
10-21-2004, 12:23 PM
good call, didn't try GL_TEXTURE_2D as the pbuffer target...I'll try that.

texture unit set.
filter GL_LINEAR.

but I'm off to the airport, so I'll let you know tomorrow, thanks for the help so far.

this is all to achieve a glow effect by the way.