26 Februari 2011

OpenGL Programming Part 2

The Sierpinski Gasket
• generated using randomly selected vertices
• is fractal, an object that can recursively and randomly;


Attributes
• an attributes is any property that determines how a geometric primitives is to be rendered
• color
  -thickness
  -pattern
• styles
  -bold, italic, line
  -string, height, weight


Color
• color model is an orderly system for creating a whole range of color from a small set of primary colors
• solid color
• two types of color models:
  -Additive

  •    RGB Color Model
  •    Use light to display color
  •    red+green+blue = white

  -Subtactive

  •    CMY Color Model
  •    substractive model using printing ink
  •    color result from reflected light
  •    cyan+magneta+yellow = black.

Color Model


Color Range
4 channels:Red, Green, Blue and Alpha (opacity/transparency).
• Each channel has intensity from 0.0 ~ 1.0
• Alpha is used in blending and transparency
• Ex: glColor4f(0.0, 1.0, 0.0, 1.0); //green
        glColor4f(1.0, 1.0, 1.0, 1.0); //white




Hidden Surface Removal
• How to apply HSR in OpenGL
   - glutInitDisplayMode(GLUT_DEPTH);
   - glEnable(GL_DEPTH_TEST);


• In display function
  - glEnable(GL_DEPTH_BUFFER_BIT);


Also called z-buffer

2 ulasan:

Comment Jom