samedi 18 septembre 2021

open gl c++ to builds 3d

so i have been looking around for how the GLfloat verts and the GLushort indices work together so i can make a pyramid

GLfloat verts[] = {
    // Vertex Positions t1    // Colors (r,g,b,a)
     0.0f, 1.0f, 0.0f,   1.0f, 0.0f, 0.0f, 1.0f, // Top Right Vertex 0
     -1.0f,-1.0f, 1.0f,   0.0f, 1.0f, 0.0f, 1.0f, // Bottom Right Vertex 1
     1.0f,-1.0f, 1.0f,   0.0f, 0.0f, 1.0f, 1.0f, // Bottom Left Vertex 2
     //t2
     0.0f,1.0f,0.0f,   1.0f, 0.0f, 1.0f, 1.0f, // Top Left Vertex 3
     1.0f, -1.0f, 1.0f,  0.5f, 0.5f, 1.0f, 1.0f, // 4 br  right
     1.0f,  -1.0f, -1.0f,  1.0f, 1.0f, 0.5f, 1.0f, //  5 tl  right
     
     0.0f, 1.0f, 0.0f   //V6(red)
     1.0f,-1.0f,-1.0f   //V7(green)
    -1.0f,-1.0f,-1.0f   //V8(blue)
     //Triangle 4
     0.0f, 1.0f, 0.0f   //V9(red)
    -1.0f,-1.0f,-1.0f   //V10(blue)
    -1.0f,-1.0f, 1.0f   //V11(green)
 
 
};

// Index data to share position data
GLushort indices[] = {
    0, 1, 2,  // Triangle 1
    0, 2, 3,   // Triangle 2
    0, 3, 4,  // Triangle 3
    0, 4, 5,  // Triangle 4
    0, 5, 6, // Triangle 5
    0, 5, 6,  // Triangle 6

};

Aucun commentaire:

Enregistrer un commentaire