Question
I need help with the first portion. Outcomes To be able to use WebGL to implement an efficient 2D graphics library. Description WebGL programming can
I need help with the first portion.
Outcomes
To be able to use WebGL to implement an efficient 2D graphics library.
Description
WebGL programming can be overwhelming. In this assignment, you are asked to implement a simple 2D graphics library using WebGL. Such a library can then be used to create simple 2D scenes without having to know WebGL programming.
PART 1: (40 points) Write a high-level 2D WebGL API library that implements the following functions. These functions must be implemented as static functions inside an exportable class named _2D . Assume that all the given points, widths, and heights are within the WebGL clipping coordinates and that the z coordinate of all 2D points, lines, and shapes is 0.0.
setColor(r, g, b): Sets the color used for all the subsequent drawing functions. It gets called every time the color needs to change.
pointAt(x, y, pointSize = 2): Draws a point at (x, y) with the given point size.
lineBetween(x1, y1, x2, y2): Draws a line between points (x1, y1) and (x2, y2).
ellipseAt(x, y, width, height): Draws an ellipse within the rectangular area specified by the upper-left corner (x, y) and width and height.
polygon(x1,y1, x2, y2, x3, y3, ): Draws a polygon made of the given (x1,y1),
(x2, y2), (x3, y3), and so on. Assume that the requested polygon is convex.
PART 2: (20 points) Test your library by creating a program that calls these functions to create a 2D scene like this. This program should import the class of PART 1 and should not have anything to do with WebGL.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started