~matobet/pyopengl/Python3

« back to all changes in this revision

Viewing changes to GL/APPLE/specular_vector.py

  • Committer: matobet at gmail
  • Date: 2010-06-26 14:11:04 UTC
  • Revision ID: matobet@gmail.com-20100626141104-k011ofmltgiiu60g
Initial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''OpenGL extension APPLE.specular_vector
 
2
 
 
3
This module customises the behaviour of the 
 
4
OpenGL.raw.GL.APPLE.specular_vector to provide a more 
 
5
Python-friendly API
 
6
 
 
7
Overview (from the spec)
 
8
        
 
9
        An alternative specular lighting model is enabled by passing
 
10
        the LIGHT_MODEL_SPECULAR_VECTOR token as the <pname> parameter
 
11
        to LightModel, and TRUE as the <param> parameter.  The specular
 
12
        vector lighting model calculates the specular intensity as the
 
13
        dot product of the true reflection vector of the light source
 
14
        and the vector from the vertex to the viewpoint.  This yields
 
15
        results that are visually similar to but often more realistic
 
16
        than the existing lighting model.  
 
17
        
 
18
        Mathematically, the specular component s.n in the existing
 
19
        lighting model calculation is replaced with the following
 
20
        alternative calculation.
 
21
        
 
22
        Given three vectors, n, l, and p, where n is the unit normal
 
23
        vector at the vertex, l is the unit vector from the vertex to
 
24
        the light position, and p is the unit vector from the vertex
 
25
        to the viewpoint (or the vector {0,0,1} if
 
26
        LIGHT_MODEL_LOCAL_VIEWER is false), the specular component is
 
27
        given by
 
28
        
 
29
          (2 * cross(n, cross(n, l)) + l) . p
 
30
        
 
31
        All other lighting model and material parameters (shininess,
 
32
        spotlight, attenuation, local viewer, and direction/positional
 
33
        sources) operate normally.  The specular vector lighting model
 
34
        affects both rgba and index modes.   
 
35
 
 
36
The official definition of this extension is available here:
 
37
http://www.opengl.org/registry/specs/APPLE/specular_vector.txt
 
38
'''
 
39
from OpenGL import platform, constants, constant, arrays
 
40
from OpenGL import extensions, wrapper
 
41
from OpenGL.GL import glget
 
42
import ctypes
 
43
from OpenGL.raw.GL.APPLE.specular_vector import *
 
44
### END AUTOGENERATED SECTION
 
45
from OpenGL.GL import glget
 
46
glget.addGLGetConstant( GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE, (1,) ) # check size...
 
 
b'\\ No newline at end of file'