0% found this document useful (0 votes)
0 views

Assignment No 1

The document provides an overview of computer graphics, defining it as a branch of computer science focused on generating images through programming. It introduces OpenGL as a cross-platform API for rendering 2D and 3D graphics, detailing its features, libraries, and the rendering pipeline. Additionally, it outlines essential OpenGL functions and concludes with instructions for installing OpenGL on Ubuntu.

Uploaded by

mayuri tambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Assignment No 1

The document provides an overview of computer graphics, defining it as a branch of computer science focused on generating images through programming. It introduces OpenGL as a cross-platform API for rendering 2D and 3D graphics, detailing its features, libraries, and the rendering pipeline. Additionally, it outlines essential OpenGL functions and concludes with instructions for installing OpenGL on Ubuntu.

Uploaded by

mayuri tambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment No 1

Assignment Name:
Computer Graphics(Basic and how to install OpenGL/Glut)
INTRODUCTION
What is Computer Graphics?
Branch of Computer Science.
Computer + Graphs + Pics = Computer Graphics.
Drawing line, Chart, Graphs etc. on the screen using Programming language is computer
Graphics.
Computer graphics is the branch of computer science that deals with generating images
with the aid of computers. It displays the information in the from of graphics objects such
as picture, charts, graphs and diagrams instead of simple text. We can say computer
graphics makes it possible to express data in pictorial form.
OpenGL
It is cross-platform, cross-language API for rendering 2D and 3D Graphics(Vector
Graphics).
Getting started with OpenGL
Open Graphics Library (OpenGL) is a cross-language (language independent), cross-
platform (platform-independent) API for rendering 2D and 3D Vector Graphics(use of
polygons to represent image). OpenGL API is designed mostly in hardware.
 Design : This API is defined as a set of functions which may be called by the client
program. Although functions are similar to those of C language but it is language
independent.
 Development : It is an evolving API and Khronos Group regularly releases its new
version having some extended feature compare to previous one. GPU vendors may
also provide some additional functionality in the form of extension.
 Associated Libraries : The earliest version is released with a companion library
called OpenGL utility library. But since OpenGL is quite a complex process. So in
order to make it easier other library such as OpenGL Utility Toolkit is added which is
later superseded by free glut. Later included library were GLEE, GLEW, and gliding.
 Implementation : Mesa 3D is an open source implementation of OpenGL. It can do
pure software rendering and it may also use hardware acceleration on BSD, Linux,
and other platforms by taking advantage of Direct Rendering Infrastructure.
Rendering Pipeline
Most implementations of OpenGL have a similar order of operations, a series of
processing stages called the OpenGL rendering pipeline. Although this is not a strict rule
of how OpenGL is implemented, it provides a reliable guide for predicting what OpenGL
will do. Geometric data (verices, line, and polygons) follow a path through the row of
boxes that includes evaluators and per-vertex operations, while pixel data (pixels, images
and bitmaps) are treated differently for part of the process. Both types of data undergo the
same final step (raterization) before the final pixel data is written to the framebuffer.

Display Lists: All data, whether it describes geometry or pixels, can be saved in a
display list for current or later use. (The alternative to retaining data in a display list is
processing the data immediately-known as immediate mode.) When a display list is
executed, the retained data is sent from the display list just as if it were sent by the
application in immediate mode.

Evaluators: All geometric primitives are eventually described by vertices. Evaluators


provide a method for deviving the vertices used to represent the surface from the
control points. The method is a polynomial mapping, which can produce surface
normal, colors, and spatial coordinate values from the control points.
Per-Vertex and Primitive Assembly: For vertex data, the next step converts the vertices
into primitives. Some types of vertex data are transformed by 4x4 floating-point
matrices. Spatial coordinates are projected from a position in the 3D world to a position
on your screen. In some cases, this is followed by perspective division, which makes
distant geometric objects appear smaller than closer objects. Then viewport and depth
operations are applied. The results at this point are geometric primitives, which are
transformed with related color and depth vlaues and guidelines for the rasterization
step.

Pixel Operations: While geometric data takes one path through the OpenGL rendering
papeline, pixel data takes a different route. Pixels from an array in system memory are
first unpacked form one of a variety of formats into the proper number of components.
Next the data is scaled, biased, processed by a pixel map, and sent to the rasterization
step.

Rasterization: Rasterization is the conversion of both geometric and pixel data into
fragments. Each fragment square corresponds to a pixel in the framebuffer. Line width,
point size, shading model, and coverage calculations to support antialiasing are taken ito
consideration as vertices are connected into lines or the interior pixels are calculated for a
filled polygon. Color and depth values are assigned for each fragment square. The
processed fragment is then drawn into the appropriate buffer, where it has finally
advanced to be a pixel and achieved its final resting place.
Libraries
OpenGL provides a powerful but primitive set of rendering command, and all higher-
level drawing must be done in terms of these commands. There are several libraries that
allow you to simplify your programming tasks, including the following:
OpenGL Utility Library (GLU) contains several routines that use lower-level OpenGL
commands to perform such tasks as setting up matracies for specific viewing orientations
and projections and rendering surfaces.
OpenGL Utility Toolkit (GLUT) is a window-system-independent toolkit, written by
Mark Kilgard, to hide the complexities of differing window APIs.
Include Files
For all OpenGL applications, you want to include the gl.h header file in every file.
Almost all OpenGL applications use GLU, the aforementioned OpenGL Utility Library,
which also requires inclusion of the glu.h header file. So almost every OpenGL source
file begins with:
#include <GL/gl.h>
#include <GL/glu.h>
If you are using the OpenGL Utility Toolkit (GLUT) for managing your window
manager tasks, you should include:
#include <GL/glut.h>
OpenGl Functions:
 glutInit:
Used to initialize GLUT.

 glutCreateWindow
Used for creating a top-level window. You can supply the window name
as a label while creating the window.

 glutInitWindowSize
Used to define the window size. The width and height of the window
are specified in pixels while defining the window size.
 void glutInitWindowPosition

Used to set the initial window position. The


window's x and y locations are specified in terms of pixels.
 glutDisplayFunc

Used to specify the callback function to be executed to display


graphics in the current window. For redisplaying the content in
the window too, the specified callback function...
Conclusion:
Hence we have successfully install openGL on ubuntu

You might also like