Logo by Jimpan1973 - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. January 13, 2026, 07:15:06 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: OpenGL, how to output an image larger than your display  (Read 7431 times)
0 Members and 1 Guest are viewing this topic.
Duncan C
Fractal Fanatic
****
Posts: 348



WWW
« on: March 06, 2008, 05:01:51 PM »

I'm a neophyte when it comes to OpenGL. I'm getting reasonable results in rendering my 3D fractals to the screen.

I now want to add the ability to save 3D renderings to a file, or send them to a printer. For those output targets, the user may well want to create images larger than the current display size.

A buddy of mine who knows more about OpenGL than I do tells me that you have to create a viewport within the limits of the current display, move it from place to place in your image space, capture the pixels from that viewport, then assemble them into a bitmap of the whole image.

This seems like an awful hack. Most display engines I've used recently include support for offscreen image buffers, and I know that OpenGL supports double-buffering for fast screen refresh. Is there a way for me to render my 3D image to an offscreen buffer bigger than the display?


Duncan
Logged

Regards,

Duncan C
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: March 06, 2008, 05:17:57 PM »

right now i can just say, capturing the pixels from an opengl viewport is no problem at all, in fact it is offscreen rendering, if you do not post a refreshdisplay to opengl, \
it should be easily possible to set the current rendering frame to something bigger than the viewport temporarly for rendering, but keep in mind that zou can not use screen resolutions ofer 2048x2048, or is it 4096x4096 i think this is what your friend meant with assembling the parts, this has to be done anyway for images exceeding 4096x4096 or so pixels ....
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Duncan C
Fractal Fanatic
****
Posts: 348



WWW
« Reply #2 on: April 29, 2008, 04:31:14 AM »

right now i can just say, capturing the pixels from an opengl viewport is no problem at all, in fact it is offscreen rendering, if you do not post a refreshdisplay to opengl, \
it should be easily possible to set the current rendering frame to something bigger than the viewport temporarly for rendering, but keep in mind that zou can not use screen resolutions ofer 2048x2048, or is it 4096x4096 i think this is what your friend meant with assembling the parts, this has to be done anyway for images exceeding 4096x4096 or so pixels ....

Trifox,

I've learned quite a bit about this since posting my question.

You can't draw to an area larger than your viewport. You run into pixel ownership problems. It might work on some implementations, but the results are undefined.

If your driver supports it, you can use framebuffer objects (FBOs) attached to a renderbuffer object, and draw offscreen into that. However, that doesn't buy you very large output sizes. On my platform, the driver claims it can handle a renderbuffer of up to 4096 x 4096, but the driver crashes if you try to create a renderbuffer that big. Plus, FBOs are not supported on all implementations.

Instead, I create a pixel map in main memory, then use the current viewport. I create a series of tiles that are as big as the current viewport or smaller. I adjust the view frustum so that the viewport shows a portion of the whole image I want to render, render that portion to the back buffer, use glReadPixels to copy the pixels into my pixel map, then move on to the next tile. It was a fair amount of work to do, but it works perfectly, and can output at an arbitrary output size.

I used a GNU licensed code library called "tr" as the model for my code. I did not want to put my code into the public domain, so I just studied how the "tr" library worked and then wrote my own version.


Duncan C
Logged

Regards,

Duncan C
keldor314
Guest
« Reply #3 on: June 10, 2008, 11:07:05 PM »

The likely reason the driver crashed was that a 4096x4096 is pretty darn big!  At 32-bit color, it would translate to about 67 MB.  If your card didn't happen to have that much memory...
Logged
Duncan C
Fractal Fanatic
****
Posts: 348



WWW
« Reply #4 on: June 11, 2008, 03:30:33 AM »

The likely reason the driver crashed was that a 4096x4096 is pretty darn big!  At 32-bit color, it would translate to about 67 MB.  If your card didn't happen to have that much memory...

That's the odd thing. I get the same result, at the same size, regardless of the amount of memory on the card. Plus, there's a specific error code that's supposed to be returned if the driver runs out of memory. It's supposed to report an error if you try to do something that it can't do.

On an older machine with limited video memory, it crashes at the same size. Below that threshold, it gets REALLY, REALLY slow, but it still works. The slowdown is to be expected, since the card starts thrashing back and forth from video memory to main memory.


Duncan C
Logged

Regards,

Duncan C
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #5 on: October 06, 2008, 05:32:33 PM »

I used a GNU licensed code library called "tr" as the model for my code. I did not want to put my code into the public domain, so I just studied how the "tr" library worked and then wrote my own version.
Duncan C

Hi Duncan, am just starting to use OpenGL - am programming for iTouch/iPhone - could you point me at the link to the "tr" library please ? Alternatively just send me a zip of yours smiley I need to quickly display areas from a bitmap of up to 2048*2048 and doing it through Quartz etc. looks a like it will be a little slow.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Duncan C
Fractal Fanatic
****
Posts: 348



WWW
« Reply #6 on: October 06, 2008, 06:01:27 PM »

I used a GNU licensed code library called "tr" as the model for my code. I did not want to put my code into the public domain, so I just studied how the "tr" library worked and then wrote my own version.
Duncan C

Hi Duncan, am just starting to use OpenGL - am programming for iTouch/iPhone - could you point me at the link to the "tr" library please ? Alternatively just send me a zip of yours smiley I need to quickly display areas from a bitmap of up to 2048*2048 and doing it through Quartz etc. looks a like it will be a little slow.


David,

Here's a link to the tile rendering library:

TR - OpenGL Tiled rendering




« Last Edit: October 06, 2008, 06:03:08 PM by Duncan C » Logged

Regards,

Duncan C
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #7 on: October 06, 2008, 06:04:48 PM »

Thanks !
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Mndelbulber 1.02 / 1.03: Renders via commandline, with gui: output is scrambled Releases mcc 4 2255 Last post June 09, 2011, 05:01:15 AM
by mcc
rendering larger question Mandelbulber myke1 2 2754 Last post March 25, 2012, 10:01:46 PM
by myke1
Version 1.8 Display problem with custom DPI setting bug reporting 0Encrypted0 1 2356 Last post July 21, 2012, 08:33:11 PM
by Jesse
.obj output from Fragmentarium Help & Support 5yF0Rc3 7 1619 Last post April 24, 2013, 10:41:35 PM
by Sockratease
Creating 3D obj Fractal output using Incendia Incendia tomot 0 3741 Last post April 29, 2014, 07:47:59 PM
by tomot

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.199 seconds with 24 queries. (Pretty URLs adds 0.014s, 2q)