OpenGL as an acceleration to 2d

Hi,

I’m wondering if anyone here has done any 2d stuff with OpenGL. Then I’m taking about maybe using gl_quads with textures and use hardware accel to do alpha blending etc?

Would such a way to do alpha blending be significantly faster or?

Is there some demo or anything I can see this at work?

:slight_smile:

Regards,
Gudmundur

Hi!

I’m wondering if anyone here has done any 2d stuff with OpenGL. Then I’m
taking about maybe using gl_quads with textures and use hardware accel
to do alpha blending etc?

I’ve tried this, but I haven’t put any code into the net. If you have a
3D accelerator, this works really great!

There’s already a complete game out, which is using OpenGL for 2D
graphics. It’s called Chromium. You can find a link on the SDL pages.

Bye,

Karl.

Hi,

I’m wondering if anyone here has done any 2d stuff with OpenGL. Then
I’m taking about maybe using gl_quads with textures and use hardware
accel to do alpha blending etc?

Yes, I did some proof-of-concept hacks for Project Spitfire some time ago.

Would such a way to do alpha blending be significantly faster or?

Yes, way faster on just about any 3D card - and that goes for all
blitting; not just alpha blending.

Is there some demo or anything I can see this at work?

Well, I guess I could try to dig out a “working” version of that stuff…

If you’re not in that much of a hurry, you could wait for OpenGL support
in Kobo Deluxe. The graphics engine I used was originally written for
Projec Spitfire, and is designed with portability and reusability in mind.

The “control system” doesn’t contain any rendering code, and works with
sub-pixel precision and transparently separated control system and video
frame rates with linear interpolation of coordinates. In other words,
it’s just a matter of getting “sprite” (bank/frame oriented graphics
manager with image processing plugin support) to upload the frames to the
video card, and throwing some OpenGL code into the render() callbacks.

However, right now, I’m fixing the last details for the 0.3 release of
Kobo Deluxe, and next, I was planning to work on sound and music. I might
change my mind, though… :slight_smile:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Sunday 23 September 2001 23:36, Gu?mundur ?lafsson wrote:

The only problem with Chromium is that it’s frame rate limited to (IIRC)
50 Hz, so it can’t achieve perfectly smooth animation despite the OpenGL
rendering.

They should steal my Magic Frame Rate converter from Kobo Deluxe! :wink:
(Kobo still runs at 30 Hz internally - the smooth animation is a result
of the new graphics engine.)

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 24 September 2001 14:59, Karl Bartel wrote:

Hi!

I’m wondering if anyone here has done any 2d stuff with OpenGL. Then
I’m taking about maybe using gl_quads with textures and use hardware
accel to do alpha blending etc?

I’ve tried this, but I haven’t put any code into the net. If you have a
3D accelerator, this works really great!

There’s already a complete game out, which is using OpenGL for 2D
graphics. It’s called Chromium. You can find a link on the SDL pages.

They should steal my Magic Frame Rate converter from Kobo Deluxe!
:wink: (Kobo still runs at 30 Hz internally - the smooth animation is
a result of the new graphics engine.)

Is that the same one as the one in PLG (book =) ?

Basically, have everything multiplied by a scaling factor.–
Trick


Linux User #229006 * http://counter.li.org

No. (And I haven’t read that book, actually. :slight_smile:

My engine separates “logical” control system coordinats from graphics
coordinates. When the game is running, the engine runs a callback at the
control system frame rate (configurable; in Kobo Deluxe, it’s 30 Hz), and
for each call, it “shifts” the coordinates of all object coordinates, so
that it always has the last two “world states” present.

For every video frame rendered, the engine calculates all object
coordinates using linear interpolation between the last two “world
states”. The resulting coordinates are called “graphic coordinates”, and
are what the rendering callbacks are expected to use.

All coordinates are fixed point values (normally 24:8), including the
graphic coordinates, so subpixel accurate rendering is just a matter of
using the decimal bits of graphic coordinates. (Which is very easy with
OpenGL. :slight_smile:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Tuesday 25 September 2001 01:57, Trick wrote:

They should steal my Magic Frame Rate converter from Kobo Deluxe!
:wink: (Kobo still runs at 30 Hz internally - the smooth animation is
a result of the new graphics engine.)

Is that the same one as the one in PLG (book =) ?

Basically, have everything multiplied by a scaling factor.

– 8< –

Oh. Well, great book (fantastic actually), but you probably know
everything in it already, it seems =) (at least the SDL stuff)

Anyway, gotta take a look at that method… Sounds interesting!On Tuesday 25. September 2001 02:31 (CEST), you wrote:

On Tuesday 25 September 2001 01:57, Trick wrote:

They should steal my Magic Frame Rate converter from Kobo
Deluxe! :wink: (Kobo still runs at 30 Hz internally - the smooth
animation is a result of the new graphics engine.)

Is that the same one as the one in PLG (book =) ?

Basically, have everything multiplied by a scaling factor.

No. (And I haven’t read that book, actually. :slight_smile:

Trick


Linux User #229006 * http://counter.li.org

They should steal my Magic Frame Rate converter from Kobo
Deluxe! :wink: (Kobo still runs at 30 Hz internally - the smooth
animation is a result of the new graphics engine.)

Is that the same one as the one in PLG (book =) ?

Basically, have everything multiplied by a scaling factor.

No. (And I haven’t read that book, actually. :slight_smile:

– 8< –

Oh. Well, great book (fantastic actually), but you probably know
everything in it already, it seems =) (at least the SDL stuff)

Yeah, of course. :wink:

Anyway, gotta take a look at that method… Sounds interesting!

Very handy, at least - no need for the messy calculations needed for the
"multiply with delta time" method. More importantly, it totally separates
the control system from the video frame rate, so if your game works
(collision detection…) on your machine, it’ll work anywhere.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Tuesday 25 September 2001 03:05, Trick wrote:

On Tuesday 25. September 2001 02:31 (CEST), you wrote:

On Tuesday 25 September 2001 01:57, Trick wrote:

Yes this has been done before, it’s present in the project
renai.sourceforge.com (SDL 2D and OpenGL is wrapped as so you can switch,
however the SDL 2D api always runs poorly whereas the OpenGL mode runs
fast.)

There is also a similar concept in when OPENGLBLIT mode is used in SDL.

In regards to how fast alphablitting is, SDL 32bpp software alpha = 10 to
15fps, OpenGL on Rage 128 = 40-90fps. Id’ imagine on a
Geforce/Geforce2/Radeon it would also be faster since the transform’s would
be done in hardware as well.

The basic idea is that you can either:
Create a display list with the entire “layer” (Solve 256x256 texture limit
on Voodoo2) which autoslices oversized images into whatever size the video
card supports. Also (in software) puts image data on 2^x sized textures.
Then transform from the default position to the desired position.
OR
Draw the Quads, and utilize multitexturing (However the multitexturing
effect seems to slow things down)

I belive the problem with multitexturing stems from the fact that the
textures have to be the same size, so it’s rather useless except in a 2D
tile array.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of
Gu?mundur ?lafsson
Sent: September 23, 2001 2:37 PM
To: sdl at libsdl.org
Subject: [SDL] OpenGL as an acceleration to 2d.

Hi,

I’m wondering if anyone here has done any 2d stuff with OpenGL. Then I’m
taking about maybe using gl_quads with textures and use hardware accel to do
alpha blending etc?

Would such a way to do alpha blending be significantly faster or?

Is there some demo or anything I can see this at work?

:slight_smile:

Regards,
Gudmundur