Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Do you need an opengl renderer to use opengl?


Asked by Dominik Giles on Dec 09, 2021 FAQ



The library comes with an OpenGL renderer rebuilt. But making a renderer is simple enough that you'll likely want to build a renderer specific to your game's render system.
Accordingly,
SDL_Rendereris something you need if you want to use the SDL API for drawing tasks, but it is not required if you just create the OpenGL context with SDL and do all the drawing directly with OpenGL. but the rendering is called via glClear(GL_COLOR_BUFFER_BIT);
In addition, OpenGL or “Open Graphics Library” provides developers with a wide array of functions to render 2D and 3D graphics. Although largely known for being an API or application programming interface, OpenGL on its own is just a specification that determines the output of each command. Introduction to OpenGL
Similarly,
Resource is shared between instances of different objects: Frequent case for things like textures, materials and shaders. Use a shared_ptr for them. Resource is explicitly owned by an instance of an object: In a renderer, this could apply to many types of things, from light sources to object transforms. Use a unique_ptr for those.
In respect to this,
Non-C/C++ language bindings can also handle these differently. There are two phases of OpenGL initialization. The first phase is the creation of an OpenGL Context; the second phase is to load all of the necessary functions to use OpenGL. Some non-C/C++ language bindings merge these into one. An OpenGL context represents all of OpenGL.