STATE_point_set_rgb

 

 


   This function will set the rgb values of the point
   Red should be given in rgb[0] 
   Green should be given in rgb[1] 
   Blue should be given in rgb[2] 
   Note that these values are only relevant with hardware rendering.
   By changing the rgb value we can create light and atmospheric effects.
   The light API is based on this function. Usually one would
   use the light API function though sometimes it nice to have the direct control
   for creating special effects.
  
   How the rgb values are combined with the texture color and the polygon color
   to form the final color of each pixel:
   ----------------------------------------------------------------------------
   The final color of a pixel in a polygon is
   an outcome of the rgb values of the vertexes and the polygon texture or color
   The rgb of the vertexes is interpolated for every pixel of the polygon
   The interpolated value is multiplied by the texture color of every pixel.
   (If there is no texture then it is multiplied by the color of the polygon)
   Before multiplying the rgb is converted to a 0 till 1 scale.
   Example: Lets say we have a red polygon with its color set to (240,10,10)
   Lets assume that this is a triangle and that the rgb value of the vertexes is 
   (255,0,0 ) , (0,255,0) , (0,0,255). If we take a point in the center of the polygon
   then the interpolated value from the three vertexes will be something like (83,83,83)
   when 83 is converted from 0-255 scale to 0-1 scale we get that the interpolated value
   is (0.33, 0.33, 0.33). Now let multiply this value with the color of the polygon
   we get: (0.33, 0.33, 0.33) * (240, 10, 10) == (80, 3, 3)
   The result pixel will be (80,3,3)
  
   Special cases.
   --------------
   1) If the RGB value of all the vertexes is (255,255,255)
   Then it wont have any effect since in scale of [0-1]
   it will become (1,1,1) and then the multiplication wont change
   the value of the pixel
   2) If the polygon has a bitmap and its color is white (255,255,255)
   In this case the rgb values of the vertexes determine alone the color
   of the final pixel. This is also known as Gouraud shading
  
   See also STATE_polygon_set_light()

 

 

Go to page 1      Select API

 

Copyright © 2007 3DSTATE Corporation. www.3dstate.com