🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

render to memory

Started by
11 comments, last by wwinthan 15 years, 8 months ago
hi, what i'm trying to do is to read the dxf myself and render the 2ddrawing from dxf to opengl. the problem i bump into is the resolution which sticks to the size of my window(1024x1024). when i make the glrenderwindow to 2000x2000 the region outside (1024x1024) are all black. is there any way to avoid opengl restricting the render window size? or is there anyway to get the high resolution clear image? anyway to render directly to memory and create jpg image instead of using graphic card? any api would be appreciated help! thanks in advance winthan
Advertisement
you could render to a FBO as it is not limited to your screen size, so you could use pretty much any size, then when your done just use readPixels to get the data.
Converting it to jpg is another issue tha i am not going to talk about, but you would need an external library, though saving it as a TGA would be a lot easier.
FBO?? could you please give me more details? is it part of opengl? or different API? i have a C++ class to save into JPEG. i just want to render to any size i want to get good resolution.if you don't mind, could you please email ur email address to me so that i could ask more questions(wwinthan@purdue.edu)
thx
winthan
i'm not using NVIDIA graphic card so does it work? besides, does it come in VC++2005 i mean the api is c++ api? if you have written before, simple code will be very appreciated
thx
winthan
wwinthan: you can read about FBO here: http://www.gamedev.net/reference/articles/article2331.asp.
FBO =Frame Buffer Oblects, became core in openGL 3, but it has existed for some time now as an extension, it works for all nvidia and ATI graphics cards since at least from the last 3 years.
It basically allows you to render directly to a texture and is probably the single biggest improvement to openGL since the inclusion of glsl shader programs.

Try this tutorial on FBO.
i'll try that one. initially what i did is i render to Glwindow and save it to jpeg by using the API "mkOpenGLJPEGImage.h" available online. mkOpenGLJPEGImage.h basically captured the image rendered to GLwindow and save it as jpeg. But if i try the way you mentioned,since it's not rendered to GLwindow, how can it be captured? could you please point me to a resource where i can find more info on saving as jpeg by using ur rendering method.
thx
winthan
i downloaded and tried the tutorial. it compiles and runs fine but it displays "Sorry but you can't use FBO,try updating hardware or driver"
could you please tell me how to check my driver or hardware since this comptuer(office) doesn't belong to me? and the required driver or hardware to use FBO.
thx a lot
winthan
well, if you got that error then FBO is not available, you might try to upgrade your graphics card driver, but that won't help if your card is to old or cheap.

use GLview to test your current hardware configuration
this will test your entire computer, usually to check if you can run vista, but it will give an idea on what you have.

If that doesn't work then there is something called p-buffers, but don't use them unless you absolutely have to.
Do you actually need OpenGL at all for this? You mentioned that the DXF drawing is in 2D, so you don't need any of OpenGL's 3D capabilities, at which point you are basically using it as an API to draw lines.

However, you can find many packages (such as Cairo), which will let you render lines directly to the image buffer in memory, without involving OpenGL in any way.

Obviously, you will no longer be hardware accelerated, but since this sounds like an offline tool, that shouldn't be much of a problem.

*please don't double post.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement