Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Write a Java programwhich uses the LWJGL library to draw a window of 640x480 in the center of the screen. Your program should then read

Write a Java programwhich uses the LWJGL library to draw a window of 640x480 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. The program should draw the primitives in 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 key quit your application.

The given coordinates.txt file will be in the following format:

l -15,-15 150,180

c 100,150 80

e 225,370 35,75

l -100,100 50,75

e 200,-100 50,50

l stands for a line and is followed 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 a comma).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students explore these related Databases questions