SlideShare a Scribd company logo
Graphical Objects and Scene
Graphs
1
Objectives
• Introduce graphical objects
• Generalize the notion of objects to include lights, cameras, attributes
• Introduce scene graphs
2
Limitations of Immediate Mode Graphics
• When we define a geometric object in an application, upon
execution of the code the object is passed through the pipeline
• It then disappears from the graphical system
• To redraw the object, either changed or the same, we must
reexecute the code
• Display lists provide only a partial solution to this problem
3
OpenGL and Objects
• OpenGL lacks an object orientation
• Consider, for example, a green sphere
• We can model the sphere with polygons or use OpenGL quadrics
• Its color is determined by the OpenGL state and is not a property of the object
• Defies our notion of a physical object
• We can try to build better objects in code using object-oriented
languages/techniques
4
Imperative Programming Model
• Example: rotate a cube
• The rotation function must know how the cube is represented
• Vertex list
• Edge list
5
Application glRotate
cube data
results
Object-Oriented Programming Model
•In this model, the representation is stored with the
object
•The application sends a message to the object
•The object contains functions (methods) which
allow it to transform itself
6
Application Cube Object
message
C/C++
• Can try to use C structs to build objects
• C++ provides better support
• Use class construct
• Can hide implementation using public, private, and protected members in a
class
• Can also use friend designation to allow classes to access each other
7
Cube Object
• Suppose that we want to create a simple cube object that we can
scale, orient, position and set its color directly through code such as
cube mycube;
mycube.color[0]=1.0;
mycube.color[1]= mycube.color[2]=0.0;
mycube.matrix[0][0]=………
8
Cube Object Functions
• We would also like to have functions that act on the cube such as
• mycube.translate(1.0, 0.0,0.0);
• mycube.rotate(theta, 1.0, 0.0, 0.0);
• setcolor(mycube, 1.0, 0.0, 0.0);
• We also need a way of displaying the cube
• mycube.render();
9
Building the Cube Object
class cube {
public:
float color[3];
float matrix[4][4];
// public methods
private:
// implementation
}
10
The Implementation
• Can use any implementation in the private part such as a vertex list
• The private part has access to public members and the
implementation of class methods can use any implementation
without making it visible
• Render method is tricky but it will invoke the standard OpenGL
drawing functions such as glVertex
11
Other Objects
• Other objects have geometric aspects
• Cameras
• Light sources
• But we should be able to have nongeometric objects too
• Materials
• Colors
• Transformations (matrices)
12
Application Code
cube mycube;
material plastic;
mycube.setMaterial(plastic);
camera frontView;
frontView.position(x ,y, z);
13
Light Object
class light { // match Phong model
public:
boolean type; //ortho or perspective
boolean near;
float position[3];
float orientation[3];
float specular[3];
float diffuse[3];
float ambient[3];
}
14
Scene Descriptions
• If we recall figure model, we saw that
• We could describe model either by tree or by equivalent code
• We could write a generic traversal to display
• If we can represent all the elements of a scene (cameras,
lights,materials, geometry) as C++ objects, we should be able to
show them in a tree
• Render scene by traversing this tree
15
Scene Graph
16
Preorder Traversal
glPushAttrib
glPushMatrix
glColor
glTranslate
glRotate
Object1
glTranslate
Object2
glPopMatrix
glPopAttrib
…
17
Group Nodes
• Necessary to isolate state chages
• Equivalent to OpenGL Push/Pop
• Note that as with the figure model
• We can write a universal traversal algorithm
• The order of traversal can matter
• If we do not use the group node, state changes can
persist
18
Inventor and Java3D
•Inventor and Java3D provide a scene graph API
•Scene graphs can also be described by a file (text or
binary)
• Implementation independent way of transporting scenes
• Supported by scene graph APIs
•However, primitives supported should match
capabilities of graphics systems
• Hence most scene graph APIs are built on top of OpenGL or DirectX (for PCs)
19
VRML
• Want to have a scene graph that can be used over the World Wide
Web
• Need links to other sites to support distributed data bases
• Virtual Reality Markup Language
• Based on Inventor data base
• Implemented with OpenGL
Angel: Interactive Computer Graphics
5E © Addison-Wesley 2009
20
Open Scene Graph
• Supports very complex geometries by adding occulusion culling in
first path
• Supports translucently through a second pass that sorts the
geometry
• First two passes yield a geometry list that is rendered by the pipeline
in a third pass
21

More Related Content

PPTX
Ai part 1
PPTX
Working with images in matlab graphics
PDF
Appraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
PPTX
Javascript
PPT
Programmable Piplelines
PDF
JS Responsibilities
PDF
Deep single view 3 d object reconstruction with visual hull
PDF
Value objects in JS - an ES7 work in progress
Ai part 1
Working with images in matlab graphics
Appraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
Javascript
Programmable Piplelines
JS Responsibilities
Deep single view 3 d object reconstruction with visual hull
Value objects in JS - an ES7 work in progress

What's hot (17)

PDF
Web futures
PPTX
Shaders and the black magic
PDF
Graph Regularised Hashing
PDF
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
PPT
Mmclass5
PDF
MBrace: Cloud Computing with F#
PDF
MBrace: Large-scale cloud computation with F# (CUFP 2014)
ODP
Deep Learning meetup
PPTX
Real-time lightmap baking
PPTX
Data Mining: Implementation of Data Mining Techniques using RapidMiner software
PDF
ODP
Hubba Deep Learning
PPTX
Exploring Fused Convolutional Neural Networks for Aerial Imagery Segmentation
PDF
Presentation: Plotting Systems in R
PPTX
Route Finding in Time Dependent Graphs - Nima Montazeri and Ben Earlam @ Grap...
PPT
CS 354 Transformation, Clipping, and Culling
PPTX
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
Web futures
Shaders and the black magic
Graph Regularised Hashing
Value Objects, Full Throttle (to be updated for spring TC39 meetings)
Mmclass5
MBrace: Cloud Computing with F#
MBrace: Large-scale cloud computation with F# (CUFP 2014)
Deep Learning meetup
Real-time lightmap baking
Data Mining: Implementation of Data Mining Techniques using RapidMiner software
Hubba Deep Learning
Exploring Fused Convolutional Neural Networks for Aerial Imagery Segmentation
Presentation: Plotting Systems in R
Route Finding in Time Dependent Graphs - Nima Montazeri and Ben Earlam @ Grap...
CS 354 Transformation, Clipping, and Culling
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
Ad

Similar to Graphical Objects and Scene Graphs (20)

DOC
Data structures graphics library in computer graphics.
PDF
Computer Graphics Programming Problem Solving And Visual Communication Dr Ste...
PDF
OpenGL Spec 4.4 Core
PDF
Computer Graphics - Lecture 01 - 3D Programming I
PPT
Introduction to OpenGL.ppt
PDF
Introducao ao Curso Anselmo Cardoso de Paiva Ufma
PPT
Computer Graphics involves technology to access. The Process transforms and p...
PPTX
3 CG_U1_P2_PPT_3 OpenGL.pptx
PDF
Open gl
PDF
lectureAll-OpenGL-complete-Guide-Tutorial.pdf
PPTX
Chapter02 graphics-programming
PPTX
Graphics Libraries
PPT
Angel6 e05
PPT
Programming with OpenGL
PPTX
CGLabLec6.pptx
PPTX
2D graphics
PPT
NVIDIA OpenGL in 2016
PDF
Open gl basics
PPT
CS 354 Introduction
PDF
Bouncing ball content management system project report.pdf
Data structures graphics library in computer graphics.
Computer Graphics Programming Problem Solving And Visual Communication Dr Ste...
OpenGL Spec 4.4 Core
Computer Graphics - Lecture 01 - 3D Programming I
Introduction to OpenGL.ppt
Introducao ao Curso Anselmo Cardoso de Paiva Ufma
Computer Graphics involves technology to access. The Process transforms and p...
3 CG_U1_P2_PPT_3 OpenGL.pptx
Open gl
lectureAll-OpenGL-complete-Guide-Tutorial.pdf
Chapter02 graphics-programming
Graphics Libraries
Angel6 e05
Programming with OpenGL
CGLabLec6.pptx
2D graphics
NVIDIA OpenGL in 2016
Open gl basics
CS 354 Introduction
Bouncing ball content management system project report.pdf
Ad

More from Syed Zaid Irshad (20)

PDF
Data Structures & Algorithms - Spring 2025.pdf
PDF
Operating System.pdf
PDF
DBMS_Lab_Manual_&_Solution
PPTX
Data Structure and Algorithms.pptx
PPTX
Design and Analysis of Algorithms.pptx
PPTX
Professional Issues in Computing
PDF
Reduce course notes class xi
PDF
Reduce course notes class xii
PDF
Introduction to Database
PDF
C Language
PDF
Flowchart
PDF
Algorithm Pseudo
PDF
Computer Programming
PDF
ICS 2nd Year Book Introduction
PDF
Security, Copyright and the Law
PDF
Computer Architecture
PDF
Data Communication
PDF
Information Networks
PDF
Basic Concept of Information Technology
PDF
Introduction to ICS 1st Year Book
Data Structures & Algorithms - Spring 2025.pdf
Operating System.pdf
DBMS_Lab_Manual_&_Solution
Data Structure and Algorithms.pptx
Design and Analysis of Algorithms.pptx
Professional Issues in Computing
Reduce course notes class xi
Reduce course notes class xii
Introduction to Database
C Language
Flowchart
Algorithm Pseudo
Computer Programming
ICS 2nd Year Book Introduction
Security, Copyright and the Law
Computer Architecture
Data Communication
Information Networks
Basic Concept of Information Technology
Introduction to ICS 1st Year Book

Recently uploaded (20)

PDF
Well-logging-methods_new................
PPTX
web development for engineering and engineering
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
PPT on Performance Review to get promotions
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
DOCX
573137875-Attendance-Management-System-original
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Geodesy 1.pptx...............................................
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
composite construction of structures.pdf
Well-logging-methods_new................
web development for engineering and engineering
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Construction Project Organization Group 2.pptx
Internet of Things (IOT) - A guide to understanding
OOP with Java - Java Introduction (Basics)
CYBER-CRIMES AND SECURITY A guide to understanding
CH1 Production IntroductoryConcepts.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPT on Performance Review to get promotions
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
573137875-Attendance-Management-System-original
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Mechanical Engineering MATERIALS Selection
Geodesy 1.pptx...............................................
Lecture Notes Electrical Wiring System Components
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
composite construction of structures.pdf

Graphical Objects and Scene Graphs

  • 1. Graphical Objects and Scene Graphs 1
  • 2. Objectives • Introduce graphical objects • Generalize the notion of objects to include lights, cameras, attributes • Introduce scene graphs 2
  • 3. Limitations of Immediate Mode Graphics • When we define a geometric object in an application, upon execution of the code the object is passed through the pipeline • It then disappears from the graphical system • To redraw the object, either changed or the same, we must reexecute the code • Display lists provide only a partial solution to this problem 3
  • 4. OpenGL and Objects • OpenGL lacks an object orientation • Consider, for example, a green sphere • We can model the sphere with polygons or use OpenGL quadrics • Its color is determined by the OpenGL state and is not a property of the object • Defies our notion of a physical object • We can try to build better objects in code using object-oriented languages/techniques 4
  • 5. Imperative Programming Model • Example: rotate a cube • The rotation function must know how the cube is represented • Vertex list • Edge list 5 Application glRotate cube data results
  • 6. Object-Oriented Programming Model •In this model, the representation is stored with the object •The application sends a message to the object •The object contains functions (methods) which allow it to transform itself 6 Application Cube Object message
  • 7. C/C++ • Can try to use C structs to build objects • C++ provides better support • Use class construct • Can hide implementation using public, private, and protected members in a class • Can also use friend designation to allow classes to access each other 7
  • 8. Cube Object • Suppose that we want to create a simple cube object that we can scale, orient, position and set its color directly through code such as cube mycube; mycube.color[0]=1.0; mycube.color[1]= mycube.color[2]=0.0; mycube.matrix[0][0]=……… 8
  • 9. Cube Object Functions • We would also like to have functions that act on the cube such as • mycube.translate(1.0, 0.0,0.0); • mycube.rotate(theta, 1.0, 0.0, 0.0); • setcolor(mycube, 1.0, 0.0, 0.0); • We also need a way of displaying the cube • mycube.render(); 9
  • 10. Building the Cube Object class cube { public: float color[3]; float matrix[4][4]; // public methods private: // implementation } 10
  • 11. The Implementation • Can use any implementation in the private part such as a vertex list • The private part has access to public members and the implementation of class methods can use any implementation without making it visible • Render method is tricky but it will invoke the standard OpenGL drawing functions such as glVertex 11
  • 12. Other Objects • Other objects have geometric aspects • Cameras • Light sources • But we should be able to have nongeometric objects too • Materials • Colors • Transformations (matrices) 12
  • 13. Application Code cube mycube; material plastic; mycube.setMaterial(plastic); camera frontView; frontView.position(x ,y, z); 13
  • 14. Light Object class light { // match Phong model public: boolean type; //ortho or perspective boolean near; float position[3]; float orientation[3]; float specular[3]; float diffuse[3]; float ambient[3]; } 14
  • 15. Scene Descriptions • If we recall figure model, we saw that • We could describe model either by tree or by equivalent code • We could write a generic traversal to display • If we can represent all the elements of a scene (cameras, lights,materials, geometry) as C++ objects, we should be able to show them in a tree • Render scene by traversing this tree 15
  • 18. Group Nodes • Necessary to isolate state chages • Equivalent to OpenGL Push/Pop • Note that as with the figure model • We can write a universal traversal algorithm • The order of traversal can matter • If we do not use the group node, state changes can persist 18
  • 19. Inventor and Java3D •Inventor and Java3D provide a scene graph API •Scene graphs can also be described by a file (text or binary) • Implementation independent way of transporting scenes • Supported by scene graph APIs •However, primitives supported should match capabilities of graphics systems • Hence most scene graph APIs are built on top of OpenGL or DirectX (for PCs) 19
  • 20. VRML • Want to have a scene graph that can be used over the World Wide Web • Need links to other sites to support distributed data bases • Virtual Reality Markup Language • Based on Inventor data base • Implemented with OpenGL Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 20
  • 21. Open Scene Graph • Supports very complex geometries by adding occulusion culling in first path • Supports translucently through a second pass that sorts the geometry • First two passes yield a geometry list that is rendered by the pipeline in a third pass 21