1 / 44

OpenGL Rendering pipeline

OpenGL Rendering pipeline. 陳雅暄 李晨維. Outline. Introduction to OpenGL Rendering pipeline Q&A. OpenGL. Created in 1991 by Silicon Graphics. Now it is managed by the Khronos consortium A library of functions (e.g., glDrawArrays ) and constants (e.g., GL_TRIANGLES )

hofmann
Download Presentation

OpenGL Rendering pipeline

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. OpenGLRendering pipeline 陳雅暄 李晨維

  2. Outline • Introduction to OpenGL • Rendering pipeline • Q&A

  3. OpenGL • Created in 1991 by Silicon Graphics. Now it is managed by the Khronos consortium • A library of functions (e.g., glDrawArrays) and constants (e.g., GL_TRIANGLES) • The API interacts with the graphics processing unit (GPU) • Language-independent: has many bindings, e.g., WebGL. • Platform-independent: works on Win/Linux/..

  4. OpenGL – Libraries • OpenGL doesn’t support input or windowing • GLUT (or GLFW) is used to create a context • Platform-dependent extensions can be provided by vendors. Identified by ARB, EXT, .. • GLEW wraps the extraction of functionality

  5. Create a window for OpenGL

  6. Create a window for OpenGL

  7. Rendering Pipeline

  8. Vertex specification • List an ordered list of vertices that define 1.The boundaries of the primitive (Points, Lines or Polygons). 2.Colors of each vertices. 3.Texture coordinates.

  9. Vertex specification Vertex specification • Common object format: .obj, .stl, .3ds • Common object format: .obj, .stl, .3ds Vertex coordainates Texture coordainates Vertex normal Face element

  10. Read an obj file • Read an object with tiny_obj_loader

  11. VBO - Vertex Buffer Object • VBO : Vertex buffer object. It can store a large number of vertices in the GPU’s memory • It usually stores something like positions, texture coordinates, normal vectors or indices

  12. VAO - Vertex Array Object • VAO : Vertex array object. It can be bound vertex buffer objects

  13. VAO and VBO

  14. EBO - Element Buffer Objects • When we try to draw a rectangle, there is some overlap on the vertices specified. With EBO Without EBO

  15. EBO - Element Buffer Objects

  16. VAO, VBO and EBO

  17. 3D Coordinate and Texture Coordinate 3D Texture

  18. Texture Wrapping

  19. Vertex Shader • Vertex Shader is a program written in GLSL that manipulate the vertex data. • The goal of vertex shader is to calculate final vertex color of each vertex.

  20. Set a value to vertex shader

  21. Tessellation • This shader stage is optional. • Divided into smoother mesh of triangles.

  22. Geometry Shader • This shader stage is optional. • Convert primitives to different types. • For example, point primitive can become lines.

  23. Vertex Post-processing • This is a fixed function stage. • The most important part of this stage is Clipping.

  24. Perspective and Orthogonal rendering (Field of View) perspective orthogonal

  25. Perspective and Orthogonal rendering

  26. View matrix

  27. Translation, Rotation and scale

  28. Primitive Assembly

  29. Rasterization The output of rasterization is a fragments.

  30. Fragment Shader (pixel shader) • User-written program in GLSL calculates the color of each fragment that user sees on the screen.

  31. Per-sample operations • There are few tests that are performed based on user has activated them or not. • For example: • Pixel ownership test, Scissor Test, Stencil Test, Depth Test.

  32. Stencil Test *GLFW does this automatically so we don't have to tell GLFW to create one *By using the stencil buffer we can thus discard certain fragments based on the fragments of other drawn objects in the scene.

  33. Depth Test Today most GPUs support a hardware feature called early depth testing. Early depth testing allows the depth test to run before the fragment shader runs.

  34. Double-Buffered Animation

  35. Single vs Double

  36. New OpenGL vs Old OpenGL • New version uses GLFW (or GLAD) : Old version uses GLUT (freeGLUT) • New version has implementable shader : Old Version does not. • New version can render scene when ever you want. Old version has fixed pipeline. https://blog.csdn.net/Bill_Ming/article/details/7662809 Not recommended

  37. PushMatrix and PopMatrix

  38. glutMainLoop

  39. Q&A

More Related