PDA

View Full Version : How to use texture in 128-bit-color pbuffer?



Gaya-w
12-23-2003, 10:27 PM
Hi.
I mat a problom when renderring a rectangle with texture in pbuffer. I just draw a single frame and read it back by glReadPixels. When the pbuffer use 32-bit color, everything wents ok. But when a 128-bit-color pbuffer used, all of the pixels were set to (0, 0, 0, 0). How to use texture in this case? Thanks.

Zengar
12-24-2003, 01:14 AM
Could you provide a bit more information or code? It sounds just too general...

Gaya-w
12-28-2003, 05:36 PM
Sorry for late. I used a fragment program:
!!ARBfp1.0
PARAM TZERO = { 0.0, 0.0, 0.0, 0.0 };
PARAM TONE = { 0.9, 0.9, 0.9, 0.9000001 };
ATTRIB tcoord0 = fragment.texcoord[0];
ATTRIB tcoord1 = fragment.texcoord[1];

TEMP a, b;
TEMP t;
TEX a, tcoord0, texture[0], 2D;
TEX b, tcoord1, texture[1], 2D;
MOV result.color, b;
END
But result.color was set to be (0, 0, 0, 0) no matter what texture[1] was.

jwatte
12-28-2003, 06:14 PM
There could be a large number of things wrong.

Here are some that I can think of right away:

+ Creating the context for the pbuffer could fail.
+ Making the device/context current could fail (not: it's not certain that you can use the same context for 32-bit and 128-bit targets)
+ You may have forgotten to share lists into the context.
+ Blending might be turned on -- that's not supported for float targets.

I would suggest you sprinkle your code liberally with "assert(!glGetError())" at the beginning and end of every function in your code, and at opportune intermediary points if functions are long.

Zengar
12-29-2003, 12:44 AM
I had the same problem today. I wanted to render a 32 - bit RGBA texture on GFFX5600. It was the first time I used pbuffers and ARB_render_texture. Took me about a 30 minutes to debug 8 lines of code! Finnaly I discovered that my mesh didn't fit into the clipping volume. How stupid...

Gaya-w
12-29-2003, 05:48 AM
Context was created and made current successfully. No Lists. No blending. Mesh in volume. Free window dc failed, but getLastError() returned "Operation succeed".

Zengar
12-29-2003, 07:35 AM
Do you create the fragment program inside your pbuffer context? Sorry for stupid question...

Gaya-w
12-29-2003, 08:03 PM
I did create the fragment program for pbuffer. When the pbuffer use 32-bit color, everything wents ok. So I think there may be some problom when pixel format of pbuffer is different from that of window.