Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Direct3D Support  (Read 5244 times)

0 Members and 1 Guest are viewing this topic.

graphitemaster

  • Newbie
  • *
  • Posts: 18
    • View Profile
Direct3D Support
« on: December 11, 2010, 07:35:35 am »
It has come to my understanding many times that SFML is a OpenGL inspired multimedia library, and I accept this as I find OpenGL a much more solid structured library to work with when it comes to graphics not to mention that fact that is multiplatform compatible, I.E Windows, *Nix and Mac.

However I have hit a snag at porting my 3D engine to the Microsoft XBOX360 game console, see Microsoft is the proud producer of Direct3D and they decided to keep OpenGL based applications from running as official released games on their platform.  So I have performed what any sane man could attempt, recreate a context using the WinAPI and Direct3D, however this is far from anything sane, considering I still have to process events, input, not to mention SFML only has a OpenGL shader system and texture loader / binder plus the sprite system and a umpteen of other things that are OpenGL only.

So I was considering the possibility of abstracting the OpenGL stuff into it's own class that can inherit a RendererOpenGL or RendererD3D class to perform it's hard work, I've looked at the code base a few times and 99% of the work is done, the window handle and context is all there and because of this a simple Direct3D option could be a toggleable option using a preprocessor directive such as #define SFML_OPENGL or #define SFML_DIRECT3D.  In addition the Music / Network systems don't even have to be touched, since the music uses OpenAL which is perfectly fine as a stand alone things and the Network system again applies. As for texture loading and mapping you can just wrap those up and write alternatives, or even use some stuff found in DirectX, but I rather you stayed away from the entire library because it changes too often to keep up with.

I would be glad to help you do this, I have already done this a few times myself for game engine ports, I just wish you could use a more 'open' version control like git ( see www.github.com ). So I'm just going to ask do you want another developer to help you with Direct3D support.  Please note that it will not break any cross platform compatibility it's just an option for those on Windows or are developing for Microsoft's game console, in addition it would introduce a lot more Direct3D fan boys, and would probably help with game console support once others see such feature.

What do you think, the context is there, the process events are there the network, sound, music, and system core's don't need to be touched the only thing that needs to be changes is the graphics area by abstracting everything and using those and then everything itself can be changed in only 4 files, 2.hpp and 2.cpp a set for OpenGL and a set for Direct3D, I would be glad to help, I'm around all the time, let me know what you think.

graphitemaster

  • Newbie
  • *
  • Posts: 18
    • View Profile
Direct3D Support
« Reply #1 on: December 11, 2010, 07:40:48 am »
EDIT: I see stb_image use in the SFML2 branch, this also will work with Direct3D, so no need to use DirectX at all.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Direct3D Support
« Reply #2 on: December 11, 2010, 12:27:26 pm »
Quote
DirectX

I assume you mean D3DX?

Direct3D would be necessary only for XBox 360. For all other platforms, it won't make any difference -- even for DirectX fan boys.

So I don't really want to go through the process of abstracting things and developing a new renderer., which would be much more complex than you may think.
SFML is clearly an OpenGL library, not only as an abstract wrapper but it can also mix very easily with native OpenGL code. I don't want it to be 100% abstracted.

In the future, I will have to abstract things a little bit more (to support OpenGL ES), but this is not my priority for SFML 2. So maybe we can talk again about Direct3D after this job is done :P
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Direct3D Support
« Reply #3 on: December 11, 2010, 12:29:17 pm »
Quote from: "graphitemaster"
I would be glad to help you do this, I have already done this a few times myself for game engine ports, I just wish you could use a more 'open' version control like git ( see www.github.com ). So I'm just going to ask do you want another developer to help you with Direct3D support.  Please note that it will not break any cross platform compatibility it's just an option for those on Windows or are developing for Microsoft's game console, in addition it would introduce a lot more Direct3D fan boys, and would probably help with game console support once others see such feature.
Here you have a statement of Laurent concerning distributed version control systems:
Quote from: "Laurent"
I agree with this. Distributed systems like Git / Mercurial make branching and developing your own contribution really easy.

However I don't really want people to start creating branches, developing their own stuff (sometimes huge contributions), and submit it to me. SFML is not a community project, I like controlling and implementing stuff myself, and I like the current system where people write their requests or submit their patches here :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

graphitemaster

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Direct3D Support
« Reply #4 on: December 11, 2010, 12:59:20 pm »
Quote from: "Nexus"
Quote from: "graphitemaster"
I would be glad to help you do this, I have already done this a few times myself for game engine ports, I just wish you could use a more 'open' version control like git ( see www.github.com ). So I'm just going to ask do you want another developer to help you with Direct3D support.  Please note that it will not break any cross platform compatibility it's just an option for those on Windows or are developing for Microsoft's game console, in addition it would introduce a lot more Direct3D fan boys, and would probably help with game console support once others see such feature.
Here you have a statement of Laurent concerning distributed version control systems:
Quote from: "Laurent"
I agree with this. Distributed systems like Git / Mercurial make branching and developing your own contribution really easy.

However I don't really want people to start creating branches, developing their own stuff (sometimes huge contributions), and submit it to me. SFML is not a community project, I like controlling and implementing stuff myself, and I like the current system where people write their requests or submit their patches here :)


I can still svn import that into a git branch and fork,thats the beauty of opensource.