sam hocevar
Reputation
19,174
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
 Apr 26 comment Maths ? coordinates rotating around coordinates I would recommend learning about high school trigonometry. Apr 25 comment OpenGL [LWJGL3] - Matrix4x4 not rotating correctly @DaanMeijer I often recommend this book. There are probably online versions of it, too. Apr 25 revised OpenGL [LWJGL3] - Matrix4x4 not rotating correctly added 6 characters in body Apr 25 comment OpenGL [LWJGL3] - Matrix4x4 not rotating correctly @DaanMeijer the fact that you ask this question means that writing a correct matrix class is going to be a challenging task for you. If you wish to carry on, I highly recommend that you use unit tests all along, for instance with JUnit. Apr 25 answered OpenGL [LWJGL3] - Matrix4x4 not rotating correctly Apr 25 comment OpenGL [LWJGL3] - Matrix4x4 not rotating correctly Your code looks fine (at least the logic is correct); there may be a problem with other parts of your code. Maybe the multiplication part? Or where you compute the projection? Apr 25 comment OpenGL [LWJGL3] - Matrix4x4 not rotating correctly Why are there three `multilpy()` calls in the end? Apr 24 comment Rotate sprite along the angle between two objects This function reinvents the wheel and is really too long. I can’t recommend anyone uses it. It can be rewritten in one single line: `float zVec2f::getAngle () const { return atan2f(this->x, - this->y); }` Apr 24 revised Perlin noise looks uncoherent on higher z deleted 2 characters in body Apr 24 comment Perlin noise looks uncoherent on higher z Don’t forget to accept answers when you’re satisfied. Apr 24 answered Perlin noise looks uncoherent on higher z Apr 23 comment How to compute a transformation matrix that describes each position and rotation on a sphere? No, the up vector is just a general hint, it does not have to be perpendicular to your view vector. It just has to be non-collinear. Gimbal lock is related to this, but probably not an issue for you. Apr 23 answered How to compute a transformation matrix that describes each position and rotation on a sphere? Apr 15 comment WebGL color quantization Note that this code does not minimise the color difference with the original pixel. Another formula which does is: `floor(gl_FragColor.rgb * (color_resolution - 1.0) + 0.5) / (color_resolution - 1.0);`. In a perfect world you would also have to perform gamma correction before quantisation. Apr 14 revised Calculate average of arbitrary amount of quaternions (recursion) fix syntax error Apr 14 answered Calculate average of arbitrary amount of quaternions (recursion) Apr 13 answered Why does transforming a Vector3 by a Quaternion result in reversed Z? Apr 12 comment Why does transforming a Vector3 by a Quaternion result in reversed Z? Transforming vector `(1,0,0)` by quaternion `(w=0.6532815, x=-0.270598, y=0.270598, z=0.6532815)` does resut in `(0, 0.7071, -0.7071)`. Your “expected result” seems wrong to me. Apr 12 comment Why does transforming a Vector3 by a Quaternion result in reversed Z? You are not showing the actual values for the vectors and quaternions you are using and obtaining. This would help. Apr 11 comment VBO with texture index buffer different than vertex index buffer @Emanuele Yes, absolutely try to reuse vertices if they do have the same UVs; in most models this happens often. And your usual 3D authoring software does a good job at this anyway.