Skip to content

Commit

Permalink
add default member initialiser for position (#6444)
Browse files Browse the repository at this point in the history
+ if position was not explicitly set, this would mean that garbage
memory most likely was stored in place of the .z coordinate of a
rectangle's position.

Whilst this didn't affect any 2d operations, as soon as the rectangle in
question was going to be drawn, its .z position would be fed into the
vertex shader, and all sorts of mayhem would happen.

By setting the position to be default-initialised the .z coordinate will
receive 0, which is what any 2D graphical element would be expected to
be initialised with.
  • Loading branch information
tgfrerer authored and ofTheo committed Nov 12, 2019
1 parent 939c823 commit b1c6ab8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/openFrameworks/types/ofRectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ class ofRectangle{
///
/// \warning The z-component of this position is preserved and can be used
/// but all ofRectangle operations will ignore the z-component.
glm::vec3 position;
glm::vec3 position{};

/// \brief The x position of the ofRectangle.
float& x;
Expand Down

0 comments on commit b1c6ab8

Please sign in to comment.