New answers tagged

1

Use enumss I totally agree with G. Sliepen, but I should add one more detail: add also None variant, so RotateX/RotateY/RotateZ variables could be represented with only one variable. Don't put everything in main function You will probably need to reuse the code rotating the cube - like adding another cube of something. But when everything happens in main, it ...


2

Use an enum class to represent the axes Instead of using an int, declare an enum class to represent the axes of rotation: enum class Axis {X, Y, Z}; Also use switch statements instead of multiple if-statements, like so: void x_Cubes::Rotate(Axis axis) { switch (axis) { case Axis::X: for (auto& mx : m_cubes) if (mx.cellx == ...


1

Various suggestions: Use the OpenGL types (e.g. GLuint, GLint) for the variables that need them. It's more portable, and the purpose of the variables is clearer. Don't store the shader source inside the shader. We don't need it after compiling the shader. It doesn't look like the type member variable is actually used (and it doesn't make sense as programs ...


Top 50 recent answers are included