EAGL.Examples.LearnOpenGL.GettingStarted.HelloTriangleExercise1 (eagl v0.1.0)
View SourcePort of LearnOpenGL's Hello Triangle Exercise 1 to EAGL framework.
Original: https://learnopengl.com/Getting-started/Hello-Triangle (Exercise 1) Chapter 1, Section 2.3: Hello Triangle Exercise 1
Exercise: Try to draw 2 triangles next to each other using glDrawArrays by adding more vertices to your data.
This example demonstrates:
- Drawing multiple triangles with a single VAO/VBO
- Using glDrawArrays with 6 vertices (2 triangles)
- Positioning triangles side by side in normalized device coordinates
Key concepts:
- Two separate triangles defined by 6 vertices total
- Single draw call renders both triangles
- Left triangle: vertices 0-2, Right triangle: vertices 3-5
Run with: mix run -e "EAGL.Examples.LearnOpenGL.GettingStarted.HelloTriangleExercise1.run_example()"
Summary
Functions
@spec run_example() :: :ok | {:error, term()}