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

Computer Graphices Group - 5

Uploaded by

frzerkebamo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Computer Graphices Group - 5

Uploaded by

frzerkebamo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

BONGA UNIVERSITY

College Of Engineering and Technology


Department Of Computer Science
Course Name:- Computer Graphics

Course Code: CoSc3072

3rd year 2nd semester

Group_5 members:

No Name ID_NO
1 YOHANIS FELEK BU1726/14
2 YOSEPH SIMENEH BU1753/14
3 YOHANNES YENEKAL BU1731/14
4 CHALACHEW ALEBEL BU0438/14
5 REHOBOTH LEGESSE BU10026/15

Submitted to Instructor :-Mr. Ashagira A.


June, 2024

Bonga, Ethiopia

TOGETHER WE CAN!
TABLE OF CONTENTS

Contents
TABLE OF CONTENTS...........................................................................................................................i
CHAPTER TEN........................................................................................................................................1
Application Modelling...............................................................................................................................1
INTRODUCTION.....................................................................................................................................1
10.1. The Matrix Stacks..................................................................................................................1
10.1.1. Implementing a Scene Hierarchy......................................................................................2
10.2. OpenGL Display List.............................................................................................................4
10.2.1. Display Lists and Traversal...............................................................................................7
10.3. How the concept are relaized in specfic system.....................Error! Bookmark not defined.
10.3.1. OpenGL and Java 3D......................................................................................................10
10.3.2. Comparison of OpenGL and Java 3D............................................................................11
Conclusion................................................................................................................................................13
Reference..................................................................................................................................................14

i
CHAPTER TEN

Application Modelling

INTRODUCTION
Application modeling in computer graphics refers to the process of creating 3D models and
scenes for specific applications or purposes. It involves developing mathematical representations
of three-dimensional surfaces and objects using specialized software. The resulting models can
be displayed as 2D images through rendering or used in computer simulations.

The manual modeling process is similar to sculpting in plastic arts. 3D modeling software, also
known as modelers, is used to produce these 3D models.

10.1. The Matrix Stacks


The matrix stack is a mechanism used to efficiently manage and apply transformations to objects
in a hierarchical scene. It simplifies the construction of hierarchical models, where complicated
objects are built from a series of simpler objects.

The matrix stack works by storing a series of transformation matrices. When you push a matrix
onto the stack, it becomes the current transformation matrix and is used to transform vertices.

1
This allows you to apply a sequence of transformations to an object without having to
concatenate the matrices yourself.

The matrix on top of the stack always represents the world-transform of the current node. So
before drawing each node, you set the Direct3D world matrix to the top of the stack.

10.1.1.Implementing a Scene Hierarchy

A matrix stack simplifies the construction of hierarchical models, in which complicated objects
are constructed from a series of simpler objects.

A scene, or transform, hierarchy is usually represented by a tree data structure. Each node in the
tree data structure contains a matrix. A particular matrix represents the change in coordinate
systems from the node's parent to the node. For example, if you are modeling a human arm, you
might implement the hierarchy that is shown in the following diagram.

In this hierarchy, the Body matrix places the body in the world. The Upper Arm matrix contains
the rotation of the shoulder, the Lower Arm matrix contains the rotation of the elbow, and the
Hand matrix contains the rotation of the wrist. To determine where the hand is relative to the
world, you multiply all the matrices from Body down through Hand together.

The previous hierarchy is overly simplistic, because each node has only one child. If you begin
to model the hand in more detail, you will probably add fingers and a thumb. Each digit can be
added to the hierarchy as children of Hand, as shown in the following diagram.

If you traverse the complete graph of the arm in depth-first order - traversing as far down one
path as possible before moving on to the next path - to draw the scene, you perform a sequence
of segmented rendering. For example, to render the hand and fingers, you implement the
following pattern.

1. Push the Hand matrix onto the matrix stack.


2. Draw the hand.
3. Push the Thumb matrix onto the matrix stack.
4. Draw the thumb.
5. Pop the Thumb matrix off the stack.
6. Push the Finger 1 matrix onto the matrix stack.
7. Draw the first finger.
8. Pop the Finger 1 matrix off the stack.
9. Push the Finger 2 matrix onto the matrix stack. You continue in this manner until
all the fingers and thumb are rendered.

After you have completed rendering the fingers, you would pop the Hand matrix off the stack.
You can follow this basic process in code with the following examples. When you encounter a
node during the depth-first search of the tree data structure, push the matrix onto the top of the
matrix stack.

MatrixStack->Push();

MatrixStack->MultMatrix(pNode->matrix);

When you are finished with a node, pop the matrix off the top of the matrix stack.

MatrixStack->Pop();

In this way, the matrix on the top of the stack always represents the world-transform of the
current node. Therefore, before drawing each node, you should set the Direct3D matrix.

pD3DDevice>SetTransform(D3DTS_WORLDMATRIX(0), *MatrixStack->GetTop());

10.2. OpenGL Display List

Display list is a group of OpenGL commands that have been stored (compiled) for later
execution. Once a display list is created, all vertex and pixel data are evaluated and copied into
the display list memory on the server machine. It is only one time process. After the display list
has been prepared (compiled), you can reuse it repeatedly without re-evaluating and re-
transmitting data over and over again to draw each frame. Display list is one of the fastest
methods to draw static data because vertex data and OpenGL commands are cached in the
display list and minimize data transmissions from the client to the server side. It means that it
reduces CPU cycles to perform the actual data transfer.

Key Features and Advantages

Efficiency: Display lists are one of the fastest methods to draw static data because vertex data
and OpenGL commands are cached in the display list memory. This reduces CPU cycles to
perform the actual data transfer.
Server State: Display lists are part of server state, which means they can be shared with many
clients. This is particularly useful in networked applications where data needs to be transmitted
over the network.

Performance Optimization: By placing matrix transforms, lighting, and material calculations


inside display lists, OpenGL processes these expensive computations only once while the display
list is created and stores the last results into the display list. This can significantly improve
performance.

Flexibility: Display lists can be used to encapsulate complex rendering operations, such as
hierarchical models, and can be executed from anywhere within a program as long as the
OpenGL context is active.

Limitations and Disadvantages

Immutable: Once a display list is compiled, it cannot be modified later. If you need frequent
changes or dynamic datasets, you should use Vertex Array Objects (VAOs) or Vertex Buffer
Objects (VBOs) instead.

Client State: Any client state-related commands cannot be placed in display lists. For example,
glFlush(), glFinish (), glRenderMode(), glEnableClientState(), glVertexPointer(), etc. These
commands are executed immediately if called in a display list.

Data Size Limitations: Display lists have a limited size, which can lead to memory
fragmentation if portions of a modifiable display list are changed. This can negatively impact
performance.
Implementation

To create a display list, you need to follow these steps:

Generate Display Lists: Use glGenLists() to create one or more new display list objects. This
returns the index of the beginning of contiguous display list blocks.

Compile Display List: Use glNewList() to store OpenGL commands into the display list. This
process is called compilation. The glNewList() function requires two arguments: the index of the
display list and the mode, which specifies whether to compile only or compile and execute the
list.

Execute Display List: Use glCallList() or glCallLists() to execute the display list. glCallList()
executes a single display list, while glCallLists () executes multiple display lists.

Example Code

// Create a display list


GLuint index = glGenLists(1);

glNewList(index, GL_COMPILE);

// Store OpenGL commands

glBegin(GL_TRIANGLES);

glVertex3fv(v0);

glVertex3fv(v1);

glVertex3fv(v2);

glEnd ();

glEndList();

// Execute the display list

glCallList(index);

10.2.1.Display Lists and Traversal


Display Lists

A display list is a group of OpenGL commands that have been stored (compiled) for later
execution. Once a display list is created, all vertex and pixel data are evaluated and copied into
the display list memory on the server machine. This process is called compilation. After the
display list has been prepared, you can reuse it repeatedly without re-evaluating and re-
transmitting data over and over again to draw each frame.
Traversal

Traversal refers to the act or an instance of traversing, which means to travel or pass across, over,
or through something. It can also refer to the process of moving laterally, diagonally, or in a
zigzag pattern across a surface, such as traversing a slope or traversing a room.

10.3. How the Concepts are realized in Specific Systems: OpenGL and
java3D

The concept of realization refers to the process of bringing a design or plan into existence. In the
context of a specific system, realization can be understood as the implementation of a system's
design, architecture, and functionality. This process involves translating the system's
requirements and specifications into a working system that Realization in a Software System

In a software system, realization involves several stages:

1. Design: The first stage is the design phase, where the system's architecture, user
interface, and functionality are defined. This includes creating diagrams, flowcharts, and
other visual aids to help developers understand the system's structure and behavior.
2. Implementation: The next stage is the implementation phase, where the system's design
is translated into code. This involves writing the necessary programming languages, such
as Java, Python, or C++, to create the system's components and modules.

3. Testing: After implementation, the system is tested to ensure it meets the requirements
and specifications. This includes unit testing, integration testing, and system testing to
identify and fix any bugs or errors.

4. Deployment: Once the system is tested and validated, it is deployed to the production
environment. This involves setting up the system's infrastructure, configuring the
necessary settings, and making it available to users.

Realization in a Hardware System

In a hardware system, realization involves a different set of stages:

1. Design: The design phase involves creating a detailed blueprint of the system's
components, including the circuitry, wiring, and mechanical components.

2. Prototyping: A prototype of the system is created to test and validate its design. This
involves building a working model of the system to identify any potential issues or flaws.

3. Manufacturing: Once the design is validated, the system is manufactured. This involves
producing the necessary components, assembling them, and testing them to ensure they

meet the required specifications.

4. Installation: The system is installed in its final location, and any necessary configuration
or setup is performed to make it operational.

Realization in a Business System

In a business system, realization involves a combination of both software and hardware


components:
1. Design: The design phase involves creating a business plan, defining the system's
architecture, and outlining the necessary processes and procedures.

2. Implementation: The implementation phase involves setting up the necessary


infrastructure, including hardware and software components, to support the system.

3. Training: Users are trained on the system, and any necessary documentation is created to
support its use.

4. Monitoring: The system is monitored to ensure it meets the required standards and to
identify any areas for improvement. meets the needs of its users.

10.3.1. OpenGL and Java 3D

OpenGL

OpenGL is a low-level, cross-platform API (Application Programming Interface) for rendering


2D and 3D graphics. It provides a set of functions that allow developers to create and manipulate
graphics primitives such as points, lines, and triangles. OpenGL is widely used in various fields,
including game development, scientific visualization, and architectural visualization. It is known
for its flexibility and performance, but requires a good understanding of computer graphics and
low-level programming.

Key Features of OpenGL

Platform Independence: OpenGL is available on multiple platforms, including Windows,


macOS, and Linux.

Low-Level API: It provides direct access to graphics hardware, allowing for fine-grained control
over graphics rendering.

Performance: OpenGL is optimized for performance, making it suitable for demanding


applications like games and simulations.

Graphics Pipeline: OpenGL follows a graphics pipeline that includes stages such as vertex
processing, rasterization, and fragment processing.
Shaders: OpenGL supports programmable shaders, which allow developers to customize the
graphics pipeline using GLSL (OpenGL Shading Language).

Java 3D

Java 3D is a high-level, object-oriented API for creating 3D graphics applications and applets. It
provides a set of classes and methods that allow developers to construct an Java 3D

Java 3D is a high-level, object-oriented API for creating 3D graphics applications and applets. It
provides a set of classes and methods that allow developers to construct and manipulate 3D
scenes, including geometric data, attribute information, and viewing information. Java 3D is
designed to be easy to use and provides features such as scene graph management, rendering
modes, and support for various file formats. It is part of the Java Media suite and is available on
a wide range of platforms.

Key Features of Java 3D

High-Level API: Java 3D provides a higher-level abstraction than OpenGL, making it easier to
use for developers without extensive graphics knowledge.

Object-Oriented: Java 3D is built on object-oriented principles, allowing for the creation of


complex 3D scenes using a hierarchical structure.

Scene Graph Management: Java 3D manages the scene graph, which represents the 3D scene
as a collection of nodes and their relationships.

Rendering Modes: Java 3D supports various rendering modes, including wireframe, solid, and
transparent rendering.

File Format Support: Java 3D supports loading and saving 3D models in various file formats,
such as OBJ, 3DS, and VRML.

10.3.2.Comparison of OpenGL and Java 3D


Level of Abstraction: OpenGL is a low-level API, while Java 3D is a high-level API.

Performance: OpenGL is generally faster due to its direct access to graphics hardware.
Ease of Use: Java 3D is easier to use, especially for developers without extensive graphics
knowledge.

Platform Independence: Both OpenGL and Java 3D are platform-independent. d manipulate 3D


scenes, including geometric data, attribute information, and viewing information. Java 3D is
designed to be easy to use and provides features such as scene graph management, rendering
modes, and support for various file formats. It is part of the Java Media suite and is available on
a wide range of platforms.

 graph management, rendering modes, and support for various file formats. It is part of the
Java Media suite and is available on a wide range of platforms.

Key Features of Java 3D

 High-Level API: Java 3D provides a higher-level abstraction than OpenGL, making it


easier to use for developers without extensive graphics knowledge.

 Object-Oriented: Java 3D is built on object-oriented principles, allowing for the creation


of complex 3D scenes using a hierarchical structure.

 Scene Graph Management: Java 3D manages the scene graph, which represents the 3D
scene as a collection of nodes and their relationships.

 Rendering Modes: Java 3D supports various rendering modes, including wireframe,


solid, and transparent rendering.

 File Format Support: Java 3D supports loading and saving 3D models in various file
formats, such as OBJ, 3DS, and VRML.
Conclusion

OpenGL provides a built-in matrix stack that allows developers to push and pop transformation
matrices to efficiently implement hierarchical models. The matrix stack acts as a history of
matrices, enabling developers to undo changes and manage complex transformations. OpenGL's
matrix stack is low-level and provides direct control over the graphics pipeline. Java 3D also
supports hierarchical scene graphs, but uses a higher-level, object-oriented approach. Java 3D
provides a Matrix Stack class that simplifies managing transformation matrices. The Matrix
Stack class has methods to push, pop, and multiply matrices, making it easier to construct and
traverse scene graphs compared to manually managing multiple model and view matrices. Both
OpenGL and Java 3D allow developers to create complex 3D scenes by composing simpler
objects. OpenGL's matrix stack provides a low-level mechanism to efficiently implement
hierarchical models, while Java 3D's scene graph and Matrix Stack classes offer a higher-level,
more abstract approach. The choice between OpenGL and Java 3D depends on factors like
performance requirements, development team expertise, and the complexity of the 3D scene.
OpenGL's matrix stack is optimized for speed but requires more low-level programming, while
Java 3D's scene graph and Matrix Stack provide a more productive development experience at
the cost of some performance
Reference
1. https://books.google.com/books/about/Modeling_in_Computer_Graphics.html?
id=qZZRAAAAMAAJ
"Modeling in Computer Graphics: Methods and Applications" by Springer-Verlag
(1993)
2. https://www.cse.unr.edu/~fredh/class/480/text-icg-2ed/Chap-01/ch-01-6up.pdf
"Graphics Systems and Models" chapter from "Interactive Computer Graphics"
textbook
3. https://link.springer.com/book/10.1007/978-3-642-78114-8
"Modeling in Computer Graphics" book by Springer-Verlag
4. https://link.springer.com/book/10.1007/978-4-431-68147-2
Another "Modeling in Computer Graphics" book by Springer-Verlag
5. https://archive.org/details/modelingincomput0000unse
"Modeling in computer graphics : methods and applications" book from Internet
Archive
6. https://www.cs.cmu.edu/afs/cs/academic/class/15462-f09/www/lec_slides/15-462-
F09-Lecture-2.pdf
Lecture slides on "Modeling and Rendering" from a CMU computer graphics course

You might also like