1 / 34

Ogre

Ogre. [1] Ungeheuer n , Menschenfresser m http://dict.leo.org [2] Abk. f. O pen G L G r abb e r http://www.fh-karlsruhe.de/~juan0014. Thema. 3D-Screenshot. Inhalt. Technische Architektur OpenGL vs. VRML Geometrie Transformationen Material und Texturen Beleuchtung

ashlyn
Download Presentation

Ogre

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ogre [1] Ungeheuer n, Menschenfresser m http://dict.leo.org [2] Abk. f. OpenGL Grabber http://www.fh-karlsruhe.de/~juan0014

  2. Thema 3D-Screenshot

  3. Inhalt • Technische Architektur • OpenGL vs. VRML • Geometrie • Transformationen • Material und Texturen • Beleuchtung • OpenGL-Spezialitäten • Logging • Ausblick

  4. Technische Architektur Anwendung opengl32.dll glu32.dll Treiber

  5. Technische Architektur Anwendung opengl32.dll Ogre glu32.dll Treiber VRML

  6. Technische Architektur • Anwendungsverzeichnis • Anwendung.exe • opengl32.dll (=Ogre) • Systemverzeichnis • opengl32.dll • glu32.dll

  7. OpenGL vs. VRML Beispiel

  8. Licht OpenGL vs. VRML VRML Welt Transformation Ansicht Form Material Textur Geometrie

  9. OpenGL vs. VRML 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 } } ] }

  10. OpenGL vs. VRML OpenGL glLight Licht glRotate Transformation glMaterial Material glTexImage2D Textur glNormal Geometrie glVertex

  11. OpenGL vs. VRML OpenGL // lighting float diffuseLightColor[4] = {0.9f, 0.9f, 0.9f, 1.0f}; float ambientLightColor[4] = {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 diffuseColor[4] = {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); 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); 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();

  12. VRMLScene SceneState GLState OpenGL vs. VRML Klassenstruktur

  13. Points Lines,Line strip,Line loop Polygon Triangles,Triangle strip,Triangle fan Quads,Quad strip Evaluators PointSet IndexedLineSet IndexedFaceSet [Box, Sphere, etc.] ElevationGrid Geometrie

  14. VRMLScene Vertex Normal SceneState GLState Geometrie Klassenstruktur * * 1 1 1

  15. VRMLLineStrip VRMLLineLoop VRMLLines VRMLPointSet VRMLPolygon VRMLTriangleStrip VRMLGeometry VRMLIndexed VRMLLineSet VRMLTriangleFan VRMLFaces VRMLTriangles VRMLQuadStrip VRMLQuads Geometrie Klassenstruktur

  16. Geometrie Beispiel // 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, ... ] }

  17. Stack Modelview, Projection, Texture Baum Transform, Viewpoint, TextureTransform Transformationen

  18. Skalierung Translation Rotation X Rotation Y Rotation X Transformationen Zerlegung einer Transformationsmatrix

  19. BasicTransformation Transformation TransformationStack SceneState Modelview, Projection, Lights Transformationen Klassenstruktur * 1 * 1 10 1

  20. Translation Transformationen Klassenstruktur BasicTransformation LoadIdentity MultIdentity SimpleTransformation MatrixTransformation Rotation Scale Frustum LoadMatrix MultMatrix Ortho

  21. Transformationen Beispiel // 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 [ ...

  22. Unterscheidung nach Vorder- und Rückseite nicht-texturierte Glanzlichter Material und Texturen • Material: Ambient, Diffuse, Specular, Emission, Shininess • Farbe pro Eckpunkt

  23. Multitexturing(Lightmaps, Bumpmapping, Environment Mapping, ...) Material und Texturen • Texturen und Texturkoordinaten

  24. SceneState TexCoord GLState Color Ambient & Diffuse & Specular & Emissive (Front & Back), Vertex (if lighting is off), AmbientScene Texture2DParams Material und Texturen Klassenstruktur 1 * 1 * 10 1 *

  25. Material und Texturen Beispiel Material // material float diffuseColor[4] = {1.0f, 0.0f, 0.0f, 0.0f}; glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, diffuseColor); float specularColor[4] = {1.0f, 1.0f, 1.0f, 1.0f}; glMaterialfv(GL_FRONT, GL_SPECULAR, specularColor); glMateriali(GL_FRONT, GL_SHININESS, 128); Shape { appearance Appearance { material Material { diffuseColor 1 0 0 ambientIntensity 1 specularColor 1 1 1 shininess 1 } } geometry IndexedFaceSet { ... } }

  26. Material und Texturen Beispiel Texturen // texture glTexImage2D(GL_TEXTURE_2D, 0, 3, 256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); // geometry glBegin(GL_QUADS); 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(); 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, ... ] } } }

  27. Ambientes Licht für gesamte Szene komplett verschiedene Beleuchtung pro Objekt Beleuchtung • PointLight, DirectionalLight, Spotlight • Parameter: Ambient, Diffuse, Specular, Spot, Attenuation

  28. VRMLScene VRMLLight VRMLDirectionalLight VRMLPointLight SceneState VRMLSpotLight GLState LightParams Beleuchtung Klassenstruktur 1 8

  29. Beleuchtung Beispiel // lighting float diffuseLightColor[4] = {0.9f, 0.9f, 0.9f, 1.0f}; float ambientLightColor[4] = {0.45f, 0.45f, 0.45f, 1.0f); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLightColor); glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLightColor); DirectionalLight { ambientIntensity 0.5 color 0.9 0.9 0.9 direction -100 -50 -100 }

  30. _T _T _T, _T2 ProxyArray OpenGL-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(...); glVertexPointer(...); glDrawArrays(...); glDrawElements(...); SequenceArray

  31. glNewList(1, GL_COMPILE); glBegin(); ... glEnd(); DisplayList glEndList(); ... glCallList(); CommandStore OpenGL-Spezialitäten Display-Listen GLState 1 * 1 *

  32. OpenGL-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");

  33. Debugging Lerneffekt 60 GB-Platten ausnutzen  Logging Protokoll aller Funktionsaufrufe glBegin -- Return address: 0x00425B48 mode: GL_QUADS glTexCoord4d -- Return address: 0x0543DE36 s: 0.273438 t: 0.472656 r: 0 q: 1

  34. Ausblick • Zusammenfassung:OpenGL rein, VRML raus • Lightmaps:VRML-Extensions / Nachberechnung • 2,5-D vs. 3-D:Transform & Lighting • Portierung (MacOS, Linux) • Robustheit • weitere Ausgabeformate • ...

More Related