MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / Mesh

Method Mesh

YoutubeOpenGL 27 - Normal Maps/Mesh.cpp:3–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "Mesh.h"
2
3Mesh::Mesh(std::vector <Vertex>& vertices, std::vector <GLuint>& indices, std::vector <Texture>& textures)
4{
5 Mesh::vertices = vertices;
6 Mesh::indices = indices;
7 Mesh::textures = textures;
8
9 VAO.Bind();
10 // Generates Vertex Buffer Object and links it to vertices
11 VBO VBO(vertices);
12 // Generates Element Buffer Object and links it to indices
13 EBO EBO(indices);
14 // Links VBO attributes such as coordinates and colors to VAO
15 VAO.LinkAttrib(VBO, 0, 3, GL_FLOAT, sizeof(Vertex), (void*)0);
16 VAO.LinkAttrib(VBO, 1, 3, GL_FLOAT, sizeof(Vertex), (void*)(3 * sizeof(float)));
17 VAO.LinkAttrib(VBO, 2, 3, GL_FLOAT, sizeof(Vertex), (void*)(6 * sizeof(float)));
18 VAO.LinkAttrib(VBO, 3, 2, GL_FLOAT, sizeof(Vertex), (void*)(9 * sizeof(float)));
19 // Unbind all to prevent accidentally modifying them
20 VAO.Unbind();
21 VBO.Unbind();
22 EBO.Unbind();
23}
24
25
26void Mesh::Draw

Callers

nothing calls this directly

Calls 3

BindMethod · 0.45
LinkAttribMethod · 0.45
UnbindMethod · 0.45

Tested by

no test coverage detected