Skip to content

Commit

Permalink
added doc string to verifyVAO() and removed example comment
Browse files Browse the repository at this point in the history
  • Loading branch information
helen-huang9 committed Sep 4, 2023
1 parent b53474a commit 1a431d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/glrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ void GLRenderer::initializeGL()

// Task 13: Verify your position and color attributes with our verifyVAO function

// Copy over your attributes from glVertexAttribPointer() to verifyVAO
// So the following function becomes:
// glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4, reinterpret_cast<void*>(0));
// verifyVAO(triangleData, 0, 2, 4, reinterpret_cast<void*>(0));
// If the function prints the values you would expect for position and color then you're good!

//std::cout << "Position Values" << std::endl;
//verifyVAO();
//std::cout << "Color Values" << std::endl;
//verifyVAO();

// ================== Returning to Default State

// Task 14: Unbind your VBO and VAO here
Expand Down
10 changes: 9 additions & 1 deletion src/glrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ class GLRenderer : public QOpenGLWidget
GLuint m_vbo; // Stores id of VBO
GLuint m_vao; // Stores id of VAO

void verifyVAO(std::vector<GLfloat> triangleData, GLuint index, GLsizei size, GLsizei stride, const void* offset) {
/**
* @brief verifyVAO - prints in the terminal how OpenGL would interpret `triangleData` using the inputted VAO arguments
* @param triangleData - the vector containing the triangle data
* @param index - same as glVertexAttribPointer()
* @param size - same as glVertexAttribPointer()
* @param stride - same as glVertexAttribPointer()
* @param offset - same as glVertexAttribPointer()
*/
void verifyVAO(std::vector<GLfloat> &triangleData, GLuint index, GLsizei size, GLsizei stride, const void* offset) {

int newStride = int(stride / 4);
int groupNum = 0;
Expand Down

0 comments on commit 1a431d2

Please sign in to comment.