OpenGL 4.1: glad.zip
- Introduction to OpenGL -- Mike Shah
- Learning Modern 3D Graphics Programming -- Jason L. McKesson (2012)
- docs.gl
- C++ OpenGL Function Call Wrapping
The position coordinates should be in the winding order. Winding order is the order our vertices are laid out. It can be clock-wise or counter-clockwise order. The winding order tells us which direction is the front of the triangle. It's similar to the right hand rule and that's because OpenGL by default uses a right handed coordinate system.
glFrontFace
allows one to specify which direction correspond to the front face.
A quadrilateral is consisting of two triangles.
In vertex specification we need two sets of three coordinate points.
Two vertices have the same coordinate but have to be specified separately.
We also need to specify that we are drawing 6 vertices in the call to glDrawArrays
.
// https://community.arm.com/arm-community-blogs/b/graphics-gaming-and-vr-blog/posts/easier-opengl-es-debugging-on-arm-mali-gpus-with-gl_5f00_khr_5f00_debug
// #ifdef _DEBUG
// #define CHECK_GL_ERROR() checkGLErrorAndPrint()
// #else
// #define CHECK_GL_ERROR()
// #endif
//
// void checkGLErrorAndPrint(void)
// {
// GLenum error = glGetError();
// if (error != GL_NO_ERROR)
// {
// std::cout << ("GL error detected: 0x%04x\n", error);
// }
// }