NOTE!
Click on MENU to Browse between Subjects...17CS62 - COMPUTER GRAPHICS AND VISUALIZATION
6TH SEMESTER CSE
Answer Script for Module 1
Solved Previous Year Question Paper
CBCS SCHEME
COMPUTER GRAPHICS AND VISUALIZATION
[As per Choice Based Credit System (CBCS) scheme]
(Effective from the academic year 2017 - 2018)
SEMESTER - VI
Subject Code 17CS62
IA Marks 40
Number of Lecture Hours/Week 3
Exam Marks 60
These Questions are being framed for helping the students in the "FINAL Exams" Only
(Remember for Internals the Question Paper is set by your respective teachers).
Questions may be repeated, just to show students how VTU can frame Questions.
- ADMIN
17CS62 - COMPUTER GRAPHICS AND VISUALIZATION
6TH SEMESTER CSE
Answer Script for Module 1
6.1 openGL:
A basic library of functions is provided in OpenGL
for
specifying graphics primitives, attributes, geometric transformations,
viewing transformations, and many other operations.
OpenGL
is designed to be hardware independent, so many operations, such as input
and output routines, are not included in the basic library. However, input
and output routines and many additional functions are available in
auxiliary libraries that have been developed for OpenGL programs
.
6.2 Library:
Function names in the OpenGL basic library
(also called
the OpenGL core library) are prefixed with gl, and each component word
within a function name has its first letter capitalized. The following
examples illustrate this naming convention:
glBegin, glClear, glCopyPixels, glPolygonMode
Certain functions require that one (or more) of their arguments be assigned a symbolic constant specifying, for instance, a parameter name, a value for a parameter, or a particular mode. All such constants begin with the uppercase letters GL.
In addition, component words within a constant name are written in capital letters, and the underscore ( ) is used as a separator between all component words in the name. The following are a few examples of the several hundred symbolic constants available for use with OpenGL functions:
GL_2D, GL_RGB, GL_CCW, GL_POLYGON, GL_AMBIENT_AND_DIFFUSE
The OpenGL functions also expect specific data types. For example, an OpenGL function parameter might expect a value that is specified as a 32-bit integer. But the size of an integer specification can be different on different machines. To indicate a specific data type, OpenGL uses special built-in, data-type names, such as
GLbyte, GLshort, GLint, GLfloat, GLdouble, GLboolean
In addition to the OpenGL basic (core) library, there are a number of associated libraries for handling special operations.
The OpenGL Utility (GLU)
provides routines for setting up
viewing and projection matrices, describing complex objects with line and
polygon approximations, displaying quadrics and B-splines using linear
approximations, processing the surface-rendering operations, and other
complex tasks.
Every OpenGL implementation includes the GLU library, and all GLU function
names start with the prefix glu. There is also an objectoriented toolkit
based on OpenGL, called Open Inventor
, which provides
routines and predefined object shapes for interactive three-dimensional
applications. This toolkit is written in C++.
The OpenGL Extension to the X Window System (GLX)
provides
a set of routines that are prefixed with the letters glX. Apple systems can
use the Apple GL (AGL) interface for window-management operations.
Function names for this library are prefixed with agl. For Microsoft
Windows systems, the WGL
routines provide a Windows-to-OpenGL interface
. These routines are prefixed
with the letters wgl. The Presentation Manager to OpenGL (PGL) is an
interface for the IBM OS/2, which uses the prefix pgl for the library
routines.
The OpenGL Utility Toolkit (GLUT)
provides a
library of functions for interacting with any screen-windowing system
. The GLUT library functions are prefixed with glut, and this library also
contains methods for describing and rendering quadric curves and surfaces.
Since GLUT is an interface to other device-specific window systems, we can use it so that our programs will be device-independent. Information regarding the latest version of GLUT
6.3 Structure of a program:
6.3.1 Header Files:
we will need to include the header file for the OpenGL core library. For most applications we will also need GLU, and on many systems we will need to include the header file for the window system.
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
6.3.2 Creating a window:
Now that we have our library, we can begin to design our interface by creating our window inside our int main() function:
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glu.h>
void display() { /* empty function required as of glut 3.0 */ }
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize(800,600);
glutCreateWindow("Hello World");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
We first call glutInit(), which starts up GLUT for our use. Next, we set up a display mode. For now, just use the settings we've provided here for glutInitDisplayMode. You might tweak these settings later. Then we tell GLUT how big we want our window to be; 800 by 600 is OK for now. Finally, we actually create the window with glutCreateWindow(), passing the window title as an argument, and give control of our program to GLUT through glutMainLoop(). Never forget to call glutMainLoop() when you use GLUT!
1.1
DDA:
The digital differential analyser
(DDA) is a
scan-conversion line algorithm based on calculating either δy or
δx, using Equation "δy = m · δx"
or
Equation "δx = δy / m
". A line is sampled at
unit intervals in one coordinate and the corresponding integer values
nearest the line path are determined for the other coordinate.
1.2
Breseham's Line Drawing Algorithm:
Refer 3rd
Question & Answer or Click Here
1.1
BitMap:
A frame buffer with one bit per pixel is commonly called a bitmap.
1.2
Pixmap:
A frame buffer with multiple bits per pixel is a pixmap.
1.3
aspect Ratio:
The number of pixel columns divided by the number of scan lines that can be
displayed by the system is called as Aspect Ratio
.
Aspect ratio
can also be described as the number of horizontal points to vertical points
(or vice versa) necessary to produce equal-length lines in both directions
on the screen. Thus, an aspect ratio of 4/3, for example, means that a
horizontal line plotted with four points has the same length as a vertical
line plotted with three points, where line length is measured in some
physical nits such as centimetres
1.4
Framebuffer:
Picture definition is stored in a memory area called the refresh buffer
or frame buffer
, where the
term frame refers to the total screen area. This memory area holds the set
of color values for the screen points
. These storedcolor values
are then retrieved from therefresh buffer
and used to control the intensity of the electron beam
as it moves
from spot to spot across the screen.
1.1
Primitives:
In OpenGL, an object is made up of geometric primitives such as triangle, quad, line segment and point. A primitive is made up of one or more vertices. OpenGL supports the following primitives:
1.2
Program:
9.2.1 points:
9.2.2 Lines:
9.2.3 Quad:
Below Page NAVIGATION Links are Provided...
All the Questions on Question Bank Is SOLVED