Off-screen rendering - help me get started

Hi,

Can someone point to a “Hello, World” type program for off-screen rendering in jogl? An OpenGL example would be a good start if it carries over into jogl easily.

Many thanks in advance!

Dola

Wow, no takers? I though this would be an easy one. Still, I would very much appreciate a response, because I desperately need this functionality.

Dola

I can post a simple render to textuer example if you want. There is a program in the demo section that uses render to texture though.

Yes, please do! If that’s the right way to do off-screen rendering, then sure. But the fact that you mentioned textures, doesn’t mean that I’m limited to powers of 2 as far as dimensions, does it?

Thank you very much!

Pavel

Hi,

I am also very interested in a simple example (of the “Hello World” class) that demonstrate offscreen rendering using pbuffers. The demo program is complicated and can run only on NVIDIA cards.

I have tried to write a little one myself, but with no success. Are pbuffers supported by ATI drivers ?

I use ATI RADEON cards (8500 and 9800).

Many thanks in advance,

Phil.

A pbuffer is basically a nonvisible framebuffer so you can do what ever you want with it, most likely you will want render to texture. If you are going to render to texture then you will be limited to power of 2 unless you have a nvidia card, then you can use render to texture rectangle. The ARB recently approved rectanglular texutres and they should be in ati drivers soon so everyone will be able to use them. RTT does not support mipmaps yet so beware of that. I will post the little demo tonight or tomorrow.

Thanks in advance for posting that demo!

So just out of curiosity, will I be constrained to the powers of 2 if I have a generic video card. I remember using Mesa in Linux and that was definitely not the case.

It is all up to the drivers. RIght now if you want to use a pbuffer for something other than rendering to a texture you can make it what ever size you want. If you are going to render to a texture then you have to use powers of two unless you have a nvidia card. Once your video card supports opengl 1.5 then you will be able to use nonpower of two textures. I have never used mesa but from what I know of it it is software based so they can pretty much do what ever they want.

Thanks for the clarification! So I’ll just wait for your demo.

Are pbuffers implmented for linux in the current version of JOGL?

The demo is here. It is a demo, not a tutorial but if you basically follow its layout you will probably be able to get your app running. I have no idea if the linux pbuffers are working yet. Let me know if there are any problems. You should be able to run it from the command line with:

java -jar RTTDemo.jar

I’m sorry, this is probably a very ignorant question, but where do I find it?

Even bigger blue link in the upper left corner.

Oh, I must be color blind, I didn’t realizer that “here” was a link.

Thanks for posting the demo. I’m afraid that I kind of miss the point. You seem (although I’m not sure that is the case) to draw to an offscreen buffer, but then display that buffer in the gl window. Am I correct? And if so, can you point out the four or five critical lines of code where the connection the offscreen buffer and the onscreen buffer is made. If I’m correct, that this is a very very cool feature.

Actually, I’m afraid that I may have been to vague when I said “off-screen rendering”. What I really want to do is to get an image out of the hole thing. I want to do the rendering on a web server which may not even have a video card and output an image. I apologize profusely if I caused you to answer a wrong question or if you answered the right question and I totally missed the answer.

I appreciate your time,

Dola

If you just want to draw an image in a pbuffer and save it somewhere then just do your normal drawing and at the end call glReadPixels to save the framebuffer to system memory. If you don’t have a videocard in the server you probably will have to use mesa and I don’t know much about mesa so I won’t be any help there. If you look at the source code for GLJPanel there is a display method, I don’t remember the name, at the end of the file that you will want to look at for guidance. It is basically doing exactly what you want to do, drawing with opengl and then saving to a bufferedimage.

Thanks for the reply.

But would that let me draw at a resolution different from that of the canvas?

(Is this question appropriate for a new thread? Maybe an example which renders offscreen and saves the result to an image - which can then be converted to java’s buffered image - would be very useful and appreciated!)

You would be able to draw at what ever resolution mesa or the videocard drivers allow. I will try to put something together for monday or tuesday.

That would be great.

Actually, I’m personally constrained to a Win32 system.

A question about what you said about resolution. I need to produce production quality (600 dpi) 8"x8" images.

I have a thinkpad with a Fire GL 9000 card. Will I be in luck?

The easiest way to find out would be to try and create a 4800x4800 pbuffer. I bet it is too large but give it a try.

I think your card will support a 4096x4096 pbuffer. Combine that with some AA and you should get a pretty damn nice 8x8 image.