PDA

View Full Version : Resize window but keep rendered pixels contant



Taicoon
04-23-2010, 01:24 AM
In few words...

I need to render a scene of 1920x1080 pixels for some background purposes. At the same time i need a smaller view of this scene with a size of 480x270.

If I create a context using my preview window of 480x270 then I only generate that number of rendered pixels.

I need to have a context rendering 1920x1080 pixels and I need a smaller resized preview of this with a size of 480x270 pixels.

In directx this came for free when creating a device with a large window and then simply shrinking it down but it seems that I need something extra in opengl.

How do I create one context and two views of its pixels?

EDIT:
The above was perhaps a little vague.
As I understand it, I need a render context for each of my "windows". If I wanted two different views of the same scene, I could make a context current, render and do the same for the other context, but I do not want to render again. Instead I want to show the same rendered pixels in two different places.
I assume I could render the large version, copy it to a PBO using glreadpixels, change to small context and use glWritePixels, but... where will the resizing take place then? The pixel count is not the same.

Pierre Boudier
04-23-2010, 03:50 AM
did you look at this functionality:
http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt
?

Taicoon
04-23-2010, 10:25 AM
I did not. Am am converting from DX to opengl and have a hard time always seeing when there is a function to directly do something and when you need to code arround it.

It looks like what I need. It seems to have an implicit rescaling since the coordinates for the read and write region are both included.

I am unsure about the specifics though...
I need to create two contexts since I have two different display sizes, i think. If not from the window size, I fail to see how I specify the framebuffer size..?
I then create a framebufferext in each context.
Render to one and blit to the other.
Would this do it?