0

I've checked numerous posts and tutorial about using OpenGL and C++. There is one thing that still bothers me. In each tutorial you have some additional library like GLFW, GLU, GLUT, WIN32 and so on (mostly used for window creation). Although I was unable to find some tutorial using only OpenGL. The only clue is this answer syaing that you need to use some library for this.

Can someone explain how it really is? How it looks when I want to use code on different operating systems? Is application code written with OpenGL 100% portable?

Community
  • 1
  • 1
sebap123
  • 2,541
  • 6
  • 45
  • 81

1 Answers1

3

You can't have a tutorial which uses only OpenGL just because it's an API which doesn't provide such functionality.

OpenGL is not meant to create a graphical context in an operating system and use it, it is meant only to work directly with the GPU through a set of defined functions.

So the main point is that what you are asking resides outside the purpose of OpenGL, which defines just a standard interface to graphical operations.

But many more or less complete libraries exist to handle this problem and you also quoted some, for example GLFW or SDL, which takes care of initializing the context and manage also additional issues (for example controls or sounds).

The product will be portable if a set of constraints is respected:

  • you are using a library which manages different OS for handling the graphical context (eg GLFW)
  • you are using an OpenGL profile which is supported by all the GPUs you mean to make your code work on
  • in case of portability between OpenGL and OpenGL ES you must ensure additional constraints since the latter managed certain things differently
Jack
  • 131,802
  • 30
  • 241
  • 343