Title: Ogre
1Ogre
- 1 Ungeheuer n, Menschenfresser m
- http//dict.leo.org
- 2 Abk. f. OpenGL Grabber
- http//www.fh-karlsruhe.de/juan0014
2Thema
3Inhalt
- Technische Architektur
- OpenGL vs. VRML
- Geometrie
- Transformationen
- Material und Texturen
- Beleuchtung
- OpenGL-Spezialitäten
- Logging
- Ausblick
4Technische Architektur
Anwendung
opengl32.dll
glu32.dll
Treiber
5Technische Architektur
Anwendung
opengl32.dll
glu32.dll
Ogre
Treiber
VRML
6Technische Architektur
- Anwendungsverzeichnis
- Anwendung.exe
- opengl32.dll (Ogre)
- Systemverzeichnis
- opengl32.dll
- glu32.dll
7OpenGL vs. VRML
8OpenGL vs. VRML
Welt
Transformation
Ansicht
Form
Material
Textur
Geometrie
9OpenGL vs. VRML
VRML V2.0 utf8 DirectionalLight
ambientIntensity 0.5 color 0.9 0.9 0.9
direction -100 -50 -100 Transform
rotation 1 1 1 0.65 scale 2.5 2.5 2.5
children
Shape appearance Appearance
material Material ambientIntensity
1 diffuseColor 1 0 0
emissiveColor 0 0 0 shininess 1
specularColor 1 1 1
texture ImageTexture url
"IRTEX67B.jpg" repeatS TRUE
repeatT TRUE geometry
Box size 2 2 2
10OpenGL vs. VRML
Licht
glLight
Transformation
glRotate
Material
glMaterial
Textur
glTexImage2D
Geometrie
glNormal
glVertex
11OpenGL vs. VRML
// lighting float diffuseLightColor4
0.9f, 0.9f, 0.9f, 1.0f float
ambientLightColor4 0.45f, 0.45f, 0.45f,
1.0f) glLightfv(GL_LIGHT0, GL_DIFFUSE,
diffuseLightColor) glLightfv(GL_LIGHT0,
GL_AMBIENT, ambientLightColor) //
transformation glRotated(37.24, 1.0, 1.0,
1.0) // material float diffuseColor4
1.0f, 0.0f, 0.0f, 0.0f glMaterialfv(GL_FRONT,
GL_AMBIENT_AND_DIFFUSE, diffuseColor)
// texture glTexImage2D(GL_TEXTURE_2D, 0, 3,
256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE,
pixels) // geometry glBegin(GL_QUADS) glNormal3
d(0.0, 0.0, -1.0) glTexCoord2d(0.0,
0.0) glVertex3d(-1.0, 1.0, -1.0) glTexCoord2d(0
.0, 1.0) glVertex3d( 1.0, 1.0,
-1.0) glTexCoord2d(1.0, 1.0) glVertex3d( 1.0,
-1.0, -1.0) glTexCoord2d(1.0, 0.0) glVertex3d(-1
.0, -1.0, -1.0) ... glEnd()
12OpenGL vs. VRML
13Geometrie
- Points
- Lines,Line strip,Line loop
- Polygon
- Triangles,Triangle strip,Triangle fan
- Quads,Quad strip
- Evaluators
- PointSet
- IndexedLineSet
- IndexedFaceSet
- Box, Sphere, etc.
-
- ElevationGrid
14Geometrie
1
1
1
15Geometrie
16Geometrie
// geometry glBegin(GL_QUADS) glNormal3d(0.0,
0.0, -1.0) glVertex3d(-1.0, 1.0,
-1.0) glVertex3d( 1.0, 1.0, -1.0) glVertex3d(
1.0, -1.0, -1.0) glVertex3d(-1.0, -1.0,
-1.0) glNormal3d(0.0, 0.0, 1.0) glVertex3d(-1.0
, -1.0, 1.0) glVertex3d( 1.0, -1.0,
1.0) glVertex3d( 1.0, 1.0, 1.0) glVertex3d(-1.
0, 1.0, 1.0) ... glEnd()
geometry IndexedFaceSet coord Coordinate
point -1 1 -1, 1 1 -1, 1 -1
-1, -1 -1 -1, -1 -1 1, 1 -1 1,
1 1 1, -1 1 1, ...
normal Normal vector 0 0 -1, 0 0
-1, 0 0 -1, 0 0 -1, 0 0 1,
0 0 1, 0 0 1, 0 0 1, ...
coordIndex 0 1 2 3 -1, 4
5 6 7 -1, ...
17Transformationen
- Stack
- Modelview, Projection, Texture
- Baum
- Transform, Viewpoint, TextureTransform
18Transformationen
- Zerlegung einer
- Transformationsmatrix
19Transformationen
1
1
10
1
20Transformationen
BasicTransformation
LoadIdentity
MultIdentity
SimpleTransformation
MatrixTransformation
Rotation
Scale
Frustum
LoadMatrix
MultMatrix
Ortho
21Transformationen
// transformation glRotated(37.24, 1.0, 1.0,
1.0) glScaled(2.5, 2.5, 2.5) glBegin(GL_QUADS)
... glEnd() ... glPushMatrix() glTranslated(-
10.0, 20.0, 0.0) ... glPopMatrix() ...
Transform rotation 1 1 1 0.65 children
Transform scale 2.5 2.5 2.5
children Shape ...
... Transform
translation -10 20 0 children
...
22Material und Texturen
- Material Ambient, Diffuse, Specular, Emission,
Shininess - Farbe pro Eckpunkt
- Unterscheidung nach Vorder- und Rückseite
- nicht-texturierte Glanzlichter
23Material und Texturen
- Texturen und Texturkoordinaten
- Multitexturing(Lightmaps, Bumpmapping,
Environment Mapping, ...)
24Material und Texturen
1
1
10
1
25Material und Texturen
Shape appearance Appearance material
Material diffuseColor 1 0 0
ambientIntensity 1 specularColor 1 1 1
shininess 1 geometry IndexedFaceSet
...
// material float diffuseColor4 1.0f,
0.0f, 0.0f, 0.0f glMaterialfv(GL_FRONT,
GL_AMBIENT_AND_DIFFUSE, diffuseColor) float
specularColor4 1.0f, 1.0f, 1.0f,
1.0f glMaterialfv(GL_FRONT, GL_SPECULAR,
specularColor) glMateriali(GL_FRONT,
GL_SHININESS, 128)
26Material und Texturen
Shape appearance Appearance texture
ImageTexture url "IRTEX67B.jpg"
geometry IndexedFaceSet coord
Coordinate point -1 1 -1, 1 1 -1,
1 -1 -1, -1 -1 -1, ... coordIndex
0 1 2 3 -1, ... texCoord
TextureCoordinate point 0 0, 0
1, 1 1, 1 0, ...
// texture glTexImage2D(GL_TEXTURE_2D, 0, 3,
256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE,
pixels) // geometry glBegin(GL_QUADS) glTexCoor
d2d(0.0, 0.0) glVertex3d(-1.0, 1.0,
-1.0) glTexCoord2d(0.0, 1.0) glVertex3d( 1.0,
1.0, -1.0) glTexCoord2d(1.0, 1.0) glVertex3d(
1.0, -1.0, -1.0) glTexCoord2d(1.0,
0.0) glVertex3d(-1.0, -1.0, -1.0) ... glEnd()
27Beleuchtung
- PointLight, DirectionalLight, Spotlight
- Parameter Ambient, Diffuse, Specular, Spot,
Attenuation
- Ambientes Licht für gesamte Szene
- komplett verschiedene Beleuchtung pro Objekt
28Beleuchtung
1
8
29Beleuchtung
DirectionalLight ambientIntensity 0.5
color 0.9 0.9 0.9 direction -100 -50 -100
// lighting float diffuseLightColor4
0.9f, 0.9f, 0.9f, 1.0f float
ambientLightColor4 0.45f, 0.45f, 0.45f,
1.0f) glLightfv(GL_LIGHT0, GL_DIFFUSE,
diffuseLightColor) glLightfv(GL_LIGHT0,
GL_AMBIENT, ambientLightColor)
30OpenGL-Spezialitäten
Arrays
glNormal3d(0.0, 0.0, -1.0) glTexCoord2d(0.0,
0.0) glVertex3d(-1.0, 1.0, -1.0) glTexCoord2d(0
.0, 1.0) glVertex3d( 1.0, 1.0, -1.0) ...
PseudoArray
vs.
glNormalPointer(...) glTexCoordPointer(...) glVe
rtexPointer(...) glDrawArrays(...) glDrawElemen
ts(...)
SequenceArray
31OpenGL-Spezialitäten
Display-Listen
GLState
1
1
32OpenGL-Spezialitäten
GLU- und GLUT-Funktionen Extensions
glu32.dll
opengl32.dll
glut.dll
glGetString(GL_EXTENSIONS)
Anwendung
" ... GL_ARB_multitexture GL_EXT_abgr ... "
opengl32.dll
wglGetProcAddress ("glMultiTexCoord2fARB")
33Logging
Protokoll aller Funktionsaufrufe
glBegin -- Return address 0x00425B48 mode GL
_QUADS glTexCoord4d -- Return address
0x0543DE36 s 0.273438 t 0.472656 r
0 q 1
- Debugging
- Lerneffekt
- 60 GB-Platten ausnutzen ?
34Ausblick
- ZusammenfassungOpenGL rein, VRML raus
- LightmapsVRML-Extensions / Nachberechnung
- 2,5-D vs. 3-DTransform Lighting
- Portierung (MacOS, Linux)
- Robustheit
- weitere Ausgabeformate
- ...