Write a Java programwhich uses the LWJGL library to draw a window of 640×480 in

Write a Java programwhich uses the LWJGL library to draw a window of 640×480 in the center of the screen. Your program should then read in coordinates from a file titled coordinates.txt and draw the primitives in the same window using the algorithms for each primitive as discussed in class.Theprogram should draw the primitivesin different colors (red for lines, blue for circles and green for ellipses) on a black background.Use the glVertex2f() command to plot the primitives pixel by pixel. Finally, your program should also use the input.Keyboard class to have the escape keyquit your application.If you are motivated enough, you may also add extra functional keys that would allow the user to change the colors of the primitives. These added functions should be clearly stated in your comments.The given coordinates.txtfilewill be in the following format:l -15,-15 150,180c 100,150 80e 225,370 35,75l -100,100 50,75e 200,-100 50,50l stands for a lineand isfollowed by a space, this is then followed by the two endpoints of the line separated by a space. c stands for a circle followed by a space, the center of the circle, space and then the radius of the circle. e stands for ellipse followed by a space, center of the ellipse, space again followed by value of rx and ry(separated by acomma).When your program is evaluated, a different coordinates.txt file will be used by me–so be sure your algorithm tests all cases for each of the three primitives.
Requirements: program

Published
Categorized as Java

Leave a comment

Your email address will not be published. Required fields are marked *