Graphics‎ > ‎Graphic API‎ > ‎

OpenGl

glEnable(GL_EPIC);

OpenGL (Open Graphics Library) is a API for rendering 2D and 3D graphics. It's is available in a number of versions and on many platforms. These pages aim for version 4.3.

The Basic Stuff
OpenGl is a state machine and the state is stored in the context of OpenGL and the objects created in the context. By using functions you can modify the state in the context or the objects and by setting objects as active you can change many states at the same time. When drawing something it is using the current state to decide what shows up on the screen. OpenGL use the prefix gl for OpenGL commands. Constants begin with GL_ and use all capital letters. Some functions comes in many versions and they then use suffix to specify the number of arguments and the return type. Ex glColor3f takes 3 floats and glColor4d takes four double. Opengl objects are namned using GLuint values. Values are reserved using the glGen* and deleted with dlDelete*. The resulting name can be any value besides 0 and they are then with glBind*. There is also a function glIs* that can be used to check if a opengl object is of a specific type.

void glGen*(GLsizei n​, GLuint *arrays​);
GLboolean glIs*(GLuint array​);
void glBind*(GLuint array​);
void glDelete*(GLsizei n​, const GLuint *arrays​);

Guide
  • Buffers: Buffer objects are used to store data that one use in or get from opengl.
  • Textures: These contains one or more images and they are used for texture access from a shaders or used as a render target.
  • Shaders:
  • GLSL: The shading language used in OpenGL.
  • Drawing: Rendering can be indexed (*elements) or non-indexed (*arrays).
  • Framebuffer: Select what to draw to.
Software