EAGL.Examples.LearnOpenGL.GettingStarted.TexturesExercise3 (eagl v0.9.0)
View SourceLearnOpenGL 4.5 - Textures Exercise 3
This exercise demonstrates texture flipping by manipulating texture coordinates. Common variations include horizontal flipping, vertical flipping, or rotating textures through coordinate transformation.
Original C++ Source
This example is based on the original LearnOpenGL C++ tutorial exercises: https://github.com/JoeyDeVries/LearnOpenGL/tree/master/src/1.getting_started/4.5.textures_exercise3
Exercise Focus
This exercise demonstrates:
- Texture Flipping: Inverting texture coordinates to flip images
- Coordinate Manipulation: How to transform texture space
- Visual Transformations: Creating mirrored or rotated effects
- Creative Control: Using coordinates for artistic effects
EAGL Implementation
This implementation demonstrates horizontal flipping by reversing the S (horizontal) texture coordinates:
@vertices [
# positions # colors # texture coords (horizontally flipped)
0.5, 0.5, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, # top right -> top left
0.5, -0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, # bottom right -> bottom left
-0.5, -0.5, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, # bottom left -> bottom right
-0.5, 0.5, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0 # top left -> top right
]
Key Learning Points
- Coordinate Transformation: How to manipulate texture coordinates
- Flipping Techniques: Horizontal and vertical texture flipping
- Visual Effects: Creating mirrored or transformed appearances
- Creative Applications: Using coordinate manipulation for artistic control
Usage
EAGL.Examples.LearnOpenGL.GettingStarted.TexturesExercise3.run_example()
Press ENTER to exit the example.