I have a few textured triangles which are mainly the copy of one but rotated and translated etc. I now need to render out every frame (using someone else’s frame saving library) but don’t know how to bind all of these to just one large texture. How do I create a large array of pixels to then load all of the images in order to put them all on one texture. Alternatively how do I render out every frame that can be seen on the screen with or without texture mapping in the displayfunc?
I would like to render out every frame. I’m using someones library to render frames out. I have used it before (please see below ) but only when I had an array of pixels and then I could set every pixel array (r,g,b) to the r,g,b of the outputImage (which is of type SGI, as named in the library). But now I have a different problem as I don’t have an array of pixels, I have a bunch of textures triangles and I could render them out one by one (I guess)but not every frame that can be seen with displayfunc. this is how I used it before:
SGI *outputImage = new SGI(OUTPUT_WIDTH, OUTPUT_HEIGHT, OUTPUT_NUM_CHANNELS, OUTPUT_BYTES_PER_CHANNEL);
and then
struct Pixel
{
unsigned char r,g,b;
};
Pixel *pixel_array = NULL;
for (int y = 0; y < array_height; y++)
{
for (int x = 0; x < array_width; x++)
{
outputImage->set(x, y, 0, pixel_array[y * array_height + x].r);
outputImage->set(x, y, 1, pixel_array[y * array_height + x].g);
outputImage->set(x, y, 2, pixel_array[y * array_height + x].b);
}
}
sorry still have troubles to understand you. you would like to render out every frame. ok. you use third party lib to do that so after the rendering the final scene image is in the backbuffer right? now you need to get that data and save it as an image?
if yes, then you should use glReadPixels() to read out the pixels from the backbuffer after you rendered successfully. then you will have a memory where the scene image is located and can save it to a file. you need to know the lib well to capture the screen in correct place.
and then have to do this I guess like before:
or (int y = 0; y < array_height; y++)
{
for (int x = 0; x < array_width; x++)
{
outputImage->set(x, y, 0, pixel_array[y * array_height + x].r);
outputImage->set(x, y, 1, pixel_array[y * array_height + x].g);
outputImage->set(x, y, 2, pixel_array[y * array_height + x].b);
}
}