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?
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/