PDA

View Full Version : drawing geometric objects---2



lilian
08-24-2009, 05:48 AM
Can a rectangle/square be drawn from just knowing end coordinates of one of its diagonals? If yes, how? Also could someone post a link/something that I has good examples of opengl programming in java?

ZbuffeR
08-24-2009, 07:48 AM
yes.

imagine the 4 corners are ABCD. you know point A and C (diagonal).
so B is :
B.x = A.x
B.y = C.y

and D is :
B.x = C.x
B.y = A.y

Try first with GL_LINES.


opengl+java :
https://jogl-demos.dev.java.net/
https://jogl-demos.dev.java.net/source/browse/jogl-demos/