sam hocevar
Reputation
19,164
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
 2d 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 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 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 comment Perlin noise looks uncoherent on higher z Don’t forget to accept answers when you’re satisfied. 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 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 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. Apr 11 comment VBO with texture index buffer different than vertex index buffer @Emanuele Then the vertices need to be duplicated, one copy for each UV variation. This is usually well worth the cost. Apr 2 comment Create YUV texture for GL_TEXTURE_EXTERNAL_OES format I’m voting to close this. “cant paste shader code because of confidentiality issues” makes the question too vague and unhelpful for anyone else. Mar 30 comment Create YUV texture for GL_TEXTURE_EXTERNAL_OES format I don’t recommend doing a 2-pass blur for a 3×3 kernel, as I believe it will be slower. There are more efficient methods such as taking advantage of linear sampling. Again, please show your shader code or there is no way we can help you properly (you won’t get an upvote from me until the question is complete; the code you’re linking to isn’t the code you’re asking about). Mar 29 comment Create YUV texture for GL_TEXTURE_EXTERNAL_OES format what is the convolution you are doing? why do you think a YUV texture would help you when the actual slow operation is the convolution? also, please show your entire shader code. Mar 18 comment Why does Mathf.Log(x) return infinity in this case? Note that I slightly changed the notation used in my answer, adopting the more commonly used φ and ψ values. The result is exactly the same. Mar 18 comment Why does Mathf.Log(x) return infinity in this case? It is called Binet’s formula. You’ll find plenty of information on the Wikipedia page about Fibonacci numbers. Mar 13 comment What is easiest way to move towards and along the edge on a hex grid? Why is (1,0)’s destination (2,-2) instead of (1,-2) or (3,-2)? Why does (2,-1) go to (3,-3) instead of (2,-3)? The rules aren’t very clear to me. Mar 10 comment 360 degree quaternion interpolation? There is no immediate negative effect that I can think of.