Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion GraphicsProject/Assignment-5/src/assignment-5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ int main()
// Give our vertices to OpenGL.
if (Vertices[i].size() > 0) {
glBufferData(GL_ARRAY_BUFFER, Vertices[i].size() * 3 * sizeof(float),
glm::value_ptr(Vertices[i][0]), GL_STATIC_DRAW);
glm::value_ptr(Vertices[i][0]), GL_STATIC_DRAW);
}

// Initialize line segment vertex Attributes
GLuint vertexattribute = glGetAttribLocation(lineshaderID, "VertexPosition");
glEnableVertexAttribArray(vertexattribute);
Expand Down
145 changes: 97 additions & 48 deletions GraphicsProject/Assignment-6/src/assignment-6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,22 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, teapot.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(teapot.Vertices()[0]), GL_STATIC_DRAW);
if (teapot.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, teapot.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(teapot.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, teapot.Normals().size() * 3 * sizeof(float),
glm::value_ptr(teapot.Normals()[0]), GL_STATIC_DRAW);
if (teapot.Normals().size() > 0)
{
glBufferData(GL_ARRAY_BUFFER, teapot.Normals().size() * 3 * sizeof(float),
glm::value_ptr(teapot.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -395,17 +400,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, phongsurface.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(phongsurface.Vertices()[0]), GL_STATIC_DRAW);
if (phongsurface.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, phongsurface.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(phongsurface.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, phongsurface.Normals().size() * 3 * sizeof(float),
glm::value_ptr(phongsurface.Normals()[0]), GL_STATIC_DRAW);
if (phongsurface.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, phongsurface.Normals().size() * 3 * sizeof(float),
glm::value_ptr(phongsurface.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -464,17 +473,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, dinisurface.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(dinisurface.Vertices()[0]), GL_STATIC_DRAW);
if (dinisurface.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, dinisurface.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(dinisurface.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, dinisurface.Normals().size() * 3 * sizeof(float),
glm::value_ptr(dinisurface.Normals()[0]), GL_STATIC_DRAW);
if (dinisurface.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, dinisurface.Normals().size() * 3 * sizeof(float),
glm::value_ptr(dinisurface.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -527,17 +540,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, kleinbottom.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleinbottom.Vertices()[0]), GL_STATIC_DRAW);
if (kleinbottom.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinbottom.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleinbottom.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, kleinbottom.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleinbottom.Normals()[0]), GL_STATIC_DRAW);
if (kleinbottom.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinbottom.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleinbottom.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -587,17 +604,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, kleinhandle.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleinhandle.Vertices()[0]), GL_STATIC_DRAW);
if (kleinhandle.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinhandle.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleinhandle.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, kleinhandle.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleinhandle.Normals()[0]), GL_STATIC_DRAW);
if (kleinhandle.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinhandle.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleinhandle.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -649,17 +670,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, kleintop.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleintop.Vertices()[0]), GL_STATIC_DRAW);
if (kleintop.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleintop.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleintop.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, kleintop.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleintop.Normals()[0]), GL_STATIC_DRAW);
if (kleintop.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleintop.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleintop.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -710,17 +735,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, kleinmiddle.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleinmiddle.Vertices()[0]), GL_STATIC_DRAW);
if (kleinmiddle.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinmiddle.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(kleinmiddle.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, kleinmiddle.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleinmiddle.Normals()[0]), GL_STATIC_DRAW);
if (kleinmiddle.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinmiddle.Normals().size() * 3 * sizeof(float),
glm::value_ptr(kleinmiddle.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -781,17 +810,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, kleinvertices3.size() * 3 * sizeof(float),
glm::value_ptr(kleinvertices3[0]), GL_STATIC_DRAW);
if (kleinvertices3.size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinvertices3.size() * 3 * sizeof(float),
glm::value_ptr(kleinvertices3[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, kleinnormals3.size() * 3 * sizeof(float),
glm::value_ptr(kleinnormals3[0]), GL_STATIC_DRAW);
if (kleinnormals3.size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinnormals3.size() * 3 * sizeof(float),
glm::value_ptr(kleinnormals3[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -850,17 +883,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, kleinvertices.size() * 3 * sizeof(float),
glm::value_ptr(kleinvertices[0]), GL_STATIC_DRAW);
if (kleinvertices.size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinvertices.size() * 3 * sizeof(float),
glm::value_ptr(kleinvertices[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, kleinnormals.size() * 3 * sizeof(float),
glm::value_ptr(kleinnormals[0]), GL_STATIC_DRAW);
if (kleinnormals.size() > 0) {
glBufferData(GL_ARRAY_BUFFER, kleinnormals.size() * 3 * sizeof(float),
glm::value_ptr(kleinnormals[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -935,17 +972,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, rocket.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(rocket.Vertices()[0]), GL_STATIC_DRAW);
if (rocket.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, rocket.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(rocket.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, rocket.Normals().size() * 3 * sizeof(float),
glm::value_ptr(rocket.Normals()[0]), GL_STATIC_DRAW);
if (rocket.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, rocket.Normals().size() * 3 * sizeof(float),
glm::value_ptr(rocket.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -1022,17 +1063,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, pain.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(pain.Vertices()[0]), GL_STATIC_DRAW);
if (pain.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, pain.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(pain.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, pain.Normals().size() * 3 * sizeof(float),
glm::value_ptr(pain.Normals()[0]), GL_STATIC_DRAW);
if (pain.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, pain.Normals().size() * 3 * sizeof(float),
glm::value_ptr(pain.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down Expand Up @@ -1097,17 +1142,21 @@ int main()
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer[CurrentSurface]);

// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, patches.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(patches.Vertices()[0]), GL_STATIC_DRAW);
if (patches.Vertices().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, patches.Vertices().size() * 3 * sizeof(float),
glm::value_ptr(patches.Vertices()[0]), GL_STATIC_DRAW);
}

// Initialize the vertex Attributes
glEnableVertexAttribArray(vertexattribute);
glVertexAttribPointer(vertexattribute, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));

// Give our normals to OpenGL.
glBindBuffer(GL_ARRAY_BUFFER, normalbuffer[CurrentSurface]);
glBufferData(GL_ARRAY_BUFFER, patches.Normals().size() * 3 * sizeof(float),
glm::value_ptr(patches.Normals()[0]), GL_STATIC_DRAW);
if (patches.Normals().size() > 0) {
glBufferData(GL_ARRAY_BUFFER, patches.Normals().size() * 3 * sizeof(float),
glm::value_ptr(patches.Normals()[0]), GL_STATIC_DRAW);
}

// Initialize the normal Attributes
glEnableVertexAttribArray(normalattribute);
Expand Down