mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Add face culling exercise1 to repo.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
float vertices[] = {
|
||||
// back face
|
||||
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left
|
||||
0.5f, -0.5f, -0.5f, 1.0f, 0.0f, // bottom-right
|
||||
0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right
|
||||
0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right
|
||||
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left
|
||||
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left
|
||||
// front face
|
||||
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left
|
||||
0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right
|
||||
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-right
|
||||
0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right
|
||||
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left
|
||||
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f, // top-left
|
||||
// left face
|
||||
-0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-right
|
||||
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-left
|
||||
-0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-left
|
||||
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-left
|
||||
-0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-right
|
||||
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right
|
||||
// right face
|
||||
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left
|
||||
0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right
|
||||
0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right
|
||||
0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right
|
||||
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left
|
||||
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left
|
||||
// bottom face
|
||||
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right
|
||||
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left
|
||||
0.5f, -0.5f, -0.5f, 1.0f, 1.0f, // top-left
|
||||
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left
|
||||
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right
|
||||
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right
|
||||
// top face
|
||||
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left
|
||||
0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right
|
||||
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right
|
||||
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right
|
||||
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, // bottom-left
|
||||
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f // top-left
|
||||
};
|
||||
|
||||
/* Also make sure to add a call to OpenGL to specify that triangles defined by a clockwise ordering
|
||||
are now 'front-facing' triangles so the cube is rendered as normal:
|
||||
glFrontFace(GL_CW);
|
||||
*/
|
||||
Reference in New Issue
Block a user