I have just started using LWJGL and im stuck on trying to draw rounded rectangles like in Java2D, how would you go about this?
you just use sprites/textures usually
Dam, i was trying to avoid textures because i thought it would take up more mem V just rendering it through code. Well if its the norm ill just do that then xD, thanks
If you do it right, memory won’t be your problem. It will be fillrate.
If you want to brute-force shade, then:
length(max(abs§-e, 0.0)); // square or box (3d)
length(max(abs§-e, 0.0)) - r; // rounded square or box
where ‘p’ is the logical sampling position, ‘e’ is the bound (positive extent) and ‘r’ the radius for rounding. p & b are vec2 and r is float. Logically these are axe aligned and centered around the origin. Vertex shader handles making it arbitrary…see that ellipse thread. And really the ‘length’ can be dropped and you can use dot instead since you really care about the sign of the distance.
BTW: this is logically the same as rectangle vs. circle intersection - http://www.java-gaming.org/topics/vectors-what-s-the-point/24307/msg/204073/view.html