C interface as core feature

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: C interface as core feature

Post by jacmoe » Wed Mar 21, 2012 5:46 pm

I think I'll take RPythonic for a spin, Hartsantler. :)

And probably use it as a base for this C interface thing.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
voyvf
Kobold
Posts: 28
Joined: Sat Jul 04, 2009 4:01 am
Location: United States
Contact:

Re: C interface as core feature

Post by voyvf » Mon Jul 23, 2012 3:56 am

jacmoe wrote:I think I'll take RPythonic for a spin, Hartsantler. :)

And probably use it as a base for this C interface thing.
Not certain if you've had any luck with RPythonic, but I've just cloned your repo here and added D2 bindings to LLCOI (and thus to OGRE and OIS) in a new "contrib" directory at the root of the project (wasn't sure where to put it, to be honest.) They've currently been tested using DMD 2.059 and DMD 2.060HEAD, but only using Linux as I don't have a Windows machine here.

I'm not sure how to issue a pull request via google code (I'm used to bitbucket and github) but you're more than welcome to include it in your project using LLCOI's license. :D

Thanks to everyone for all of their hard work. :D
0 x

drwbns
Orc Shaman
Posts: 777
Joined: Mon Jan 18, 2010 6:06 pm
Location: Costa Mesa, California

Re: C interface as core feature

Post by drwbns » Sat Aug 18, 2012 4:17 pm

Out of curiousity, what's the status of this project?
0 x

Houdini
Gnoblar
Posts: 15
Joined: Mon Oct 12, 2009 12:15 am

Re: C interface as core feature

Post by Houdini » Mon Aug 20, 2012 8:33 pm

I'm curious as to the status of this project as well. I have already wrapped many of the Ogre classes into C functions for my Ogre3D port to GameMaker and I may be interested in contributing to this project. Wouldn't be too hard to write an app to rename my functions, etc, to change the interface to match an existing project.

- Houdini
0 x

User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia

Re: C interface as core feature

Post by Mind Calamity » Wed Aug 22, 2012 8:15 pm

I don't know what the status of the project is, but I recently tried running it with the latest version of OGRE, and there were no problems, it works perfectly fine. The wrapper doesn't wrap all of OGRE, though. So you'll need to wrap some functions you need yourselves. The project is perfectly fit for use as an example of using OGRE in C applications. (At least that's what I used it for :))
0 x
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt

User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4291
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 2
Contact:

Re: C interface as core feature

Post by spacegaier » Wed Aug 22, 2012 9:14 pm

And if anyone wants to extend the project best to contact jacmoe directly. Link to the repo is now in the first post of this thread.
0 x
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Fri Aug 31, 2012 11:29 am

Just became aware of this.
I made some quick n dirty efforts to write a (non-pure) C-compatible wrapper for Ogre, so I can interop Ogre with golang.
See post here: http://www.ogre3d.org/forums/viewtopic.php?f=1&t=71944

I'd hate to reinvent the wheel. I'm no expert C programmer, but if there is anything I can do to keep the ball rolling, let me know. Thanks to you guys for getting this going. I'll play with what's in the repo and see if it's better than what I hacked up (it probably is).

Some questions I mentioned in that other thread:
  • does it compile to a single dll?
  • what are the dependencies for building the wrapper? it shouldn't be more than the used ogre header files, yet from looking at CMakeLists.txt, it seems to be doing more
  • can I link to it using just ogre_interface.h? that would be very convenient
  • is it being used/maintained at all? Last checkin was March 2011...
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia

Re: C interface as core feature

Post by Mind Calamity » Fri Aug 31, 2012 2:31 pm

  • does it compile to a single dll?
    - Yes
  • what are the dependencies for building the wrapper? it shouldn't be more than the used ogre header files, yet from looking at CMakeLists.txt, it seems to be doing more
    - OGRE only. There's an optional OIS alternative for input (for the test program) which is Allegro, but it's entirely optional, and the wrapper itself only needs OGRE.
  • can I link to it using just ogre_interface.h? that would be very convenient
    - Yes, ois_interface.h is optional for using OIS for input.
  • is it being used/maintained at all? Last checkin was March 2011...
    - It's achieved it's goal from what I can see: provide a basic C wrapper for OGRE. You can easily extend and modify this to fit your needs. (If it doesn't already.)
0 x
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Fri Aug 31, 2012 3:43 pm

sounds good.
I'll give it a spin soon.
The SWIG interface looks interesting, too.
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Fri Aug 31, 2012 3:45 pm

is there any intention to integrate the C interface into the core codebase to maintain it with the evolving cpp code?
Should be fairly trivial to do now that the bulk is there.
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
Contact:

Re: C interface as core feature

Post by CABAListic » Fri Aug 31, 2012 3:57 pm

No, there isn't, at least not at the moment. Integrating it into the core codebase would basically equal a promise to keep it up to date, which is problematic, because far as I'm aware no core team member is currently invested in a working C wrapper. So this adds another responsibility when we already have a pretty ambitious roadmap towards 2.0.

Besides, for the most part I don't see much of a disadvantage in keeping it in a separate repository.
0 x

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Fri Aug 31, 2012 4:30 pm

I understand. The advantage that I see is pretty much that - it would always be up to date. I would think that given that the interface is fairly slim, keeping it up to date would be trivial when kept close to the actual Ogre code; having it separated from the Core code base means realizing that the interface changed X major versions ago, and would surely make it much more work to fix.

Currently it comes pretty much for free (it's already there and seems to work, according to some more recent posts in this thread). Letting it drift away would be a shame. And maybe it could morph into a more comprehensive C API for Ogre at some stage. The ground work seems solid.

Don't get me wrong, I appreciate that you guys are loaded with work and I'm grateful for Ogre as it is - but this appears to me as a relatively tiny bit of work compared to the very ambitious tasks on the roadmap.
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
Contact:

Re: C interface as core feature

Post by CABAListic » Fri Aug 31, 2012 5:22 pm

Except it's not, because to keep it up to date it means that every developer would have to constantly verify that his changes / additions to the C++ codebase don't break or outdate the C wrapper. Otherwise the advantage is pretty much lost.
Given that personally I don't care for C at all, I'm really not looking forward to maintaining a C wrapper in that way, so for me at least it would be a burden. I'd much rather leave it in the capable hands of people actually interested in the wrapper.

Of course, we can happily endorse it officially if a group of people steps forward to maintain it. Links on the Ogre page etc., whatever you need.
0 x

User avatar
Nauk
Gnoll
Posts: 647
Joined: Thu May 11, 2006 9:12 pm
Location: Bavaria
Contact:

Re: C interface as core feature

Post by Nauk » Sun Sep 09, 2012 6:39 pm

Great stuff, love the idea D2 and Ogre going to work without big headache soon :) ++ for the effort Jacmoe! Not sure if that has been posted yet and/or it makes sense at all, but not long ago I had a thought about rewriting the automated Mogre wrapper to do exactly that.
0 x

User avatar
voyvf
Kobold
Posts: 28
Joined: Sat Jul 04, 2009 4:01 am
Location: United States
Contact:

Re: C interface as core feature

Post by voyvf » Mon Sep 10, 2012 8:19 pm

Nauk wrote:Great stuff, love the idea D2 and Ogre going to work without big headache soon :) ++ for the effort Jacmoe! Not sure if that has been posted yet and/or it makes sense at all, but not long ago I had a thought about rewriting the automated Mogre wrapper to do exactly that.
I actually got D2 to cover a rather extensive amount of Ogre via my fork of the LLCOI code - the D2 wrapper is here, and my LLCOI fork is here. There's also a Bullet wrapper for C and D2 if you're feeling adventurous :D

That said, I haven't had much time lately to work on it. It's also only fair to note that I've found that using a C++ library via a C wrapper has one insanely annoying downside, in that if the C++ library throws an exception, you're toast, as the entire program will crash. This isn't so much Ogre's fault (or for that matter, any other library) but just that C doesn't play well with C++ exceptions - Boost.Python suffers from the same issue, as does LuaBind if I recall correctly.
0 x

User avatar
Nauk
Gnoll
Posts: 647
Joined: Thu May 11, 2006 9:12 pm
Location: Bavaria
Contact:

Re: C interface as core feature

Post by Nauk » Tue Sep 11, 2012 1:44 pm

voyvf wrote:
Nauk wrote:Great stuff, love the idea D2 and Ogre going to work without big headache soon :) ++ for the effort Jacmoe! Not sure if that has been posted yet and/or it makes sense at all, but not long ago I had a thought about rewriting the automated Mogre wrapper to do exactly that.
I actually got D2 to cover a rather extensive amount of Ogre via my fork of the LLCOI code - the D2 wrapper is here, and my LLCOI fork is here. There's also a Bullet wrapper for C and D2 if you're feeling adventurous :D

That said, I haven't had much time lately to work on it. It's also only fair to note that I've found that using a C++ library via a C wrapper has one insanely annoying downside, in that if the C++ library throws an exception, you're toast, as the entire program will crash. This isn't so much Ogre's fault (or for that matter, any other library) but just that C doesn't play well with C++ exceptions - Boost.Python suffers from the same issue, as does LuaBind if I recall correctly.
Awesome :) Offtopic, may I ask what tool chain you are using? - *Edit* Nevermind that question, I just read back and saw the post a bit further up.
0 x

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

Re: C interface as core feature

Post by jacmoe » Wed Sep 12, 2012 10:33 pm

This is sort of on the back burner - but not scrapped. :)
I think I want to take the Python powered C wrapper generator for a spin to see how it can help in producing a working set of C files.
At least before carrying on.
This project needs some loving care. ;)

The main reasons for this project would be to generate C bindings for other languages, like Python, Lua, Lisp.

My stack of things to do is not currently in need of a C interface, but will soon (read: in 6 months time).
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: C interface as core feature

Post by jacmoe » Wed Sep 12, 2012 10:33 pm

If people want to be added to the project, just drop me a PM, or message me on Bitbucket.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: C interface as core feature

Post by jacmoe » Wed Sep 12, 2012 10:36 pm

Which reminds me that I should move the project to Bitbucket RSN.. ;)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Fri Sep 21, 2012 1:31 pm

I can't seem to get a hold of you (tried bitbucket, forum pm, llcoi issues...). I imported llcoi to Bitbucket, needed to get it working with ogre 1.8.
https://bitbucket.org/galaktor/llcoi/src
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

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

Re: C interface as core feature

Post by jacmoe » Fri Sep 21, 2012 3:46 pm

I am busy!

Add me to the project if you like - you beat me to moving the project to Bitbucket. :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Fri Sep 21, 2012 3:59 pm

I figured you're busy :-)

I made you an admin on the project. Didn't mean to "beat you" though, just need to make changes and I prefer to do them in a collaborative/public manner. It's still your work, and it's helping me a lot.
Open source rocks.

Have a look at my (fairly minor) changes when you get a chance.
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Mon Oct 01, 2012 1:28 pm

update:
I integrated voyvf's repo into mine: https://bitbucket.org/galaktor/llcoi
The CMake build is probably broken (I compile using g++, without CMake), but otherwise it looks to be working fine and is quite extensive (thanks to Jeremy's work).
I'll continue to sanitize it a bit, there are quite a lot of inconsitencies at the moment (i.e. naming of functions, usage of handles/singletons, forward declarations etc).
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

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

Re: C interface as core feature

Post by jacmoe » Mon Oct 01, 2012 3:24 pm

I tried to follow a C/Python/Lisp naming convention - ie lower case underscore, like 'create_camera', etc.

Structs and function pointers would be one possible improvement, I think, for some things:
camera.rotate, etc.

I'll see about fixing the CMake build script when I get some time. :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
galaktor
Kobold
Posts: 33
Joined: Tue Nov 04, 2008 10:57 pm

Re: C interface as core feature

Post by galaktor » Mon Oct 01, 2012 8:23 pm

I've no problem with the chosen convention (class_function_name works fine for me), but it's not consistently applied, that's all.

I was thinking the same wrt pseudo-classes using structs and func ptrs. I want to get what's there into a cleaner state and tag a 0.1 version, first.

If you could look at CMake that would be great - somehow me and CMake don't get along very well. :-)
0 x
gogre3d - ogre bindings for golang
https://github.com/galaktor/gogre3d

llcoi - Low level C Ogre3D Interface
https://bitbucket.org/galaktor/llcoi

Post Reply