Horde3D

Next-Generation Graphics Engine
It is currently 13.05.2024, 11:36

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 05.08.2009, 15:28 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
I'm tying up Horde to SFML and I am wondering about something.

I can get SFML to render into the window it creates fine. I can get Horde to render into the window SFML creates, but I cant get them both to render together.

A couple of things that occur to me:

I could be setting the wrong projection/modelview matrices
I am mixing the shader pipeline of horde, with the fixed function pipeline of SFML

I dont think its the matrices being wrong. As I've stored those before the 2D render. So I am thinking its a problem with the mixing of shader/fixed func.

Anyone know if shaders/fixed func are allowed under GL?

I guess one thing that strikes me, is that maybe I need a pass-through shader for horde that basically does as fixed function does. But if there's an easier way to enable/disable the shader pipelines and switch between them that would be good.

I quite like SFML, so it'd be nice if I could get this working.


Top
 Profile  
Reply with quote  
PostPosted: 06.08.2009, 01:08 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
I think I remember this problem coming up in the past... Are you calling h3dFinalizeFrame after h3dRender?


Top
 Profile  
Reply with quote  
PostPosted: 06.08.2009, 02:00 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Yes. Its the next call after the render call.


Top
 Profile  
Reply with quote  
PostPosted: 07.08.2009, 15:00 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Mixing shaders and fixed function should not be a problem. You just need to bind the shader object 0 to "disable" shaders (actually the driver will use an internal fixed function shader then).

Volker was doing that for the editor to draw debug geometry. In Beta4 many states are reset after rendering. However, it may be that not all states that you require are reset.
In general I would consider mixing your own rendering with Horde's as a hack since it will not work with different rendering backends (like D3D). However, if you know what you are doing it is ok ;)


Top
 Profile  
Reply with quote  
PostPosted: 07.08.2009, 15:15 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Yeah, it really is a bit of a hack right now. But I'm trying to keep the renderer part of my engine as a single class and I'm just mixing the rendering of 2D and 3D within that class.

The reason why I want to use SFML is because it wraps Freetype in a reasonably clean way. So I can use it for my UI code. At some point I might consider just adding my own code that does the freetype wrapping for Horde and then it would be possible to ditch SFML, but then it does have some other useful features too.

Either way, thanks for the info, I'll give it a try. I finally got Horde rendering properly with my own camera and other classes at least now. So its really the H3D/SFML thing that needs a bit of tweaking.


Top
 Profile  
Reply with quote  
PostPosted: 08.08.2009, 16:36 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
Ok, fixed the problem. Added some matrix getter code to when the 2D and 3D scenes are initialised so I can restore the various matrices before rendering each pipeline. I also fixed up the camera set transform code so I could use a quaternion (by using a Matrix4 initialised from the quat).

the upshot is that SFML basically handles initialisation of the render window and drawing some 2D stuff into it (mainly text). I handle the rendering of my own 2D UI stuff via a call to my renderer class to render a rect, but SFML provides the texture binding.

All in all, a fairly acceptable method of working so far. Now just fixing up my other component interfaces to use Horde and then I'll get on with the Brain insertion UI (yes, my game involves plugging brains into agents).

Cool! I cant even begin to imagine porting this thing to the Mac though :) or Wii/PS3/Xbox360.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 17 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:  
Powered by phpBB® Forum Software © phpBB Group