Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Making 2.5D / 3D elements with Allegro 5?

This thread is locked; no one can reply to it. rss feed Print
Making 2.5D / 3D elements with Allegro 5?
jmasterx
Member #11,410
October 2009

I want to make a 2D table card game with Allegro, but I also want the cards to flip onto the table which would require: a depth buffer, creating OpenGL textures from pngs, and creating VBOs for the card planes. I would be basically reinventing many elements of Allegro. I was wondering if Allegro might have a simple and convenient way of doing something like this? Games Like World Of Goo also implement something similar with a goo mesh when you fill the bottle with goo. Is there a simple way to incorporate these things? Would the primitives addon be what I'm looking for? Can it texture a 2 sided plane eg: a card? Can Allegro do transformations for depth?

Thanks

Archon
Member #4,195
January 2004
avatar

jmasterx said:

would require: a depth buffer, creating OpenGL textures from pngs, and creating VBOs for the card planes. I would be basically reinventing many elements of Allegro. I was wondering if Allegro might have a simple and convenient way of doing something like this?

Allegro can create the OpenGL context and create the main framebuffer, load OpenGL extensions (if required) for VBO, and convert BITMAP* to OpenGL texture (GLuint).

The depth buffer and VBOs are done via OpenGL directly. They're simple to learn.

J-Gamer
Member #12,491
January 2011
avatar

Is this possible with A4? If so, I have put too much work in my first game... I ended up making an animation for each and putting all frames of those animations in one big bitmap... 20MB+ :-X

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Nazerith
Member #12,551
February 2011

If you are just starting on this, I would suggest beginning with A5. Only stick with A4 if its an existing project.

Archon
Member #4,195
January 2004
avatar

J-Gamer said:

Is this possible with A4? If so, I have put too much work in my first game... I ended up making an animation for each and putting all frames of those animations in one big bitmap... 20MB+

It is possible with Allegro 4 via the AllegroGL addon (all a part of the 4.4 download).

If you are using OpenGL, you can easily convert your Allegro 4 project to Allegro 5 if you wish.

J-Gamer
Member #12,491
January 2011
avatar

I am not, that's why I had to make a 20MB+ bitmap... but that's almost half a year ago. I quit that project, and it's finished(look at my site for Projects->Memory).

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Dario ff
Member #10,065
August 2008
avatar

I've been able to mix 3D and 2D with A5 easily. I even made a mockup to test it:
{"name":"603432","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e974ba1f88995769114b52b3034cdb5a.png","w":822,"h":526,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/9\/e974ba1f88995769114b52b3034cdb5a"}603432

jmasterx said:

a depth buffer

Since you claim that your game is simply going to be a 2D card game, you can just use the Depth buffer that Allegro creates for you.

Quote:

creating OpenGL textures from pngs

No need to, you can use al_get_opengl_texture to retrieve the OpenGL texture id, ready to use with any OpenGL code you want.

Quote:

VBOs

Since we're talking about just card planes, just rendering two quads(one for the back and one for the front) should do the trick right? It's not about reinventing so much in that case. Be sure to set up the proper projection before, and then just switch back to the Orthographic one.

Quote:

Games Like World Of Goo also implement something similar with a goo mesh when you fill the bottle with goo.

If you're looking for that effect, I think you should just refer to al_draw_prim. Be aware that you might have some artifacts such as the one described in this thread, which is not Allegro related but just the way a quad is rendered on 2D projection.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Go to: