View Full Version : render to file without window
For a project I want to be able to put together a scene and render it to a file (bmp). I can do that, but the problem is that I implemented this in an earlier project that creates a window to also show what is being rendered. For the new project I don't want that. I have to be able to call a function in the program and let a certain image be update based on new data. But I don't want the traditional rendering window to appear, or the screen to change resolution for a moment and such.
Is this possible? Can I setup something so I can render to the framebuffer (I use glReadPixels) without the window?
Thank you so much for any tips!
06-20-2004, 12:53 AM
You're going to need a window to get a DC, and you need a DC to get a RC.
On the bright side of things, there's this
Thank you already for your information.
I don't have a lot of exp with OpenGL yet but I wil try to figure out how your links can be of use.
I can render to a buffer with these functions and then read them with glReadPixels like I do now? And without a window? Or what is the advantage of using this instead of the usual way?
And can't I create a window, RC and DC without the user seeing it? Like for example totally hiding the window? Or won't that work?
WGL_ARB_pbuffer extends WGL to allow the application to create and render to non-visible rendering buffers. Pbuffers can be used almost exactly as a normal rendering window and provide complete support for rendering to off-screen surfaces.
So indeed it sounds like something useful. I'll searching for code examples now...
Would using a normal window that is hidden still be a valid option or is it not recommended?
06-20-2004, 01:31 AM
I don't have a lot of exp with OpenGL yet but I wil try to figure out how your links can be of use.I dearly wish there were a simple way to do this. Hopefully in the near future there will be.
I can render to a buffer with these functions and then read them with glReadPixels like I do now? And without a window? Or what is the advantage of using this instead of the usual way?You still need a window, but you can hide it, and render to the pbuffer. Then you can use glReadPixels with the pbuffer.
And can't I create a window, RC and DC without the user seeing it? Like for example totally hiding the window? Or won't that work?Yes, you can hide the window and draw to the pbuffer instead. They're really not that hard to work with. Try giving the spec a good read, and if you have trouble, post your questions here. Everyone here is happy to help.
Thanks for your help Q!
I got it to work now with the normal render window I always use. I just make it go through the DrawScene() function 1 time and then do a glReadPixels(). I also made sure that the exact current display settings are kept while creating the window and that there is no icon on the taskbar. Now the screen doesn't flicker when you run it and it's so fast that you hardly notice it. Just like I wanted it.
But anyway I learned the existance of pbuffers, which may still prove useful!
06-21-2004, 01:43 PM
Hi guys.I'm also interested in an application that renders using OpenGL ,without creating a window and get an HDC from it.I've found nothing for Win32 platforms,although for Linux it is possible.So there is no possibility to render a scene without creating a window in Win32 platforms?
As far as my limited experience reaches I also couldn't find anything like that. So I'm afraid that you always need a window. But I solved it by making sure the window is hidden when I create it, so the user doesn't see it. I don't know if that's a solution for you?
06-21-2004, 03:21 PM
So you create it and don't show it?And everything works just fine?Are you using pbuffers for offscreen rendering?I'm planning to program a CGI application wich needs some rendering and glReadPixels,so creation of the window is not perfect for me.I'll try it though...
I think in your case you'll need pbuffers then. I thought my window didn't show, but it does. Only the rendering of 1 frame is so short that you hardly notice anything. But that's not really a pretty solution it seems now. Not showing the window at all doesn't work. Maybe I'll look into pbuffers anyway too.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.