Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 13:43

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 22.03.2011, 10:25 
Offline

Joined: 21.03.2011, 09:06
Posts: 4
Since i gave up on the beta5 to get to work, i'm trying to get my own little program to work with beta4(it works for my needs anyway), so basically what this program is about,im trying to wrapp the Horde3d engine into a dll with custom functions, basically im experimenting on how to write a small wrapped dev engine? with horde powered graphics and some physics lib, but first id like to get atleast a hello world example to work. So i think this is where my n00bness in c++ comes in, my experience in c++ stands in physics engines, and gfx engine structure is a bit more advance imo, so Horde3d seemed to be a pretty cool place where to start. Basically It would be a wrapper and every language that suports API calls should be able to run it.

Anyway I'm trying to write attleast 5 functions to get it all working, but i dont know if i should wrap the engine straight from source(witch imo seems to be the best way, but needs a bit deeper look into the engines structure), or i should wrap the dll's, or i should just basically write my own bindings(but id really like to write custom functions etc. For example a Function that Includes the main initialization.

Anyway writing these functions is not a problem, but writing them in a way that i could use them more than once is a bit over head for me right now, because i dont know if functions in h3d have classes, withc would be simpler to me. or i shoudl add classes, witch i dont quite understand yet, anyway, im trying to get these functions to work

Create3DDevice() - this would initialize horde3d
CreateCamera() - prety self explaining
LoadAMesh() - or if possible CreateAPrimitive(), just something to render
DisplayText() - to display something like "Hello World"
RenderScene() - just to render the whole thing in Horde3D

Well first everything was running smoothly, after i Created The Camera function, since there can be more cameras than one, and there can be more camera recourses also, so im not quite sure how to define/class or whatever it etc

Im sorry if this is a wery stupid thread, but this is what i would liek to do with Horde3D

Right now my not workin code looks like this:
Code:
// horde includes
#include <Horde3D.h>
#include <Horde3DUtils.h>

H3DNode cam = 0;
H3DRes pipeRes = 0;

// Define Function Exports
#define EXPORT extern "C" __declspec(dllexport)
#define MYCALL _stdcall

//Exported functions
EXPORT void MYCALL Create3DDevice ( int winWidth, int winHeight)
{   
    // Initialize Horde3D engine
    h3dInit();
    h3dSetupViewport( 0, 0, winWidth, winHeight, true );

    // Add pipeline resource
    H3DRes pipeRes = h3dAddResource( H3DResTypes::Pipeline, "standard.pipeline.xml", 0 );

    // Load added resources
    h3dutLoadResourcesFromDisk( "" );
}

EXPORT H3DNode MYCALL CreateCamera ( NodeHandle ParentNode)
{
    // Add camera
    H3DNode cam = h3dAddCameraNode( ParentNode, "Camera", pipeRes );
    return cam;
}

EXPORT void MYCALL RenderScene ( NodeHandle cam)
{
    // Render scene
    h3dRender( cam );
   
    // Finish rendering of frame
    h3dFinalizeFrame();
}


What do i need to add to get those functions working, is my aproach correct(i think not), should i quit C++ lol
anyway if there is a nice friendly persoun out there, maybe he can help a stupid guy like me, because id really like to learn and do this.


Last edited by Ravel on 22.03.2011, 20:04, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: 22.03.2011, 13:25 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Not sure why you want to create a DLL with a C interface for a DLL with a C interface?


Top
 Profile  
Reply with quote  
PostPosted: 22.03.2011, 19:32 
Offline

Joined: 21.03.2011, 09:06
Posts: 4
That is what i was thinking in the first place lol, I think it's mostly because i am quite new to C++ and C
Anyway, would you sugest me some tips on how to di it then? Should i write bindings or should i use the source directly and heavily modify the whole source? Because As you saw i wanted to simplyfy it even more. I am not quite sure why i want to do this, maybe its more like my way of learning the language itself...

Anyway any tips? What would be the best way to achive this or should i drop my idea instead?

Edit: oh well i took a deeper look to the source and i finaly understand how stupid i am haha
i'll start experimenting now


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group