Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Creating AllegD3D

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Creating AllegD3D
Daniel Schlyder
Member #257
April 2000
avatar

If you're working on a 2D game and just use 3D hardware for accelerated rotations, blending and scaling, you don't need more than the bare minimum, though, do you?

Paul whoknows
Member #5,081
September 2004
avatar

Quote:

I've been thinking about making allegD3D.

That would be great!!!
Just think about it, writing games supporting DirectX, OpenGl, and D3D just using allegro :o

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

ImLeftFooted
Member #3,935
October 2003
avatar

The codes already done, I'm looking for a walk-through on how to add a driver to allegro the way allegroGL has.

tobing
Member #5,213
November 2004
avatar

Maybe this article I recently found at gamasutra might be of interest here:

http://www.gamasutra.com/features/20061101/feng_01.shtml

Elias
Member #358
May 2000

Quote:

The codes already done, I'm looking for a walk-through on how to add a driver to allegro the way allegroGL has.

There is some minimal information on the wiki: http://awiki.tomasu.org/bin/view/Main/AllegroDev

However, there is no walk-through how to do it, the relevant parts of the code you have to touch are very few and easy to follow - but you will need to understand how it works, to add a driver.

You could start by grepping for "set_gfx_mode", and it should lead you to the driver selection, which should lead to the structures used for gfx drivers, with their vtables and all. AllegroGL will then somewhere define and register its own version of that structure, probably you also will want to copy the way AllegroGL destroys the current Allegro window in its set_gfx_mode, and then connects its own window to keyboard/mouse and so on.

If you need any hints where to find things in the source code or can't figure out how something is supposed to work, just ask (here or on the ML or in #allegro, if you happen to catch someone who knows in the latter case).

--
"Either help out or stop whining" - Evert

Fladimir da Gorf
Member #1,565
October 2001
avatar

Quote:

The codes already done, I'm looking for a walk-through on how to add a driver to allegro the way allegroGL has.

How about integrating it to OL? ;)

Allegro's interface won't be able to exploit all the new possibilities enabled by hardware acceleration.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

ImLeftFooted
Member #3,935
October 2003
avatar

Sounds good to me. Never used OL though

GullRaDriel
Member #3,861
September 2003
avatar

Flad said:

Allegro's interface won't be able to exploit all the new possibilities enabled by hardware acceleration

My god, and can you tell me why ?

EDIT: Everything is possible if someone takes time to do it. Look, even Micro$oft finally release OS's

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

ImLeftFooted
Member #3,935
October 2003
avatar

Quote:

My god, and can you tell me why ?

This list is quite long. The biggest reason being because it does not take control of page flips / buffer swaps.

GullRaDriel
Member #3,861
September 2003
avatar

I was thinking that

Quote:

The codes already done, I'm looking for a walk-through on how to add a driver

Perhaps I misunderstood you

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

Evert
Member #794
November 2000
avatar

Quote:

Allegro's interface won't be able to exploit all the new possibilities enabled by hardware acceleration.

That is really the right attitude when it comes to designing and implementing the new graphics API. You did know that's being worked on, right?

Fladimir da Gorf
Member #1,565
October 2001
avatar

I've heard some discussions, but I haven't followed them too closely. The reason might be that Allegro won't be using C++ anyways... Otherwise I'd have joined the development team instead of making my own library.

GullRaDriel: Allegro doesn't currently allow simultaneous blending, rotation and stretching, for example.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

HoHo
Member #4,534
April 2004
avatar

Well, you could start making the to-be official C++ wrapper for Allegro :)

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Daniel Schlyder
Member #257
April 2000
avatar

Thanks for the article link, Tobing!

GullRaDriel
Member #3,861
September 2003
avatar

Fladimir: only human brain can handle multiple complex operations at the same time ;-p

I was thinking AllegroGL could help to handle those things. I am also thinking that some things are tried to help merging AllegroGL && Allegro.

But correct me if I am wrong !

Allowing threading or OpenGL programming is not a C++ only spell ;-)

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

ImLeftFooted
Member #3,935
October 2003
avatar

I was thinking I might actually use the BITMAP object to manipulate textures. Go the extra mile beyond allegGL..

Implement all the bitmap routines for D3D and add a few more.

Fladimir da Gorf
Member #1,565
October 2001
avatar

Quote:

Well, you could start making the to-be official C++ wrapper for Allegro

You could view OpenLayer as my vision of that. Originally, it was intended to support software rendering as well, but I thought that there was really no reason for that - the software routines would run far too slow. If a computer can't support hardware rendering, it's usually too slow to do the same routines in software as well.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

ImLeftFooted
Member #3,935
October 2003
avatar

Ok, adding D3D support to OL makes more sense anyway. Where should I start? Is there already a driver system? Is there a svn repo somewhere I can make patches off of and / or add changes to?

Fladimir da Gorf
Member #1,565
October 2001
avatar

Eh, there is a driver system, but it's just for different OpenGL libraries. The SVN repository is located in Berlios (the first link in my sig). It's best to discuss the plan throughoutly...

One way would be to implement all the drawing functions separately for OpenGL and Direct3D (or at least the parts that differ), using #ifdef OL_USE_D3D everywhere. It'd be possible to make OL to use Direct3D by default when compiling the library for Windows.

I know almost nothing about D3D, so seeing the code could help a bit to see what should be done. For example, I have the impression that D3D isn't state-based like OpenGL is...

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

tobing
Member #5,213
November 2004
avatar

I'm (again) wondering. There are libraries out there, which have done an outstanding job in abstracting the hardware API to be used - D3D versus OpenGL - and provide a generic API to use. Most popular examples are OGRE, Irrlicht and CrystalSpace (only open source mentioned here). What good would it be to do this again? If OL (or any other lib) should be abstracted from the actual underlying API, why not use one of the existing libraries to achieve this? It might be possible (or not, depending on a lot of details) to implement OL (for example) as a wrapper around an existing 3D rendering lib.

Archon
Member #4,195
January 2004
avatar

Quote:

I have the impression that D3D isn't state-based like OpenGL is...

Not really... and you have to make a DirectGraphics9 object which is probably the closest thing you have to the OpenGL 'state'.

Fladimir da Gorf
Member #1,565
October 2001
avatar

Tobing, if that's possible, it might be a good idea indeed. I just had the impression that all those libraries were for scenegraphs.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

tobing
Member #5,213
November 2004
avatar

I don't know for sure if it's possible or not. For my own game project, which will be 2D (iso), I have looked into those 3D libs and decided to use the simpler approach, i.e. allegro-based. OpenLayer has the advantage that it uses hw acceleration, but has a simple interface, so I decided to go for this.

That doesn't mean of course that OL cannot be implemented using one of those libraries, but someone has to dig into the relevant data models and find out if it can be done (most probably it can), and what effort it would be (not too easy, I guess). I must say that I would do this if I had any time for it. But as it is, my spare time is way too limited (especially towards the end of the year), so my personal preference is to work on my game...

Edit: As an additional remark I would say that changing OL to use e.g. OGRE is not harder than changing it to use both OpenGL and D3D. Changes have to be made in any case. But I also would say that it's not easy and straightforward to make such changes, and it might turn out that the overall design of OL (using AllegroGL and other libs) is not suited too well to use D3D or OGRE or something really different from OpenGL. I might be wrong with this though, because I'm not (yet) an expert with OL or OGRE...

juvinious
Member #5,145
October 2004
avatar

Fladmimir just to note... it's not cbuild that creates the msvc projects, it's cmake and it's still WIP, but update your signature nonetheless. :P
And I would think the best method of approaching this, using different backends, is by abstracting the graphic routines and use an adapter method. But I don't know how difficult would that be, especially if the opengl/allegro stuff is fully integrated into the rest of the system.

__________________________________________
Paintown

Fladimir da Gorf
Member #1,565
October 2001
avatar

OpenGL commands are currently directly integrated, but Allegro isn't. Any abstraction layer might make the results a bit better readability-wise and editing the code easier, but would also add overhead which would slow down the results.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

 1   2   3 


Go to: