Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Using Allegro in a plugin

This thread is locked; no one can reply to it. rss feed Print
Using Allegro in a plugin
Johannes Bergmark
Member #4,867
July 2004
avatar

Edit: Totally stupid me, when I wrote this post, and looking again in the MakeFile, I have commented out the allegro libraries, but still I wonder if it would work, I crashed the simulator now because I of allegro or me did some wonky-bonky with the game-engine. :D
:D
Okay, this may sound far-fetched, but it would help alot if it would work, as for me, Allegro is so intuitive. :)

I guess it may open a big can of worms, if it would possible to do it.

I'm currently planning to develop a plugin for a flight-simulator, X-Plane for this instance, which is mainly using opengl, i.e. to draw on windows and more.

Though learning OpenGL is quite a big task, i.e. I want to draw text with fonts, draw primitives and so on.

Actually I made some primitive drawing functions my self in OpenGL, i.e. drawing circles, outlined or filled, though surly they are very far from optimized.

The biggest thing I miss is to be able to draw some text, and allegro accomplishes this feature very well.

Anyway, is it possible to bake allegro in a plugin like this? I've been trying, but it seems al_init function fails with an error that 'atexit' does not exist. Then I've been using the al_install_system function instead, but then al_create_bitmap gets undefined aswell (even though I've the headers and linking done correctly, I hope).

Maybe there is something I missed in the makefile, I will attach it to this post. Or maybe I just should go abort, and try to learn OpenGL (with the horror of drawing text). ::)

"There are no Mines for the Sword." --?

"Det finns inga Minor för Svärdet." --?

Edgar Reynaldo
Member #8,592
May 2007
avatar

You need to tell us the requirements for the plugin you are trying to write. Also, using at_exit in a dll or plugin is bad don't do that, unless you register the at_exit function that you can see in your own main. Otherwise it thinks it refers the the dll's at_exit function.

Johannes Bergmark
Member #4,867
July 2004
avatar

Thank you.

Instead of al_init, I used the al_install_system function which works well.

All the initializations works well now and there is no crashing, and even creating bitmaps works.

But drawing on them with allegro primitives does not work. Using opengl drawing seems to work nicely.

I do not call al_create_display, as I do not want any other window.

Hence I want to draw on a allegro bitmap, which I then can present as an OpenGL texture in X-Plane.

X-Plane uses an internal function XPLMBindTexture2d instead of the glBindTexture2d.

I guess this call is made in the allegro primitives functions? If so this may be the culprit.....

I attach the simple code.

"There are no Mines for the Sword." --?

"Det finns inga Minor för Svärdet." --?

Edgar Reynaldo
Member #8,592
May 2007
avatar

Johannes Bergmark
Member #4,867
July 2004
avatar

Thank you for your help Edgar. :)

After all, for this project I think I skip Allegro, I've been trying to do some OpenGL, and I am able to draw primitives now, and I will do some custom font graphics also so I think everything will turn out well without Allegro. :)

A little more work and more time to learn, but I think it is best to go that approach instead of open the can of worms using Allegro in another game-engine.

:)

"There are no Mines for the Sword." --?

"Det finns inga Minor för Svärdet." --?

Go to: