Sign in to follow this  

Directx or OpenGL

This topic is 402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Dirextx or Opengl is better.for windows? ps: i know.c++ and javara and using dev++ or virtual studio.
Also i know with a game engine itll be easier but i prefer to do it from scratch :)

Share this post


Link to post
Share on other sites
Okay so this debate will cause alot of controversy mainly because neither is really "better" both are low level APIs that communicate with the GPU to submit triangles and buffers. Open gl is full of awkward depreciation but it's not too bad really. Directx is a bit more solid but documentation can sometimes be wrong otherwise its fine.

The answer mainly comws down too needs, you only want to target windows? The n directx for sure. Want to target other platforms then you will need open gl. Open gl es and other platforms specific APIs like Sony uses gnm I believe.

I'm building a multi-api engine, I'd suggest doing the same cause then you can use any API with your engine, essentially make the engine in depednet to the api.

And for me personally visual studio.

PS , wouldn't from scratch mean building yoru own rasterizer (barycentric coordinates etc) ?

Share this post


Link to post
Share on other sites

I do both, which has some advantages including being able to read books written for both. I do DX11 and OGL4 (haven't learned Vulkan of DX12 yet, which take things to a whole new level [mostly multi-threading]). And I do 3D and never 2D, not because there's anything wrong with 2D - I just don't do it and so couldn't really say much about what it's like in either of these environments although they both seem a bit over-kill for 2D in general. There's been a book or two written for DX more than OGL. Once you really "get" one, it shouldn't be that hard to get the other.

 

I find DX to be a bit more complicated, but then when I do DX, I don't use libraries. Everything is from scratch unless it's part of DX, Win32, STL, or C++. I use whatever libraries are available for OGL, which I find makes OGL WAY easier. OGL, because of the libraries, is more like using something higher level like XNA/MonoGame.

 

DX in some ways discourages the use of libraries. Right from the start, when you do DX it's always in Windows and you're not going to support any non-Microsoft platform, so you might as well connect directly to the OS with Win32 or WinRT or whatever. (I do Windows 7 and not 8 or 10, which is part of the reason I'm not doing DX12).

 

The main reason I use libraries like crazy with OGL is because of multi-platform support. I'm not going to learn how to make calls to every operating system out there. Learning Win32 was trouble enough. I can't imagine learning that all over again for Mac, Linux (which strongly discourages it because all the Linux C++ programmers I've found want multi-platform development), Android, and whatever else is out there. Instead, I can just link in GLFW and it can deal with whatever OS the code is running on. That alone, makes OGL a whole lot easier when you're getting started. It was good experience learning to talk directly to the OS, but now that I've done that, I'm not too concerned about using a library especially since I gain multi-platform support.

 

So, with the libraries, I find OGL to be a lot easier to learn. The hard part is finding good lessons for it. I find the Khronos Group literature to be "not very helpful". I've been reading Orange Book and it's like reading a dictionary in order to learn a language; you probably want to have a dictionary on your shelf when you need more information on something,  but learning from it is difficult to say the least. If I had not already learned 3D game programming in two previous environments, I would have been so lost with OGL even though it's actually significantly easier. Someone pointed out a really good website for learning OGL.and I've been pointing people to it every since. I haven't had time to actually go completely through it, but at a glance it looks really good.

 

DX too can be tough to learn, especially if you don't use libraries. But at least there are a few decent books out there for it like this one, which is extremely technical but detailed (and probably more of an intermediate if not advanced book), or this one which is kind of the standard for learning DX (and you could even jump straight into DX12 with his DX12 book if you have Win10 and a DX12 card, although he avoids the subject of multi-threading which is kind of the whole point of using DX12 over DX11).

 

OGL and DX both do basically the same thing. You're probably going to be doing C++ with either of them, although technically you can use other languages with either. Knowing both helps you read books written on game programming that may use either one and shader books that are written for HLSL, or GLSL.

 

Then there's also which vision of the future you want to support: one that believes they need to install their ransom-ware on your computer in the middle of the night whether you want it or not and license your life back to you for you to rent from their cloud, or the other that believes in open source software and freedom. It appears PC's powerful enough for gaming are becoming toys for hobbiests while the world buys dumb terminals to access their life in the clouds. Reminds me of the old days when personal computers were for the die hard hobbiests and mainframes were where the real work was done. What does this mean for the future of low level PC game programming? In the future, will you be able to write games for anything commercial without going through an engine? Will Microsoft completely drop DX like they dropped XNA? How does DX even work in the cloud? I suppose that's something to consider.

 

In the end, you'll have to make your own decision about which way to go. You might start with OGL from that link I posted above. Once you get the basic concepts down on how to manipulate things with matrices and vertex buffers and such, you'll be doing basically the same thing in DX. So, learning DX will go a whole lot smoother, although until you learn to talk to the OS with Win32 or whatever, it may be confusing as to what's Win32 and what's DX. (You don't necessarily have to learn a lot of Win32 as all you really need from Windows is a process, a window, and a very small attachment to the even loop for the most part. It's just that you'll probably have to study Win32 much deeper than that to understand why you wrote that small amount of code.) And you don't necessarily have to go as hard-core with DX as I did and write your own model class and stick with DDS textures because that's the only thing DX natively supports. You can use Assimp and an image library like FreeImage whether you're using OGL or DX. It's just that in my opinion, if you're gonna do DX you're doing it because you want to learn how to do things for yourself at the lowest level, and that purpose is defeated if you start using libraries. If you're not there to learn things at the lowest level, you could be using Unity where everything is done for you and you could be getting far more actually accomplished towards writing actual games. I learned things at the lowest level with DX, then took it up a level and started using libraries to do those same things with OGL. That way if I don't like the library, I can write my own, but the library saves time and whatnot while still giving me low enough level access to learn new things at a low level.

 

So, I guess my recommendation is to learn both. Pick one and get started. :-)

Edited by BBeck

Share this post


Link to post
Share on other sites

PS , wouldn't from scratch mean building yoru own rasterizer (barycentric coordinates etc) ?

No. If you want to get pedantic (like I do all the time), "from scratch" would be using stone tools to mine and smelt your own ore for the circuit board, or at the very least hard wiring your own rasterizer. ;-)

 

But in DX, or especially OGL, you'll learn how the rasterizer does it's job and all the math behind it. So, "from scratch" could generally mean understanding all the math and algorithms at their lowest possible level outside of writing your own operating system or building your own graphics card and writing a driver for it.

 

There's a world of difference between Unity and OGL or DX. It's like a totally different way of thinking. So, I think it's fair to characterize OGL or DX as being "from scratch" as opposed to Unity where you can pretty much buy everything from the Unity Asset Store and assemble it without making anything yourself. (Not knocking Unity there, although that's a very real danger - that you won't actually learn anything by buying components and assets - and you may be completely lost if you have to debug components that were never designed to work with one another in the first place. You can easily get lost in the "weeds" studying OGL or DX and not ever get a single game actually put together. So, they all have their advantages and disadvantages.)

Share this post


Link to post
Share on other sites

For your first API, and given the fact that in the OP Windows is specified, I suggest Direct3D; specifically Direct3D 11.  Of course in the longer term you should learn both, but Direct3D 11 is a better modern(ish) API to start with.

 

Reason 1 is that tool and GPU support for it is well established and absolutely robust.  Even today it's possible to get a GPU that doesn't support the latest OpenGL; that just doesn't happen with Direct3D 11.

 

Reason 2 is that OpenGL is a mess of deprecation, legacy API features and multiple code paths to do the same thing.  Even in core GL 4.5 you still get this: consider DSA vs non-DSA, immutable vs mutable storage, sampler objects vs texture parameters, etc.  Mix in legacy GL and you're just going to have a more difficult time identifying the API calls you should be learning vs those you shouldn't.  You don't get that with D3D 11 - it typically offers just one way of doing things.

 

Of course OpenGL gives you multi-platform, but since the OP has specified Windows that doesn't apply.  OpenGL is also not a magic bullet to multi-platform support; you still need to deal with platform-specific code for windowing, memory, sound, networking, input, etc; something that multi-platform proponents seem to frequently forget.

 

Once you've learned Direct3D 11 you can then go learn OpenGL, and so long as you learn the equivalent GL calls to what you're using in Direct3D 11 you shouldn't stray too far from the modern API.

Share this post


Link to post
Share on other sites

Than k you all, i want to make a 3D mmo, so from what u rsaying ill choose Direct 3D( is it the same with DirectX ?) also with which program can i make the 3D models? Ive been using Sketch Up, but i dont know if its compatible with D3D. also i know C++, but can i write scripts with java inside the game ? and make some files with XML to be static rather than using MySQL? thx in advance

Share this post


Link to post
Share on other sites

sry fordouble post , but which directx is the best to use? ive seen that directx11 is the simpliest and with most factions

Directx SDK (June 2010) is the directx 10?

Edited by alextoti99

Share this post


Link to post
Share on other sites

Than k you all, i want to make a 3D mmo, so from what u rsaying ill choose Direct 3D( is it the same with DirectX ?) also with which program can i make the 3D models? Ive been using Sketch Up, but i dont know if its compatible with D3D. also i know C++, but can i write scripts with java inside the game ? and make some files with XML to be static rather than using MySQL? thx in advance

 

Err okay so i think you may be getting ahead of yourself, building an engine is no easy task its quite complicated before you start you need to cover trigonometry and linear algebra and 100% cover the core programming concepts and data structures/design patterns.  Put the mmo on the back peddle until you make a engine which could take a while.

You asked about compatibility between sketch up and D3D this shows a lack of understanding on what 3D representation really is so you need to cover that too, but to answer the question anything is compatible if you make it compatible i recently finished writing a binary converter which takes obj to my custom format. I will be expanding this to fbx and maybe even.blend basically any format can be converted if i write the converter for it.  With Directx or opengl there low level you can't just drop models in it and it work's you need to build EVERYTHING your-self from scratch as you said.

Sketch fab allows you to export in these formats so write a compiler for them: https://help.sketchup.com/en/article/3000153

For scripting yeah i believe you can use java it may need some embedding interpreter system though but someone else will answer this more adequately, mike mcshaffry game coding complete talks about lua scripting with engines seems to be the go too language and easily embedded into the engine. 

 

Share this post


Link to post
Share on other sites

also with which program can i make the 3D models? Ive been using Sketch Up, but i dont know if its compatible with D3D.

D3D/GL are low level ways to send code for execution on the GPU. They don't have the concept of a model - it's your job as an engine programmer to define what a model is and tell the CPU how to load the data into RAM and tell the GPU exactly how to draw it.

If you want to make a game instead of reinventing this low level stuff, then you should use an existing game engine like Unity or Unreal.

Share this post


Link to post
Share on other sites

Here are some useful books:

Game Engine Architecture

Mathematics for 3D game programming
Game programming Complete

D3D Rendering

 

Useful websites:
 

Math is fun

Scratch Pixel

 

Useful Frameworks for reference on how to structure a engine:

 

XNA

Hieroglyph 3

OGRE <- Alot reference this but i haven't really used it

 

Review object orientated programming because everything is an object really, like models, entities etc

Other advice wold be to look at the data look how things are represented, come up with a structure like models are stored as shared pointers in an asset manager and there passed to entities which contain reference to that model etc. Think a lot about architecture before you just dive in.

Share this post


Link to post
Share on other sites

thank you for this, so ill start with a simple game like worm :D, but is there any tutorial with direct3d or game engine? because im new to game developement

 
Engines like UE4 and Unity have large collections of tutorial videos and documentation that you can browse as you like. If you're already familiar with C++ and you're interested in using D3D then the best place to start right now would probably be Frank Luna's Introduction to 3D Game Programming with DirectX 11. If you don't want to commit to buying a book yet then you can find a lot of DX11 tutorials on Google.

Share this post


Link to post
Share on other sites

 

also with which program can i make the 3D models? Ive been using Sketch Up, but i dont know if its compatible with D3D.

D3D/GL are low level ways to send code for execution on the GPU. They don't have the concept of a model - it's your job as an engine programmer to define what a model is and tell the CPU how to load the data into RAM and tell the GPU exactly how to draw it.

If you want to make a game instead of reinventing this low level stuff, then you should use an existing game engine like Unity or Unreal.

 

DirectX 9 used to have okay mesh support, but in DirectX 10 & 11, those parts of D3DX were deprecated.  So you either need to write your own mesh loading code for whatever model formats you intend to use, or use something like Assimp, which has support for loading most of the common formats you'll see in the wild, albeit into their own idiosyncratic data format.  In either case, you will then need to bind to vertex and index buffers and handle textures and animations yourself to actually draw the models.

Share this post


Link to post
Share on other sites

Than k you all, i want to make a 3D mmo, so from what u rsaying ill choose Direct 3D( is it the same with DirectX ?) also with which program can i make the 3D models? Ive been using Sketch Up, but i dont know if its compatible with D3D. also i know C++,


DirectX 3D or D3D is the graphics portion of DirectX. Historically, DX has done many different things including input, sound, and math all of which have very little to do with graphics. OGL is much more strictly just graphics and DX seems to be moving in that direction.

 

Check out Blender for creating 3D models. It's free. You can use models from Sketch Up, but it's probably not the ideal choice. I started out using Sketch Up models when I first started out, but quickly switched to Blender.

 

There is nothing that is not compatible with DX. You're almost writing your own video driver at that point, especially when you are doing HLSL. If the computer is capable of doing it, DX is capable of doing it. But this means you will have to know how to do it because you'll have to teach the computer and DX how to do it. The limit is your imagination and ability.

Share this post


Link to post
Share on other sites

oh thank you all, the point is that i dont have the best pc :P, but i ofc i dont want to make a game with such good graphics like gta,assassins greed, etc.

Thx for giving me the tutorials too :D

Share this post


Link to post
Share on other sites
And the other thing although not related to this forum is how are you sourcing assets? Are you goign to sculpt characters your self in zbrush ? That's a big commitment as well if your trying to do an engine at the same time. Hint anatomy and cintiqu 22hd are required.

Think about the thing you want to concentrate on and maybe find others to handle other things?

Share this post


Link to post
Share on other sites

oh thank you all, the point is that i dont have the best pc :P, but i ofc i dont want to make a game with such good graphics like gta,assassins greed, etc.
Thx for giving me the tutorials too :D

Those games have great graphics because they spend literally millions of dollars on hiring the best artists to produce the best artwork.

I've got a decade of experience in writinf D3D/GL code, so I can do all the technical stuff that's required by those games, but even if I did, I cant afford to hire 100 talented artists to literally sculpt a beautiful world for me to render :o

Share this post


Link to post
Share on other sites

 

oh thank you all, the point is that i dont have the best pc :P, but i ofc i dont want to make a game with such good graphics like gta,assassins greed, etc.
Thx for giving me the tutorials too :D

Those games have great graphics because they spend literally millions of dollars on hiring the best artists to produce the best artwork.

I've got a decade of experience in writinf D3D/GL code, so I can do all the technical stuff that's required by those games, but even if I did, I cant afford to hire 100 talented artists to literally sculpt a beautiful world for me to render :o

 

 

Still that is not a guarantee for delivering a "good" game.

Share this post


Link to post
Share on other sites

one each from NVidia/AMD/Intel

Apple also implements their own drivers, if you choose to use OpenGL on Apple devices.
I was just there talking with their driver team and I left this on their doorstep.
[attachment=33838:IMG_0112.jpg]


L. Spiro

Share this post


Link to post
Share on other sites

Take blade and soul as an example, they have decent graphics despite it being developed in 2012 and they used Unreal Engine 3

to make your own engine, that's for sure a lot easier and better for you to optimize your game, however making your own engine is also time consuming and requires a lot of knowledge and experience, so I personally would recommend using engine such as unreal engine 4 or cry engine (v5), they help you a lot and save you a lot of time, but in the future, it'll be hard for you to have the freedom to do whatever you want with your game such as optimzing, for example blade and soul uses dx9, which is very outdated and it focus only on one core cpu, which makes the game lag a lot, low fps, but now you have dx11 supported by the most known engines for best graphics games, so you won't really have a lot of problem optimizing ur game, optimizing one of the many problems you could face, but i mentioned it because i was giving you example of blade and soul and this is their biggest problem

Share this post


Link to post
Share on other sites

#1: We don’t lock topics just because you got an answer.

#2: Don’t use CryEngine.  As a previous developer on CryEngine (it’s so bad this is the first time I have admitted publicly that I worked on it), it has poor tool support and CryTech is likely going to go out of business soon.

Fact: You will be using Unreal Engine 4.

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites

This topic is 402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this