STATE_point_get_rgb

 

 



   This function will return the rgb values of the point
   Red will be returned in rgb[0] 
   Green will be returned in rgb[1] 
   Blue will be returned in rgb[2] 
   Note that these values are only relevant with hardware rendering.
   The default is (255,255,255).
   By changing the rgb value we can create light and atmospheric 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 no 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
  

 

 

Go to page 1      Select API

 

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