View Full Version : OpenGL pixel manipulation (offset color map issue)

03-02-2012, 05:48 AM
Hi everyone.
I have a strange trouble with OpenGL.
The scenery:
-nVidia GTX560 Ti from ASUS.
-Using nVidia drivers version 290.10.
-CPU core i5 3.2Ghz (model 650) on ASUS MB
I'm trying build an address map based on colors.
What I am doing:
+Off-screen rendering
+Load textures and associate pure white color silhouette texture for address mapping (non 100% opaque pixel=white (0xFFFFFFFF) and opacity set to 100%, either pixel=back (0x0) an full transparency)
+Using ARB buffers for pixel read/write
+Clear ALL buffers (stencil, color, depth, etc... even though only color buffer is relevant)
+Render user scene view (i.e normal render, with lights, fog, etc..)
+Render for composing a color address key:
+Select an auxiliary (GL_AUX*) buffer
+Take the first 24bits offset from a structure related with rendered texture
+Use these bits as RGB color components
+Set Alpha component always as 0xFF
+Set as active texture the white silhouette associated with the rendered texture
+Set as active color my composed color
+and so far until all structure address is stored into OpenGL auxiliary color buffers.
The problem:
Some times the colors are not correct and fails when I rebuild the addresses from GL_AUX's, giving me a seg. fault.

I already tried:

and use GL_BACK instead GL_AUX*

Any ideas?

Thanks for read.

Alfonse Reinheart
03-02-2012, 12:01 PM
I'm trying build an address map based on colors.

What does that mean? What is an "address map"? You need to tell is more about what you're trying to do.

03-02-2012, 05:36 PM
Hello Alfonse.
"address map" means take an offset, lets say 64 bits, and split into 8 bits packets. This packets are the color components for glColor(...). With Alpha=255, there are 3 colors (RGB+RGB+last 2 components)

Each time that I render a blank-transparent&white-opaque silhouette, the components of memory offset are drawn.

But I need the colors without "errors", plain color, bit per bit, in order to rebuild the original offset.

That's the problem: sometimes OpenGL does not accurate color representation and rebuilded address is wrong.

I expect be a little more clear.

Thanks for reply.