Skip to content

Commit

Permalink
Some code ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Prtm2110 committed Jan 12, 2025
1 parent eef639b commit c47f252
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions Spraky-core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,22 @@ int main() {

std::cout << "Entering main loop..." << std::endl;
while (!window.closed()) {
std::cout << "Clearing window..." << std::endl;
window.clear();

std::cout << "Binding VAO ..." << std::endl;

window.clear();
vao.bind();
std::cout << "Binding IBO..." << std::endl;

ibo.bind();

// Check for OpenGL errors
GLenum error = glGetError();
if (error != GL_NO_ERROR) {
std::cerr << "OpenGL error before drawing elements: " << error << std::endl;
}

std::cout << "Drawing elements..." << std::endl;

glDrawElements(GL_TRIANGLES, ibo.getCount(), GL_UNSIGNED_SHORT, 0); // Use GL_UNSIGNED_SHORT

// Check for OpenGL errors
error = glGetError();
if (error != GL_NO_ERROR) {
std::cerr << "OpenGL error after drawing elements: " << error << std::endl;
}


vao.unbind();

std::cout << "Updating window..." << std::endl;

window.update();
}
delete vbo; // Clean up dynamically allocated memory

std::cout << "Cleaning up..." << std::endl;
delete vbo; // Clean up dynamically allocated memory
return 0;
}

0 comments on commit c47f252

Please sign in to comment.