PDA

View Full Version : DC, RC, and virtual resolution



PhilY
05-21-2002, 04:13 AM
hi, I've posted something similar to this problem before; now I'm considering other alternatives that I think might work.

The previous post is here: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/006339.html

Basically, I need to do some off-screen rendering using a certain extension that is not supported in software. Unfortunately, my card (3D Labs Oxygen GVX1) doesn't support auxiliary buffers or pbuffers.

Now I'm thinking... Can you create more than one device contexts (and the RC along with them) that will support hardware mode? If such is possible, this is what I'd wanna do with them:

1. Switch over to the newly created RC, but still displaying the original RC
2. Render stuff to the newly created RC, but still displaying the original RC
3. Read pixels from the newly created RC and store them in the memory
4. Switch over to the original RC and render stuff - whatever it was doing before.

Now, is that possible? How would I go about that?

If that's not possible, as I suspect it to be... I'm thinking of another way: expanding the screen resolution temporarily and render stuff "offscreen" I've tried to do that by just creating a viewport bigger than the current resolution; glreadpixels gave me just black screen when reading the not-displayed part.

So I'm thinking if I could make the resolution larger temporarily (say for 1024X768, something like 1800X768) and render stuff to the part that is not displayed on the monitor but still technically displayed since it's part of the screen resolution, I should be able to do read pixels. Screen clipping?

Does that sound too far-fetched? Is there any sources on the web that deal with stuff like this besides opengl.org? http://www.opengl.org/discussion_boards/ubb/smile.gif

I'd appreciate any input.

knackered
05-21-2002, 04:23 AM
Now, is that possible? How would I go about that?


Yes, that's possible.
But, is there a reason why you can't render into your original context and do the copy before you render the scene?

PhilY
05-21-2002, 04:41 AM
The reason is because no matter which frame buffer (front or back) I render to, the image on the buffer is already combined with any other windows that might be on top of it.

I'd like to have the option of having other windows on the top of the gl window while the offscreen rendering is going on.

So it is possible; so do I just create two DCs and go from there?

Thanks for the reply.

knackered
05-21-2002, 06:13 AM
I haven't tried doing a read pixels from a render context whos window is invisible (you'll have to create an invisible window and get its device context to bind the rc to)...maybe it will work.

kehziah
05-21-2002, 01:23 PM
OpenGL spec 1.3, section 4.3 Drawing, reading and copying pixels :
ReadPixels obtains values from the selected buffer from each pixel with lower left hand corner at (x+i; y+j) for 0 <= i < width and 0 <= j < height; this pixel is said to be the ith pixel in the jth row. If any of these pixels lies outside of the window allocated to the current GL context, the values obtained for those pixels are undefined. Results are also undefined for individual pixels that are not owned by the current context.So no, you can't render to an invisible window and get something back from it (same applies to the viewport being larger than the screen resolution).

This thread might help you
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/004366.html


[This message has been edited by kehziah (edited 05-21-2002).]

PhilY
05-22-2002, 03:48 AM
Thanks, guys, for your help. The previous discussion definately clarified the issue, kehziah.