Skip to content

abzrg/opengl-sdl-glad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenGL + Glad + SDL2

OpenGL 4.1: glad.zip

Learning Resources

Winding order and front face

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.

Drawing a Quadrilateral

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.

Error handling

// 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);
//     }
// }

About

My journey in learning OpenGL

Resources

Stars

Watchers

Forks

Languages