Removed Static VBA/VAO from code

This commit is contained in:
OusmBlueNinja 2025-01-01 13:21:47 -06:00
parent f7f5ffa4e4
commit 195f7abbe0

View File

@ -33,157 +33,6 @@ extern std::shared_ptr<CameraComponent> g_RuntimeCameraObject;
extern int g_GPU_Triangles_drawn_to_screen; extern int g_GPU_Triangles_drawn_to_screen;
// Example cube data (position + UVs)
static float g_CubeVertices[] =
{
// FRONT (z=+1)
-1.f,
-1.f,
1.f,
0.f,
0.f,
1.f,
-1.f,
1.f,
1.f,
0.f,
1.f,
1.f,
1.f,
1.f,
1.f,
-1.f,
1.f,
1.f,
0.f,
1.f,
// BACK (z=-1)
-1.f,
-1.f,
-1.f,
1.f,
0.f,
1.f,
-1.f,
-1.f,
0.f,
0.f,
1.f,
1.f,
-1.f,
0.f,
1.f,
-1.f,
1.f,
-1.f,
1.f,
1.f,
// LEFT (x=-1)
-1.f,
-1.f,
-1.f,
0.f,
0.f,
-1.f,
-1.f,
1.f,
1.f,
0.f,
-1.f,
1.f,
1.f,
1.f,
1.f,
-1.f,
1.f,
-1.f,
0.f,
1.f,
// RIGHT (x=+1)
1.f,
-1.f,
-1.f,
1.f,
0.f,
1.f,
-1.f,
1.f,
0.f,
0.f,
1.f,
1.f,
1.f,
0.f,
1.f,
1.f,
1.f,
-1.f,
1.f,
1.f,
// TOP (y=+1)
-1.f,
1.f,
-1.f,
0.f,
0.f,
1.f,
1.f,
-1.f,
1.f,
0.f,
1.f,
1.f,
1.f,
1.f,
1.f,
-1.f,
1.f,
1.f,
0.f,
1.f,
// BOTTOM (y=-1)
-1.f,
-1.f,
-1.f,
1.f,
0.f,
1.f,
-1.f,
-1.f,
0.f,
0.f,
1.f,
-1.f,
1.f,
0.f,
1.f,
-1.f,
-1.f,
1.f,
1.f,
1.f,
};
static unsigned int g_CubeIndices[] =
{
// Front
0, 1, 2, 2, 3, 0,
// Back
4, 5, 6, 6, 7, 4,
// Left
8, 9, 10, 10, 11, 8,
// Right
12, 13, 14, 14, 15, 12,
// Top
16, 17, 18, 18, 19, 16,
// Bottom
20, 21, 22, 22, 23, 20};
bool PlayPauseButton(const char *label, bool *isPlaying, ImVec2 Size) bool PlayPauseButton(const char *label, bool *isPlaying, ImVec2 Size)
{ {
// Define button size // Define button size
@ -326,30 +175,6 @@ void RenderWindow::InitGLResources()
m_ShaderPtr = shaderAsset.get(); m_ShaderPtr = shaderAsset.get();
} }
// ----------------------------------------------------
// 2) Create VAO/VBO/EBO for the cube
// ----------------------------------------------------
glGenVertexArrays(1, &m_VAO);
glBindVertexArray(m_VAO);
glGenBuffers(1, &m_VBO);
glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_CubeVertices), g_CubeVertices, GL_STATIC_DRAW);
glGenBuffers(1, &m_EBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(g_CubeIndices), g_CubeIndices, GL_STATIC_DRAW);
// Position = location 0, UV = location 1
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,
5 * sizeof(float), (void *)0);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE,
5 * sizeof(float), (void *)(3 * sizeof(float)));
glEnableVertexAttribArray(1);
glBindVertexArray(0);
// ---------------------------------------------------- // ----------------------------------------------------
// 3) Load TEXTURE from the asset manager // 3) Load TEXTURE from the asset manager