Offscreen Blitting and OpenGL

Started by Binary Boy, October 29, 2010, 13:18:11

Previous topic - Next topic

Binary Boy

Hi All,

This is my first post, so I'll introduce myself, I'm Paul from Wigan, North West UK, 33 years old.  I have some intermediate experience with DirectX and OpenGL in C/C++. Recently I was working on a 2D top down shooter with some 3D effects, but I ran into some problems in OpenGL using offscreen buffers.

At the moment, I'm studying a Java course at the Open University, so I have decided to port my game code to Java and found this library, which looks really good.

So, I'm looking forward to working with this new (to me) language and library and frequenting these forums.

I have some questions about this API though... The game I was working on required mixing 3D rendering with 2D rendering into offscreen buffers, and I was dissapointed when I found that it was really difficult to implement in OpenGL. So, before I invest too much time into this library, I wondered if anybody here can answer my questions...

1) Is it possible to mix OpenGL with offscreen buffers?

2) Is it possible to request offscreen buffers in system memory or hardware memory explicitly?

3) Can these things be done in an applet, or does it have to be done in a window?

I hope I've not rambled on too much.

Thanks for listening.

Paul

spasi

Hey Paul,

The answer to all 3 questions is yes. You need to take a look at pbuffers (old way) or framebuffer objects (the new, preferred way). This should get you started (also available in core GL from version 3.0 and up), it isn't the easiest thing you can do in OpenGL, but it's not so hard either.

kappa

Quote from: Binary Boy on October 29, 2010, 13:18:11
3) Can these things be done in an applet, or does it have to be done in a window?

You can do anything with LWJGL as an applet that you can do with the native window because LWJGL Applets are essentially just a native window stuck on top of an AWT Canvas.

See the LWJGL Wiki for full tutorials on how to to create basic LWJGL applets and how to use the LWJGL AppletLoader (utility to help deploy stuff like the native parts).

Also since your new I do also recommend you try the lwjgl irc channel at #lwjgl irc.freenode.net it is a very useful place to get information and help to get started.


jediTofu

Is there a significant enough speed boost from writing to pbuffers and FBOs and then to the display buffer (back buffer specifically) to make sure to use it in games (not saying this is what he specifically wants this for, just asking)?  Because then I guess I could allow for FBOs if capable; then if not, allow for Pbuffers if capable.

Java and OpenGL is definitely the way to go; there are so many users now that don't just use Windows, especially in the freeware gaming community.  And if you write an engine using LWJGL that is heavily object oriented, it should be easier to port to the Android and the iPad (not easy, just easier).  Not to mention, Java is just a safer language in general for the users compared to C++, along with having standard support for unicode (file names, etc.), garbage collection, serialization, etc.  You'd need to add the boost C++ library for that, and I haven't really found any GUI library on C++ (Qt, etc.) that is as easy as Swing.  Having said that, if you're only wanting to write games for Windows, C# (basically a copy of Java) and DirectX would be easier for you since you have experience with that.  I wouldn't suggest it though; of course, I'm biased  ;)
cool story, bro

Binary Boy

Hey, great, thanks for all the replies!! I'll go and have a look at those tutorials and irc.

Hopefully, I'll be posting a completed game here sometime in the future!