OpenGL and Direct3D

Hi,

SDL provides the capability to create an OpenGL rendering context for the
surfaces it creates, which is very handy. Would it be possible to extend
this to include providing a Direct3D device context? This would be handy
also, as it would let people easily use Direct3D while letting SDL handle
the surfaces and setup code.

Michael

SDL provides the capability to create an OpenGL rendering context for the
surfaces it creates, which is very handy. Would it be possible to extend
No, not correct. It only provides OpenGL for the screen surface, a fact I have
criticed several times over the last weeks without any feedback. Till now, I
wrote my own, platform dependent, version of creating offscreen OpenGL
surfaces.

this to include providing a Direct3D device context? This would be handy
also, as it would let people easily use Direct3D while letting SDL handle
the surfaces and setup code.
This would break the aim of SDL to be platform independent. You don’t have
DirectX on any other target platform. In fact, only integrating QuickDraw would
make a bit sense, but when you want to write something with DX, especially
if you want to use the immidiate mode, it is better to use native DX at all.

Hope that helps,
Andreas Podgurski

this to include providing a Direct3D device context? This would be

Direct3D is inherently non-portable, thus of minimal usefulness for a
cross platform multimedia library.

m.–
“Advocating a system based on consumption is the ultimate violence
against poor nations.”
-Masamune Shirow

OpenGL is a platform independent 3D API. DirectX is extremely windows centric.
SDL is designed as a cross-platform lib, including DirectX support would break
that.On Thu, Nov 16, 2000 at 10:50:32PM +1100, Michael Day wrote:

Hi,

SDL provides the capability to create an OpenGL rendering context for the
surfaces it creates, which is very handy. Would it be possible to extend
this to include providing a Direct3D device context? This would be handy
also, as it would let people easily use Direct3D while letting SDL handle
the surfaces and setup code.

Michael


Martin

Bother said the Moderator, &$&^%NO CARRIER

OpenGL is a platform independent 3D API. DirectX is extremely windows centric.
SDL is designed as a cross-platform lib, including DirectX support would break
that.

Well, this does bring up an interesting point. Obviously we use
DirectDraw and DirectSound underneath the audio and video layers.

OpenGL in SDL is different, though–we don’t provide abstracted
triangle drawing functions or anything like that (ie, the 2d analog to
blitting pixels), just convenience hooks for setting up an OpenGL
window.

m.On Thu, Nov 16, 2000 at 03:42:42PM +0000, Martin Donlon wrote:


Programmer “Ha ha.” “Ha ha.” "What are you laughing at?"
Loki Software "Just the horror of being alive."
http://lokigames.com/~briareos/ - Tony Millionaire

Direct3D is inherently non-portable, thus of minimal usefulness for a
cross platform multimedia library.

Well, that’s not true. Does not a cut down version exist on the
Sega Dreamcast?

Michael

OpenGL is a platform independent 3D API. DirectX is extremely windows centric.
SDL is designed as a cross-platform lib, including DirectX support would break
that.

Yet SDL has other things (such as window manager hints) that will only
affect some platforms. Cross platform doesn’t mean everything works
identically on every platform.

Michael

“Michael” == Michael Day writes:

Direct3D is inherently non-portable, thus of minimal usefulness for
a cross platform multimedia library.

Well, that’s not true. Does not a cut down version exist on the Sega
Dreamcast?

Michael

Only if you decide to use WinCE on the Dreamcast, instead of the
native console OS, AFAIK. I don’t believe any serious games actually
use it (but I may be mistaken).

=wl–
Albert ``Willy’’ Lee, Emacs user, game programmer
"They call me CRAZY - just because I DARE to DREAM of a RACE of
SUPERHUMAN MONSTERS!"

OpenGL is a platform independent 3D API. DirectX is extremely windows centric.
SDL is designed as a cross-platform lib, including DirectX support would break
that.

Yet SDL has other things (such as window manager hints) that will only
affect some platforms. Cross platform doesn’t mean everything works
identically on every platform.

That’s kind of like saying “Gee, windows has open() function and so does
unix, so the fact that unix can open devices this way means that cross
compatibility is kept” wry grin

Seriously folks - on one side it’d be kind of useful to have a DirectX
emulation layer going to make those windows freaks shut up (sorry,
couldn’t resist a jab)… maybe borrow from wine? grin

I spent a few months on a windows game development list. DirectX is as
unpopular there as it is in the linux world for 3D graphics. This WAS a
long time ago (around DX5) time but I wouldn’t think DX7 has improved
much. (could be wrong though).

I’ve avoided it myself. SDL covers the parts of directX I’d rather not
deal with (networking, devices, …) and OpenGL is about the nicest 3D api
I’ve seen.

Oh, and as a last comment, the window hints don’t do anything if the
system can’t support it. This can NOT be said about directx.
As I may run the same program in both fbdev and X without error, I’d
rather not see a fatal exception just 'cause fbdev has no window
hints. Or any windows for that matter.

fbdev is the kernel graphics interface to linux. Works great - less
overhead. Sure wish I could get Mesa to recognise my patched glide with
fbdev support :slight_smile: (mixing X-4.0/DRI/3dfx + fb/3dfx+glide is not good for
one’s health if one wants accelerated opengl under fb/3dfx)

Ah welll…
G’day, eh? :slight_smile:
- Teunis

PS: on the wine note - when I’ve actually gotten a windows game to work
(okay, my X is weird), generally windows 3D directX apps run more
efficiently and stably under wine than they do under windows with native
drivers… As an explanation I suspect the 3dfx/linux drivers are
considerably more efficient and stable than the 3dfx/windows. I have a
3dfx/Banshee btw.On Sat, 18 Nov 2000, Michael Day wrote:


Teunis of Northurrokheim, of the Free Company of Northurrok
Humbly Proud Member of the Musketeers of m’lady Ovidia of Vingaard.

Trying to bring truth from beauty is Winterlion.
find at this winterlions’ page

Oh come on! Your comparing window manager hints to an entire multimedia API?
Cross platform doesn’t mean everything works identically on every platform
but you must also apply the age old rules of common sense. Do you think people
would find it acceptable if the game worked fine on windows, but lacked sound,
video, input and networking on every other platform (except the Dreamcast, of
course)?On Sat, Nov 18, 2000 at 06:00:37PM +1100, Michael Day wrote:

OpenGL is a platform independent 3D API. DirectX is extremely windows centric.
SDL is designed as a cross-platform lib, including DirectX support would break
that.

Yet SDL has other things (such as window manager hints) that will only
affect some platforms. Cross platform doesn’t mean everything works
identically on every platform.

Michael


Martin

Bother said the Moderator, &$&^%NO CARRIER

Oh come on! Your comparing window manager hints to an entire multimedia API?
Cross platform doesn’t mean everything works identically on every platform
but you must also apply the age old rules of common sense. Do you think people
would find it acceptable if the game worked fine on windows, but lacked sound,
video, input and networking on every other platform (except the Dreamcast, of
course)?

Relax. :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

I spent a few months on a windows game development list. DirectX is as
unpopular there as it is in the linux world for 3D graphics. This WAS a
long time ago (around DX5) time but I wouldn’t think DX7 has improved
much. (could be wrong though).

Nonetheless, if you develop a Windows game you need to use DirectX. And if
you’re not as well known as John Carmack, publishers are not sympathetic
when you refuse to support Direct3D because you find it offensive.

I’ve avoided it myself. SDL covers the parts of directX I’d rather not
deal with (networking, devices, …) and OpenGL is about the nicest 3D api
I’ve seen.

Right, likewise. But it sure would be nice if people could use SDL to
abstract away everything apart from the 3d, as I’m quite happy to write a
quick abstraction layer over OpenGL and Direct3D immediate mode. It’s
getting bogged down with window handling and surface management that
worries me, as all of that is handled nicely by SDL already.

Consider an SDL_DIRECT3D option to SetVideoMode and a
SDL_Win_GetDirect3D() function that returns a void pointer, for example.
Such a function would return NULL on every other platform. Note that
OpenGL would also need such a function, if it didn’t store its state in
some magical thread specific location and rely on global functions to
access it. So it’s not really a concession to Windows, but merely allowing
the same support as already exists (and has proved very useful) for
OpenGL.

Michael

Michael Day wrote:

Right, likewise. But it sure would be nice if people could use SDL to
abstract away everything apart from the 3d, as I’m quite happy to write a
quick abstraction layer over OpenGL and Direct3D immediate mode. It’s
getting bogged down with window handling and surface management that
worries me, as all of that is handled nicely by SDL already.

Consider an SDL_DIRECT3D option to SetVideoMode and a
SDL_Win_GetDirect3D() function that returns a void pointer, for example.

This doesn’t belong into SDL. There is no SDL_GTK either e.g… What you want to
do if you want to use SDL but still abstract rendering is to get access to the
window handle and device context and all this fancy things so you can init D3D
yourself. There are some hooks for that in SDL so maybe those could be extended
a bit if they are not sufficient.–
Daniel Vogel vogel at lokigames.com
Programmer 714-505-8915 x17
Loki Software www.lokigames.com

This doesn’t belong into SDL. There is no SDL_GTK either e.g… What you want to
do if you want to use SDL but still abstract rendering is to get access to the
window handle and device context and all this fancy things so you can init D3D
yourself. There are some hooks for that in SDL so maybe those could be extended
a bit if they are not sufficient.

Hmm well there is a lot of SDL_GL_* stuff, and SDL is quite happy about
initialising OpenGL for the user’s benefit. Which hooks are there for
retrieving the necessary information and doing it manually?

Michael

OpenGL is a platform independent 3D API. DirectX is extremely windows centric.
SDL is designed as a cross-platform lib, including DirectX support would break
that.

Yet SDL has other things (such as window manager hints) that will only
affect some platforms. Cross platform doesn’t mean everything works
identically on every platform.

That’s kind of like saying “Gee, windows has open() function and so does
unix, so the fact that unix can open devices this way means that cross
compatibility is kept” wry grin

Seriously folks - on one side it’d be kind of useful to have a DirectX
emulation layer going to make those windows freaks shut up (sorry,
couldn’t resist a jab)… maybe borrow from wine? grin

I spent a few months on a windows game development list. DirectX is as
unpopular there as it is in the linux world for 3D graphics. This WAS a
long time ago (around DX5) time but I wouldn’t think DX7 has improved
much. (could be wrong though).

Yep. :slight_smile:

I’ve been hanging around a games programming board for a good while
now, and tt seems to be about 50/50 OpenGL/DirectX nowadays.

The general view is that Direct3D is cutting edge and supports all new
features, while OpenGL is almost as fast, nicer to program and
portable.

(“Portable” becomes a lot more important if you can’t afford hiring
one or two programmers just to port your ultra-optimized Direct3D
engine to OpenGL… Speed is less interesting unless you need an
extra 2% for benchmarketting your engine - the difference is usually
in that range; careful engine design is more important.)

I’ve avoided it myself. SDL covers the parts of directX I’d rather not
deal with (networking, devices, …) and OpenGL is about the nicest 3D api
I’ve seen.

Well, they say DirectX 8 is nicer than the previous versions, but I’m
not going anywhere… Besides, I’m not (yet) serious enough about
frame rates to benchmark DirectX vs. OpenGL on all the major cards,
and the speed difference between a well optimized D3D engine and a
dito OpenGL is insignificant for all practical matters. Actually, if
the OpenGL version is slower, it’s a rather safe bet to blame it on
the drivers!

PS: on the wine note - when I’ve actually gotten a windows game to work
(okay, my X is weird), generally windows 3D directX apps run more
efficiently and stably under wine than they do under windows with native
drivers… As an explanation I suspect the 3dfx/linux drivers are
considerably more efficient and stable than the 3dfx/windows. I have a
3dfx/Banshee btw.

Quite likely; many cards have crappy Windows drivers for non-DX
APIs… (That’s why OpenGL has gotten a rumor of being slower than
D3D. Can’t see why it would be if properly implemented. Then again
I’m not a professional 3D programmer, nor very fluent in D3D. :slight_smile:

//David

.- M u C o S -------------------------. .- David Olofson --------.
| A Free/Open Source | | Audio Hacker |
| Plugin and Integration Standard | | Linux Advocate |
| for | | Open Source Advocate |
| Professional and Consumer | | Singer |
| Multimedia | | Songwriter |
-----> http://www.linuxdj.com/mucos -'—> david at linuxdj.com -'On Sat, 18 Nov 2000, winterlion wrote:

On Sat, 18 Nov 2000, Michael Day wrote:

OpenGL is a cross-platform API.On Sun, Nov 19, 2000 at 09:18:05PM +1100, Michael Day wrote:

Hmm well there is a lot of SDL_GL_* stuff, and SDL is quite happy about
initialising OpenGL for the user’s benefit. Which hooks are there for

Martin

Bother said the Moderator, &$&^%NO CARRIER

Hmm well there is a lot of SDL_GL_* stuff, and SDL is quite happy about
initialising OpenGL for the user’s benefit. Which hooks are there for
retrieving the necessary information and doing it manually?

Take a look at SDL_syswm.h, you can retrieve the window handle, and if
you need more information (maybe specific to the DirectX driver), let
me know. An example of using this interface is available at:
http://www.libsdl.org/projects/scrap/

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

I spent a few months on a windows game development list. DirectX is as
unpopular there as it is in the linux world for 3D graphics. This WAS a
long time ago (around DX5) time but I wouldn’t think DX7 has improved
much. (could be wrong though).

Nonetheless, if you develop a Windows game you need to use DirectX. And if
you’re not as well known as John Carmack, publishers are not sympathetic
when you refuse to support Direct3D because you find it offensive.

Actually, I don’t support Direct3D because I find it unusable. This is
entirely different from disliking it. If it were a usable system I’d
probably find a way to emulate it on platforms that didn’t have it like I
did with OpenGL a long time ago :slight_smile: (Long story, and I’m much happier with
Mesa than my own opengl :slight_smile:

hrm. At the moment I don’t have any access to a directx API (haven’t
bothered downloading the @%@%@#% beasty) so I wouldn’t know. (I also
don’t know how it’s tied into an application either)

Well, if you could prove that either:
A. It’s feasible for SDL to support Direct3D -without- breaking on
-any- platform
B. It’s worth the bother to write an emulation layer

It might be worth it. From what I’ve seen of the list though, it’s
you have to prove as pretty much there’s no acceleration API’s built into
SDL at this point. If you want to be REALLY helpful, find a way this
could be done :slight_smile:

And although John Carmack led the anti-direct3d crowd, he made enough of a
splash that vendors listened. And OpenGL’s a core component in NT/2000
anyways as well… Personally I don’t think the holy war about the two is
really an issue.

But what can I say? I’m a linux programmer moving to export stuff to the
windows and macintosh world, not a windows-centric programmer. I -like-
standards. And for me Directwhatever is not a standard, but SDL and
OpenGL are :slight_smile:

G’day, eh? :slight_smile:
- TeunisOn Sun, 19 Nov 2000, Michael Day wrote:

Michael Day wrote:

This doesn’t belong into SDL. There is no SDL_GTK either e.g… What you want to
do if you want to use SDL but still abstract rendering is to get access to the
window handle and device context and all this fancy things so you can init D3D
yourself. There are some hooks for that in SDL so maybe those could be extended
a bit if they are not sufficient.

Hmm well there is a lot of SDL_GL_* stuff, and SDL is quite happy about
initialising OpenGL for the user’s benefit. Which hooks are there for
retrieving the necessary information and doing it manually?

Don’t know. I just know there are some. E.g. the SDL/ GTK integration uses some
hooks IIRC. Have a look at the source/ docs ;)–
Daniel Vogel vogel at lokigames.com
Programmer 714-505-8915 x17
Loki Software www.lokigames.com

Well I can’t say that Direct3D is cut down for Dreamcast, it is basically
very bad for coding on the Dreamcast, if you ask me. Better Alternative is
to use the Sega Libs… With one exception: If you like to port games from M$
to Dreamcast.

Besides that… I prefer OpenGL infront of Direct3D … Simply because it is
as mentioned before… Platform independent.

But you 're right that Direct3D for DC basically exits :slight_smile:

“Martin Donlon” schrieb im Newsbeitrag
news:20001118181906.B16263 at csn.ul.ie

Oh come on! Your comparing window manager hints to an entire multimedia
API?
Cross platform doesn’t mean everything works identically on every
platform
but you must also apply the age old rules of common sense. Do you think
people
would find it acceptable if the game worked fine on windows, but lacked
sound,
video, input and networking on every other platform (except the Dreamcast,
of
course)?

OpenGL is a platform independent 3D API. DirectX is extremely windows
centric.

SDL is designed as a cross-platform lib, including DirectX support
would break> On Sat, Nov 18, 2000 at 06:00:37PM +1100, Michael Day wrote:

that.

Yet SDL has other things (such as window manager hints) that will only
affect some platforms. Cross platform doesn’t mean everything works
identically on every platform.

Michael


Martin

Bother said the Moderator, &$&^%NO CARRIER