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.
boegel
Gnoblar
Posts: 3
Joined: Sat May 28, 2005 5:11 pm
Location: Belgium
Contact:

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 ?
0 x
There are only 10 kinds of people in the world, those who know binary and those who don't

User avatar
LordMyth
Gremlin
Posts: 181
Joined: Thu Jan 06, 2005 10:19 pm
Location: Belgium
Contact:

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.
0 x
Have a kiss from me!
Gentoo Linux on AMD64 3200+
NForce4 Chipset
Dual Channel DDR 2x512MB
PCX 16 GeForce 6600 256MB

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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.. :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

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?
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
LordMyth
Gremlin
Posts: 181
Joined: Thu Jan 06, 2005 10:19 pm
Location: Belgium
Contact:

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!
0 x
Have a kiss from me!

Gentoo Linux on AMD64 3200+

NForce4 Chipset

Dual Channel DDR 2x512MB

PCX 16 GeForce 6600 256MB

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

boegel
Gnoblar
Posts: 3
Joined: Sat May 28, 2005 5:11 pm
Location: Belgium
Contact:

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.
0 x
There are only 10 kinds of people in the world, those who know binary and those who don't

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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 ! :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
Contact:

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.
0 x
team-pantheon programmer
creators of Rastullahs Lockenpracht

lodi
Greenskin
Posts: 103
Joined: Sat Jul 24, 2004 7:06 pm

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

A C-binding would also let you use the D language.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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

And Delphi. :wink:
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
BenO
Goblin
Posts: 241
Joined: Mon Apr 18, 2005 5:03 pm

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

we should port to D ^^ this would be better :P
0 x
Benjamin RIGAUD
Software Engineer

boegel
Gnoblar
Posts: 3
Joined: Sat May 28, 2005 5:11 pm
Location: Belgium
Contact:

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:
0 x
There are only 10 kinds of people in the world, those who know binary and those who don't

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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=
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
BenO
Goblin
Posts: 241
Joined: Mon Apr 18, 2005 5:03 pm

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

well :O i saw it :o but, ( BurP ) ..
0 x
Benjamin RIGAUD

Software Engineer

User avatar
LordMyth
Gremlin
Posts: 181
Joined: Thu Jan 06, 2005 10:19 pm
Location: Belgium
Contact:

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...
0 x
Have a kiss from me!

Gentoo Linux on AMD64 3200+

NForce4 Chipset

Dual Channel DDR 2x512MB

PCX 16 GeForce 6600 256MB

Dawgmatix
Gnoblar
Posts: 1
Joined: Sun Jun 05, 2005 4:08 pm

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???
0 x

User avatar
ahmedali
Gnome
Posts: 302
Joined: Fri Feb 20, 2004 8:52 pm
Location: Lahore, Pakistan

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.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

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
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

ssylvan
Gnoblar
Posts: 22
Joined: Sun Jun 05, 2005 5:29 pm

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/).
0 x

lodi
Greenskin
Posts: 103
Joined: Sat Jul 24, 2004 7:06 pm

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!
0 x

ssylvan
Gnoblar
Posts: 22
Joined: Sun Jun 05, 2005 5:29 pm

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.
0 x

iremembercliford
Gnoblar
Posts: 1
Joined: Sun Jun 12, 2005 11:18 pm

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
0 x

Promit
Gnoblar
Posts: 7
Joined: Sun Jun 12, 2005 9:15 pm

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.
0 x


Return to “Developer talk”

Who is online

Users browsing this forum: No registered users and 2 guests