Skip to content

Renderer

Alegruz edited this page Apr 16, 2021 · 7 revisions

Render Process

Init

  1. Set error callback (UNIX GLFW)
  2. Initialize Dependencies (UNIX GLFW)
  3. Initialize Window
  4. Initialize Device

InitWindow

  1. Register Class (WIN32 WNDCLASSEX)
  2. Create Window
  3. Show Window (WIN32 ShowWindow)
  4. Set Callbacks (UNIX GLFW)
    • Window Size
    • Key
    • Char
  5. Make Context Current (UNIX)
  6. Initialize Dependencies (UNIX GL3W)

InitDevice

  1. Set up Vertices and Indices
  2. Create Buffer (for vertices and indices. glCreateBuffer)
  3. Bind Buffers (GL_ARRAY_BUFFER for vertices and GL_ELEMENT_ARRAY_BUFFER for indices. glBindBuffer)
  4. Store Buffers (glNamedBufferStorage)
  5. Compile Shaders
  6. Load Textures (lodepng)
  7. Create Textures (glCreateTextures)
  8. Bind Texture (glBindTextureUnit)
  9. Get uniform location for Texture (glGetUniformLocation)
  10. Set Texture Parameters (glTextureParameter*)
  11. Store Texture (glTextureStorage2D)
  12. Create Image (1glTextureSubImage2D`)
  13. Generate Mipmap (glGenerateTextureMipmap)
  14. Get uniform location for Texture and set (glUniform*)
  15. Create Vertex Arrays (glCreateVertexArrays)
  16. Send vertex data to vertex shader (glVertexAttribPointer)
    • position
    • texture coordinate

Render

  1. Clear buffer (glClearBuffer*)
  2. Bind Texture Unit (glBindTextureUnit)
  3. Bind Vertex Array (glBindVertexArray)
  4. Bind Buffers (glBindBuffer. bind element array buffer)
  5. Draw (glDrawArrays, glDrawElements)
  6. Swap buffers (glfwSwapBuffers)

Destroy

Clone this wiki locally