providing a C interface for Ogre3D

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.

providing a C interface for Ogre3D

Postby boegel » Sat May 28, 2005 5:14 pm

I'm planning to set up a project to build a 3D modeller in Haskell, and I might use Ogre3D as render engine. The only problem is, Haskell can only use C functions, so I would need a C interface to Ogre3D. I heard a rumor that someone was willing to write this, but nobody seems to remember who he/she was :(

http://haskell.org/hawiki/H3D

Does anyone in here want to help building a C interface for Ogre3D ?
There are only 10 kinds of people in the world, those who know binary and those who don't
boegel
Gnoblar
 
Posts: 3
Kudos: 0
Joined: 28 May 2005
Location: Belgium

Postby LordMyth » Wed Jun 01, 2005 6:37 pm

May I ask why you want to go with the Haskell programming language?
I mean, it's probably faster to program your modeler in C++ or C# then converting OGRE to C (crazy idea if you ask me) and then using it in Haskell.
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
User avatar
LordMyth
Goblin
 
Posts: 230
Kudos: 0
Joined: 06 Jan 2005
Location: Belgium

Postby jacmoe » Wed Jun 01, 2005 7:23 pm

@LordMyth:
There's absolutely no point in this - we choose what we choose - it's a matter of personal preferences.
@boegel:
I sincerely hope you find a solution!
A C-wrapper for Ogre could be useful for a lot of other things.. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby xavier » Wed Jun 01, 2005 7:39 pm

Jeez jacmoe, back off. It's a perfectly reasonable question, and was asked rather respectfully.

And unless you are involved in the effort, what do you care?
User avatar
xavier
OGRE Moderator
OGRE Moderator
 
Posts: 9481
Kudos: 22
Joined: 18 Feb 2005
Location: Dublin, CA, US

Postby jacmoe » Wed Jun 01, 2005 8:16 pm

I care about not reading language wars, that's all. :)

Other than that, I don't give a shit. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby LordMyth » Wed Jun 01, 2005 8:20 pm

Sorry if it sounded harsh, I was really only asking if he wanted to use Haskell at every price...
And why are you replying if you don't give a shit huh!
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
User avatar
LordMyth
Goblin
 
Posts: 230
Kudos: 0
Joined: 06 Jan 2005
Location: Belgium

Postby jacmoe » Wed Jun 01, 2005 8:27 pm

xavier wrote:And unless you are involved in the effort, what do you care?

Merely a reply to xavier's polite question. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby boegel » Wed Jun 01, 2005 8:43 pm

LordMyth wrote:May I ask why you want to go with the Haskell programming language?
I mean, it's probably faster to program your modeler in C++ or C# then converting OGRE to C (crazy idea if you ask me) and then using it in Haskell.


Wow, I started a flame war unwillingly :)

@LordMyth, to answer our question: just because I wanted to try how Haskell would do while
implementing a 3D modeller. I don't want to do it because I think Haskell might be better at it than C++, but to show off Haskell's strenghts. It probably won't be just another modeller like Maya or 3DS Max, but something quite different. More mathematically, probably based on L-systems and the lot.

I hope this topic can go back to helping me with finding (or creating) a C interface to Ogre3D now... :D

@jacmoe: If you find it interesting, do you think you know a few people who might help me with this ? I do know some C, but not enough to do it on my own. And to start with, I'd only need some basic stuff, not every feature of Ogre3D.
There are only 10 kinds of people in the world, those who know binary and those who don't
boegel
Gnoblar
 
Posts: 3
Kudos: 0
Joined: 28 May 2005
Location: Belgium

Postby jacmoe » Wed Jun 01, 2005 8:48 pm

Maybe the script-bindings for Ogre (Lua, Python, etc) could be used/modified.
They are trying to fool C-like languages to use C++ Ogre.

There could even be a SWIG for Haskell ! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby haffax » Wed Jun 01, 2005 9:04 pm

Since swig already supports MzScheme this way might work when someone implements a Haskell binding for it. If you want to go for it yourself then be aware that the SWIG source is code directly from hell. :evil:
An unmaintainable mess. I really admire the SWIG developers for being able to work with it.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
 
Posts: 5084
Kudos: 3
Joined: 18 Jun 2004
Location: Berlin, Germany

Postby lodi » Wed Jun 01, 2005 10:21 pm

A C-binding would also let you use the D language.
lodi
Greenskin
 
Posts: 108
Kudos: 0
Joined: 24 Jul 2004

Postby jacmoe » Wed Jun 01, 2005 10:27 pm

And Delphi. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby BenO » Wed Jun 01, 2005 10:32 pm

we should port to D ^^ this would be better :P
Benjamin RIGAUD
Software Engineer
User avatar
BenO
Goblin
 
Posts: 241
Kudos: 0
Joined: 18 Apr 2005

Postby boegel » Wed Jun 01, 2005 10:34 pm

BenO wrote:we should port to D ^^ this would be better :P


I can see there is some animo to set up such a thing. How hard would it be to create a basic interface in C for Ogre3D ? Just as a test case, maybe I can go on from there myself... Anyone up for that ? :roll:
There are only 10 kinds of people in the world, those who know binary and those who don't
boegel
Gnoblar
 
Posts: 3
Kudos: 0
Joined: 28 May 2005
Location: Belgium

Postby jacmoe » Wed Jun 01, 2005 10:35 pm

we should port to D ^^ this would be better


It already is. It is called "Sinbad" - I kid you not.

:)

http://www.ogre3d.org/phpBB2/viewtopic.php?t=9512&start=0&postdays=0&postorder=asc&highlight=
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby BenO » Thu Jun 02, 2005 9:04 am

well :O i saw it :o but, ( BurP ) ..
Benjamin RIGAUD
Software Engineer
User avatar
BenO
Goblin
 
Posts: 241
Kudos: 0
Joined: 18 Apr 2005

Postby LordMyth » Thu Jun 02, 2005 4:08 pm

If you want to generate all sorts of math-based meshes and stuff, OpenGL is probably easier. But then you will have to do everything yourself and that's something you don't like, I bet. But on the other side it is very useful to know OpenGL, when looking for work there will be a big chance they never heard about OGRE...
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB
User avatar
LordMyth
Goblin
 
Posts: 230
Kudos: 0
Joined: 06 Jan 2005
Location: Belgium

Would like something like this too

Postby Dawgmatix » Sun Jun 05, 2005 4:10 pm

Yep, a c interface would be great. :)
Any ideas about how this might be done???
Dawgmatix
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 05 Jun 2005

Postby ahmedali » Sun Jun 05, 2005 5:01 pm

Ogre in C? I guess it will look like this, atleast it will not apear as ugly as quake's code.

uint node = createChildNode(mSceneMgr, Vector3() )
uint entity = createEntity(sceneManager, "dragon", "dragon.mesh'")
attachObject(node, entity)

traslateNode(node, Vector3)
or
nodeTraslate(node, Vector3)

May be not "uint" since ogre is managing objects.
User avatar
ahmedali
Gnome
 
Posts: 398
Kudos: 0
Joined: 20 Feb 2004
Location: Lahore, Pakistan

Postby jacmoe » Sun Jun 05, 2005 5:24 pm

With a bit of work, you can make SWIG generate C from C++ - I found this post:
http://mailman.cs.uchicago.edu/pipermail/swig/2004-March/009461.html
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 161
Joined: 22 Jan 2004
Location: Denmark

Postby ssylvan » Sun Jun 05, 2005 5:40 pm

LordMyth wrote:May I ask why you want to go with the Haskell programming language?
I mean, it's probably faster to program your modeler in C++ or C# then converting OGRE to C (crazy idea if you ask me) and then using it in Haskell.


We feel that while there is a startup cost to interfacing to non-C libraries there are substantial benifits (from both a productivity and a maintenance standpoint) to using Haskell over C++.
Experience shows this to be true in other areas and I think it's true for graphics as well.
The main reason why that is, IMO, that you'd be hard pressed to find a problem domain which so neatly fits into the functional programming paradigm as graphics does.
Even the Doom 3 renderer is written in a functional style (albeit using C) internally, even though it interfaces with the rest of the engine in an OO style.

So anyway, I feel that if "someone" can get a nice interface between Haskell and some rendering system (maybe write one ourselves using the Haskell binding to OpenGL) there's a huge potential for high-level graphics programming that can surpass anything possible in conventional imperative languages such as C++ (see for instance Vertigo, an "embedded language" for shader programming in Haskell, at http://conal.net/Vertigo/).
ssylvan
Gnoblar
 
Posts: 22
Kudos: 0
Joined: 05 Jun 2005

Postby lodi » Wed Jun 08, 2005 8:42 pm

I just wanted to pop in to wish you luck with the C wrapper.

I've only casually fooled around with Haskell, but it's definitely one to look out for. I'm not sure how suited it is to interactive stuff (couldn't get my head around monads and the like) but for prototyping algorithms and mathematical computation, it can't be beat! It's very slow at the moment, but being a functional language with no side effects, it also has the potential to outperform c++, since it's much easier for the compiler to parallelize code.

D is a good complement to H; it supports garbage collection, unit testing, invariates, and all the other 'big, real world project' stuff right in the language, while maintaining support for inline assembly, and all kinds of low-level hackery.

As an aside, lately I've been partial to the 'scripting' languages. Ruby, in particular, is a wonderful blend of oo, closures, serialization/marshalling, and so on. When I'm programming in c++, I'm now constantly thinking how my code could have been better if I did things "the ruby way".

Anyway, good luck!
lodi
Greenskin
 
Posts: 108
Kudos: 0
Joined: 24 Jul 2004

Postby ssylvan » Sat Jun 11, 2005 3:55 pm

Another cool language is Nemerle (www.nemerle.org).


It's .Net so anything you can do in .Net (like OpenGL and DirectX) is instantly supported.

It's OOP so it's quite intuitive to use the .Net libraries

It's FP so you get the benifits of less bugs and higher productivity that FP languages offer. Specifically it offers variants (like Haskell's algebraic data types), type inference, higher order functions (yes, C# has delegates but that's clunky), local function definitions etc...
I think partial application is in the works (right now you have to use the eta long form), at least I suggested some syntax on the developer list and it seems like all of the people behind the language are for it (it's only a matter of time before they implement it).

Anyway, it's a cool language because it's basically C# with less clunky syntax, and some more powerful FP tools.

It doesn't have the purity and laziness of Haskell, sadly, but when you want to interface with .Net that's probably somewhat impossible.
ssylvan
Gnoblar
 
Posts: 22
Kudos: 0
Joined: 05 Jun 2005

Postby iremembercliford » Sun Jun 12, 2005 11:21 pm

I might be interested in doing this, if someone could provide some details as to exactly what you were thinking.

Mike

marmarou at gmail dot com
iremembercliford
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 12 Jun 2005

Postby Promit » Tue Jun 14, 2005 4:34 pm

Nemerle + Axiom is probably the most productive thing to do right now, if you're dead set on functional languages...I assume Axiom will cooperate with Nemerle without any real difficulties.


Me, I never bought into the whole functional thing, but to each his own.
Promit
Gnoblar
 
Posts: 7
Kudos: 0
Joined: 12 Jun 2005


Return to Developer talk

Who is online

Users browsing this forum: Google Adsense [Bot] and 9 guests