

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Graphics is a fascinating area in Computer Science. It has wide applications both in research and industry. This course will teach the fundamentals of Computer Graphics. It deals with science of image formation and rendering on a computer screen. This lab manual includes: Graphics, Models, Libraries, Display, Commands, Functions, Programming, Java, Pixel, Process, Platform, Bindings
Typology: Lecture notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


1 Graphics Models and Libraries
A graphics display is a drawing area composed of an array of fine points called pixels. At the heart of a graphics system there is a magic pen, which can move at lightning speed to a specific pixel and draw the pixel with a specific color — a red, green, and blue (RGB) vector value. This pen can be controlled directly by hand through an input device (mouse or keyboard) like a simple paintbrush. In this case, we can draw whatever we imagine, but it takes a real artist to come up with a good painting. Computer graphics, however, is about using this pen automatically through programming.
A real or imaginary object is represented in a computer as a model and is displayed as an image. A model is an abstract description of the object’s shape (vertices) and attributes (colors), which can be used to find all the points and their colors on the object corresponding to the pixels in the drawing area. Given a model, the application program will control the pen through a graphics library to generate the corresponding image. An image is simply a 2D array of pixels.
A graphics library provides a set of graphics commands or functions. These commands can be bound in C, C++ , Java , or other programming languages on different platforms. Graphics commands can specify primitive 2D and 3D geometric models to be digitized and displayed. Here primitive means that only certain simple shapes (such as points, lines, and polygons) can be accepted by a graphics library. To draw a complex shape, we need an application program to assemble or construct it by displaying pieces of simple shapes (primitives). We have the magic pen that draws a pixel. If we can draw a pixel, we can draw a line, a polygon, a curve, a block, a building, an airplane, and so forth. A general application program can be included into a graphics library as a command to draw a complex shape. Because our pen is magically fast, we can draw a complex object, clear the drawing area, draw the object at a slightly different location or shape, and repeat the above processes — the object is now animated.
OpenGL is a graphics library that we will integrate with the Java programming language to introduce graphics theory, programming, and applications. When we introduce program examples, we will succinctly discuss Java-specific concepts and programming as well for C/C++ programmers.
2 OpenGL Programming in Java: JOGL
OpenGL is the most widely used graphics library (GL) or application programming interface (API), and is supported across all popular desktop and workstation platforms, ensuring wide application deployment. JOGL implements Java bindings for OpenGL. It provides hardware-supported 3D graphics to applications written in Java. It is part of a suite of open-source technologies initiated by the Game Technology Group at Sun Microsystems. JOGL provides full access to OpenGL functions and integrates with the AWT and Swing widget sets.
3_. Instructions for today_
Execute the sample Netbeans code provided.
Implement the code for drawing a line through the DDA algorithm
DDA Algorithm
docsity.com