0
$\begingroup$

Good people of the graphics SO community, I am new to Graphics programming or GPU programming in general but I have been a game dev enthusiast for over 4-5 years. I started learning about Graphics finally.

I decided to start working on a very very basic 3D first-person game that can run on my Steam Deck, a Linux computer (most commonly used basic distros), a Windows computer (especially 8, 10, and 11), and MacOS (not super bullish on this).

So I learned about a bunch of APIs like OpenGL, Vulkan, and DirectX (I know some of them are technically not APIs but specifications, or not, please correct me on this) and I came across some forums that convey the support of these APIs in different OS types, but the answers are biased towards the specificity of one or two particular OSes mentioned in the questions.

I'd really appreciate it if someone gave advice on which API/Specification(s) to learn to work on a basic game like this one - https://jblaha.art/sketchbook/latest and that has support on all the devices/OSes mentioned above.

Thank you so much in advance.

(p.s. I already started learning OpenGL from https://learnopengl.com/ and I'd be glad to use this for my game. But I would learn a different one if I'm advised to do so.)

$\endgroup$
6
  • 1
    $\begingroup$ Welcome to Computer Graphics Stack Exchange! You are right, there are different "API/Layouts" that work on different operating systems. If you focus only on Windows and Linux, it's very simple: you can use OpenGL or Vulcan. MacOS brings the difficulties... They have their own graphics library (Metal) and they have dropped support for OpenGL, see stackoverflow.com/questions/65802625/… $\endgroup$
    – Thomas
    Commented Mar 20 at 7:33
  • 1
    $\begingroup$ However, you can do a double implementation, which means that you create a superclass from which you can derive two classes (e.g. OpenGL and Metal). The API calls should then only be within methods of this class $\endgroup$
    – Thomas
    Commented Mar 20 at 7:35
  • 1
    $\begingroup$ There are also game engines instead of graphic libraries (APIs). Some of these game engines are cross platform. In addition, many techniques such as shadows, collision detection or physics are already implemented... $\endgroup$
    – Thomas
    Commented Mar 20 at 10:06
  • $\begingroup$ Thank you for the detailed response @Thomas, I appreciate it. The reason I'm not using a Game Engine is because I want to learn how to make a game engine with minimal features which I want to build as needed for my game. The Superclass method you described is a great idea. I will abstract away the API layers in their own classes so I can implement different methods for different devices $\endgroup$
    – Prav
    Commented Mar 20 at 21:40
  • 1
    $\begingroup$ Abstracting the API layers is not as easy as you might think... Before you start, you need to understand how the graphics APIs you're using work... There is a lot to consider $\endgroup$
    – Thomas
    Commented Mar 21 at 7:24

1 Answer 1

2
$\begingroup$

The choice of which API to use is less important then the concepts and methods that the API's are designed to implement. Once you understand the basic graphics concepts and how to implement them using any API, then it is fairly straight forward to implement the same thing in a new API.

Since you are interested in cross-platform you may want to stay away from DirectX as it is more for Xbox and the PC. OpenDX, and other "layers" are available for Linux but I wouldn't recommend using them by someone just getting started as they can have undocumented API limitations and bugs.

Choosing which API to use is fairly subjective. There is good documentation and support for all the API's and you may want to write a few simple test programs using each of the interfaces you are considering to see which one is a good fit for you.

How strong your programming skills are, and what programming language you are planning to use can also be a deciding factor. A strong C++ programmer will likely pick up Vulkan more easily then someone new to the language, while OpenGL can be easier for someone new to programming in general. OpenGL and its interface is also available in more languages, like python, and WebGL. Again, I recommend trying out some simple programs to see which is a good fit.

There is nothing wrong with writing a game using one of the scripting languages because it allows you to focus on the concepts more then the code. And it can abstract some of the more difficult concepts away. Then when you start hitting the limitations of the format, move on to a more expressive language like Rust, C or C++.

$\endgroup$
1
  • $\begingroup$ Thank you for the detailed explanation. This clears things up a lot for me and also aligns with my findings from my online research. I decided I would go with OpenGL and C++. I am good at C++ but I'd like to get things up and running as soon as possible. And so far OpenGL seems to be working well with WIndows and Linux for basic graphics. $\endgroup$
    – Prav
    Commented Mar 22 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.