If you need to store some regular values (like R/G/B intensities) for your pixels, it's quite easy. Just use a colour framebuffer.
vec3 ThisPixel = (value0, value1, value2); // Easy
Now, I want to store an interval set with values for my pixels. How can I do something like that?
The process of storing an interval set in memory is tricky to begin with. Because there could be a various number of intervals in the set.
// Here's how you can do it in RAM
struct IntervalWithValue
{
float IntervalStart;
float IntervalEnd;
vec3 IntervalValue;
}
std::vector<IntervalWithValue> IntervalSet;
IntervalSet.push_back(IntervalWithValue(0.1, 0.3, vec3(255, 0, 0)));
IntervalSet.push_back(IntervalWithValue(0.5, 1.0, vec3(0, 255, 0)));
auto ThisPixel = IntervalSet;
I know it's probably really confusing what I want...
Let me explain it this way. Right now, it's easy to store and manipulate colour values in a colour framebuffer for each pixel.
But what if I want to store and later manipulate interval set with value (as defined in code above) for my pixel values? How can I store that in some sort of framebuffer on the GPU?
One of my thoughts was... if I know my interval sets will contain no more than 4 intervals, then perhaps I could use 4 framebuffers (or 4 textures, whatever). And define some sort of notation, like:
framebuffer(Number).r = IntervalSet[Number].IntervalStart;
framebuffer(Number).g = IntervalSet[Number].IntervalEnd;
framebuffer(Number).b = IntervalSet[Number].IntervalValue;
Any other ideas? Thank you!