Skip to content

Commit

Permalink
Issue #43: Patched bug with objects.hpp wire objects not resetting th…
Browse files Browse the repository at this point in the history
…e polygon mode back for the front_and_back properly
  • Loading branch information
jpaoneMines committed Oct 18, 2024
1 parent 7625f53 commit 0f02c60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- MD5Model silences all but final texture fail messages during load
- ShaderProgram uses glm::value_ptr() for passing vectors and matrices to program uniforms
- Include glad/gl.h in materials.hpp for GLfloat to exist if file included on its own
- Patched bug with objects.hpp wire objects not resetting the polygon mode back for the front_and_back properly

## v 5.4.1 - 26 Aug 2024
- Updated README
Expand Down
27 changes: 9 additions & 18 deletions objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,7 @@ inline void CSCI441_INTERNAL::drawCubeFlat( GLfloat sideLength, GLenum renderMod

glDrawArrays( GL_TRIANGLES, 0, 36 );

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawCubeIndexed( GLfloat sideLength, GLenum renderMode ) {
Expand Down Expand Up @@ -830,8 +829,7 @@ inline void CSCI441_INTERNAL::drawCubeIndexed( GLfloat sideLength, GLenum render

glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, (void*)nullptr);

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawCylinder( GLfloat base, GLfloat top, GLfloat height, GLuint stacks, GLuint slices, GLenum renderMode ) {
Expand Down Expand Up @@ -865,8 +863,7 @@ inline void CSCI441_INTERNAL::drawCylinder( GLfloat base, GLfloat top, GLfloat h
glDrawArrays( GL_TRIANGLE_STRIP, static_cast<GLint>((slices+1)*2*stackNum), static_cast<GLint>((slices+1)*2) );
}

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawPartialDisk(GLfloat innerRadius, GLfloat outerRadius, GLuint slices, GLuint rings, GLfloat startAngle, GLfloat sweepAngle, GLenum renderMode ) {
Expand Down Expand Up @@ -900,8 +897,7 @@ inline void CSCI441_INTERNAL::drawPartialDisk(GLfloat innerRadius, GLfloat outer
glDrawArrays( GL_TRIANGLE_STRIP, static_cast<GLint>((slices+1)*2*ringNum), static_cast<GLint>((slices+1)*2) );
}

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawSphere( GLfloat radius, GLuint stacks, GLuint slices, GLenum renderMode ) {
Expand Down Expand Up @@ -939,8 +935,7 @@ inline void CSCI441_INTERNAL::drawSphere( GLfloat radius, GLuint stacks, GLuint

glDrawArrays( GL_TRIANGLE_FAN, static_cast<GLint>((slices+2) + (stacks-2)*(slices+1)*2), static_cast<GLint>(slices+2) );

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawHalfSphere( GLfloat radius, GLuint stacks, GLuint slices, GLenum renderMode ) {
Expand Down Expand Up @@ -978,8 +973,7 @@ inline void CSCI441_INTERNAL::drawHalfSphere( GLfloat radius, GLuint stacks, GLu

glDrawArrays( GL_TRIANGLE_FAN, static_cast<GLint>((slices+2) + (stacks-2)*(slices+1)*2), static_cast<GLint>((slices+2)/2) );

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );

drawPartialDisk(0.0f, radius, slices, stacks, 0.0f, glm::two_pi<float>(), renderMode);
}
Expand Down Expand Up @@ -1017,8 +1011,7 @@ inline void CSCI441_INTERNAL::drawDome( GLfloat radius, GLuint stacks, GLuint sl
glDrawArrays( GL_TRIANGLE_STRIP, static_cast<GLint>((slices+2) + (stackNum-1)*((slices+1)*2)), static_cast<GLint>((slices+1)*2) );
}

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawTorus( GLfloat innerRadius, GLfloat outerRadius, GLuint sides, GLuint rings, GLenum renderMode ) {
Expand Down Expand Up @@ -1052,8 +1045,7 @@ inline void CSCI441_INTERNAL::drawTorus( GLfloat innerRadius, GLfloat outerRadiu
glDrawArrays( GL_TRIANGLE_STRIP, static_cast<GLint>(ringNum*sides*4), static_cast<GLint>(sides*4) );
}

glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::drawTeapot( GLenum renderMode ) {
Expand All @@ -1062,8 +1054,7 @@ inline void CSCI441_INTERNAL::drawTeapot( GLenum renderMode ) {

glPolygonMode( GL_FRONT_AND_BACK, renderMode );
CSCI441_INTERNAL::teapot();
glPolygonMode( GL_FRONT, currentPolygonMode[0] );
glPolygonMode( GL_BACK, currentPolygonMode[1] );
glPolygonMode( GL_FRONT_AND_BACK, currentPolygonMode[0] );
}

inline void CSCI441_INTERNAL::generateCubeVAOFlat( GLfloat sideLength ) {
Expand Down

0 comments on commit 0f02c60

Please sign in to comment.