I’m working on ogre project by using C++. Normally I use viewport:setbackground() but this cause whole window same colour. This time I want to load different R, G, B values for each viewport’s pixel. My window is 600*600 and I have to load RGB values for each pixel. How can I solve this question ?
I’m working on ogre project by using C++. Normally I use viewport:setbackground() but this
Share
If you want to set a background you can do this:
Create a rectangle that fill all viewport
Create a material and texture
Now you can copy your RGB data directly to texture framebuffer:
EDIT 2011-11-10
data must be a valid pointer to a framebuffer of raw RGB. You can initialize it:
And than write yellow directly to pixel at position x,y.
Or write directly to texture->getBuffer() (Ogre API: HardwarePixelBuffer)
… write directly to pixelbuffer …
This example can be generalized for other width, length, format etc…
You can use more optimized code to find pixel inside the buffer, this is just an example.