diff --git a/python/include/gl.pxd b/python/include/gl.pxd
new file mode 100644
index 0000000..c1922fb
--- /dev/null
+++ b/python/include/gl.pxd
@@ -0,0 +1,1153 @@
+# OpenGL Declarations
+#
+# Copyright (C) 2006,2007,2008 PySoy Group
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see http://www.gnu.org/licenses
+
+cdef extern from "GL/glew.h" :
+ ctypedef enum:
+ # Boolean Values
+ GL_FALSE
+ GL_TRUE
+
+ # Data types
+ GL_BYTE
+ GL_UNSIGNED_BYTE
+ GL_SHORT
+ GL_UNSIGNED_SHORT
+ GL_INT
+ GL_UNSIGNED_INT
+ GL_FLOAT
+ GL_2_BYTES
+ GL_3_BYTES
+ GL_4_BYTES
+ GL_DOUBLE
+
+ # Primitives
+ GL_POINTS
+ GL_LINES
+ GL_LINE_LOOP
+ GL_LINE_STRIP
+ GL_TRIANGLES
+ GL_TRIANGLE_STRIP
+ GL_TRIANGLE_FAN
+ GL_QUADS
+ GL_QUAD_STRIP
+ GL_POLYGON
+
+ # Vertex Arrays
+ GL_VERTEX_ARRAY
+ GL_NORMAL_ARRAY
+ GL_COLOR_ARRAY
+ GL_INDEX_ARRAY
+ GL_TEXTURE_COORD_ARRAY
+ GL_EDGE_FLAG_ARRAY
+ GL_VERTEX_ARRAY_SIZE
+ GL_VERTEX_ARRAY_TYPE
+ GL_VERTEX_ARRAY_STRIDE
+ GL_NORMAL_ARRAY_TYPE
+ GL_NORMAL_ARRAY_STRIDE
+ GL_COLOR_ARRAY_SIZE
+ GL_COLOR_ARRAY_TYPE
+ GL_COLOR_ARRAY_STRIDE
+ GL_INDEX_ARRAY_TYPE
+ GL_INDEX_ARRAY_STRIDE
+ GL_TEXTURE_COORD_ARRAY_SIZE
+ GL_TEXTURE_COORD_ARRAY_TYPE
+ GL_TEXTURE_COORD_ARRAY_STRIDE
+ GL_EDGE_FLAG_ARRAY_STRIDE
+ GL_VERTEX_ARRAY_POINTER
+ GL_NORMAL_ARRAY_POINTER
+ GL_COLOR_ARRAY_POINTER
+ GL_INDEX_ARRAY_POINTER
+ GL_TEXTURE_COORD_ARRAY_POINTER
+ GL_EDGE_FLAG_ARRAY_POINTER
+
+ # Vertex Buffer Objects
+ GL_BUFFER_SIZE_ARB
+ GL_BUFFER_USAGE_ARB
+ GL_ARRAY_BUFFER_ARB
+ GL_ELEMENT_ARRAY_BUFFER_ARB
+ GL_ARRAY_BUFFER_BINDING_ARB
+ GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB
+ GL_VERTEX_ARRAY_BUFFER_BINDING_ARB
+ GL_NORMAL_ARRAY_BUFFER_BINDING_ARB
+ GL_COLOR_ARRAY_BUFFER_BINDING_ARB
+ GL_INDEX_ARRAY_BUFFER_BINDING_ARB
+ GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB
+ GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB
+ GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB
+ GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB
+ GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB
+ GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB
+ GL_READ_ONLY_ARB
+ GL_WRITE_ONLY_ARB
+ GL_READ_WRITE_ARB
+ GL_BUFFER_ACCESS_ARB
+ GL_BUFFER_MAPPED_ARB
+ GL_BUFFER_MAP_POINTER_ARB
+ GL_STREAM_DRAW_ARB
+ GL_STREAM_READ_ARB
+ GL_STREAM_COPY_ARB
+ GL_STATIC_DRAW_ARB
+ GL_STATIC_READ_ARB
+ GL_STATIC_COPY_ARB
+ GL_DYNAMIC_DRAW_ARB
+ GL_DYNAMIC_READ_ARB
+ GL_DYNAMIC_COPY_ARB
+
+ # Matrix Mode
+ GL_MATRIX_MODE
+ GL_MODELVIEW
+ GL_PROJECTION
+ GL_TEXTURE
+
+ # Points
+ GL_POINT_SMOOTH
+ GL_POINT_SIZE
+ GL_POINT_SIZE_GRANULARITY
+ GL_POINT_SIZE_RANGE
+
+ # Lines
+ GL_LINE_SMOOTH
+ GL_LINE_STIPPLE
+ GL_LINE_STIPPLE_PATTERN
+ GL_LINE_STIPPLE_REPEAT
+ GL_LINE_WIDTH
+ GL_LINE_WIDTH_GRANULARITY
+ GL_LINE_WIDTH_RANGE
+
+ # Polygons
+ GL_POINT
+ GL_LINE
+ GL_FILL
+ GL_CW
+ GL_CCW
+ GL_FRONT
+ GL_BACK
+ GL_POLYGON_MODE
+ GL_POLYGON_SMOOTH
+ GL_POLYGON_STIPPLE
+ GL_EDGE_FLAG
+ GL_CULL_FACE
+ GL_CULL_FACE_MODE
+ GL_FRONT_FACE
+ GL_POLYGON_OFFSET_FACTOR
+ GL_POLYGON_OFFSET_UNITS
+ GL_POLYGON_OFFSET_POINT
+ GL_POLYGON_OFFSET_LINE
+ GL_POLYGON_OFFSET_FILL
+
+ # Display Lists
+ GL_COMPILE
+ GL_COMPILE_AND_EXECUTE
+ GL_LIST_BASE
+ GL_LIST_INDEX
+ GL_LIST_MODE
+
+ # Depth buffer
+ GL_NEVER
+ GL_LESS
+ GL_EQUAL
+ GL_LEQUAL
+ GL_GREATER
+ GL_NOTEQUAL
+ GL_GEQUAL
+ GL_ALWAYS
+ GL_DEPTH_TEST
+ GL_DEPTH_BITS
+ GL_DEPTH_CLEAR_VALUE
+ GL_DEPTH_FUNC
+ GL_DEPTH_RANGE
+ GL_DEPTH_WRITEMASK
+ GL_DEPTH_COMPONENT
+
+ # Lighting
+ GL_LIGHTING
+ GL_LIGHT0
+ GL_LIGHT1
+ GL_LIGHT2
+ GL_LIGHT3
+ GL_LIGHT4
+ GL_LIGHT5
+ GL_LIGHT6
+ GL_LIGHT7
+ GL_SPOT_EXPONENT
+ GL_SPOT_CUTOFF
+ GL_CONSTANT_ATTENUATION
+ GL_LINEAR_ATTENUATION
+ GL_QUADRATIC_ATTENUATION
+ GL_AMBIENT
+ GL_DIFFUSE
+ GL_SPECULAR
+ GL_SHININESS
+ GL_EMISSION
+ GL_POSITION
+ GL_SPOT_DIRECTION
+ GL_AMBIENT_AND_DIFFUSE
+ GL_COLOR_INDEXES
+ GL_LIGHT_MODEL_TWO_SIDE
+ GL_LIGHT_MODEL_LOCAL_VIEWER
+ GL_LIGHT_MODEL_AMBIENT
+ GL_FRONT_AND_BACK
+ GL_SHADE_MODEL
+ GL_FLAT
+ GL_SMOOTH
+ GL_COLOR_MATERIAL
+ GL_COLOR_MATERIAL_FACE
+ GL_COLOR_MATERIAL_PARAMETER
+ GL_NORMALIZE
+
+ # User clipping planes
+ GL_CLIP_PLANE0
+ GL_CLIP_PLANE1
+ GL_CLIP_PLANE2
+ GL_CLIP_PLANE3
+ GL_CLIP_PLANE4
+ GL_CLIP_PLANE5
+
+ # Accumulation buffer
+ GL_ACCUM_RED_BITS
+ GL_ACCUM_GREEN_BITS
+ GL_ACCUM_BLUE_BITS
+ GL_ACCUM_ALPHA_BITS
+ GL_ACCUM_CLEAR_VALUE
+ GL_ACCUM
+ GL_ADD
+ GL_LOAD
+ GL_MULT
+ GL_RETURN
+
+ # Alpha testing
+ GL_ALPHA_TEST
+ GL_ALPHA_TEST_REF
+ GL_ALPHA_TEST_FUNC
+
+ # Blending
+ GL_BLEND
+ GL_BLEND_SRC
+ GL_BLEND_DST
+ GL_ZERO
+ GL_ONE
+ GL_SRC_COLOR
+ GL_ONE_MINUS_SRC_COLOR
+ GL_SRC_ALPHA
+ GL_ONE_MINUS_SRC_ALPHA
+ GL_DST_ALPHA
+ GL_ONE_MINUS_DST_ALPHA
+ GL_DST_COLOR
+ GL_ONE_MINUS_DST_COLOR
+ GL_SRC_ALPHA_SATURATE
+
+ # Render Mode
+ GL_FEEDBACK
+ GL_RENDER
+ GL_SELECT
+
+ # Feedback
+ GL_2D
+ GL_3D
+ GL_3D_COLOR
+ GL_3D_COLOR_TEXTURE
+ GL_4D_COLOR_TEXTURE
+ GL_POINT_TOKEN
+ GL_LINE_TOKEN
+ GL_LINE_RESET_TOKEN
+ GL_POLYGON_TOKEN
+ GL_BITMAP_TOKEN
+ GL_DRAW_PIXEL_TOKEN
+ GL_COPY_PIXEL_TOKEN
+ GL_PASS_THROUGH_TOKEN
+ GL_FEEDBACK_BUFFER_POINTER
+ GL_FEEDBACK_BUFFER_SIZE
+ GL_FEEDBACK_BUFFER_TYPE
+
+ # Selection
+ GL_SELECTION_BUFFER_POINTER
+ GL_SELECTION_BUFFER_SIZE
+
+ # Fog
+ GL_FOG
+ GL_FOG_MODE
+ GL_FOG_DENSITY
+ GL_FOG_COLOR
+ GL_FOG_INDEX
+ GL_FOG_START
+ GL_FOG_END
+ GL_LINEAR
+ GL_EXP
+ GL_EXP2
+
+ # Logic Ops
+ GL_LOGIC_OP
+ GL_INDEX_LOGIC_OP
+ GL_COLOR_LOGIC_OP
+ GL_LOGIC_OP_MODE
+ GL_CLEAR
+ GL_SET
+ GL_COPY
+ GL_COPY_INVERTED
+ GL_NOOP
+ GL_INVERT
+ GL_AND
+ GL_NAND
+ GL_OR
+ GL_NOR
+ GL_XOR
+ GL_EQUIV
+ GL_AND_REVERSE
+ GL_AND_INVERTED
+ GL_OR_REVERSE
+ GL_OR_INVERTED
+
+ # Stencil
+ GL_STENCIL_BITS
+ GL_STENCIL_TEST
+ GL_STENCIL_CLEAR_VALUE
+ GL_STENCIL_FUNC
+ GL_STENCIL_VALUE_MASK
+ GL_STENCIL_FAIL
+ GL_STENCIL_PASS_DEPTH_FAIL
+ GL_STENCIL_PASS_DEPTH_PASS
+ GL_STENCIL_REF
+ GL_STENCIL_WRITEMASK
+ GL_STENCIL_INDEX
+ GL_KEEP
+ GL_REPLACE
+ GL_INCR
+ GL_DECR
+
+ # Buffers, Pixel Drawing/Reading
+ GL_NONE
+ GL_LEFT
+ GL_RIGHT
+ #GL_FRONT
+ #GL_BACK
+ #GL_FRONT_AND_BACK
+ GL_FRONT_LEFT
+ GL_FRONT_RIGHT
+ GL_BACK_LEFT
+ GL_BACK_RIGHT
+ GL_AUX0
+ GL_AUX1
+ GL_AUX2
+ GL_AUX3
+ GL_COLOR_INDEX
+ GL_RED
+ GL_GREEN
+ GL_BLUE
+ GL_ALPHA
+ GL_LUMINANCE
+ GL_LUMINANCE_ALPHA
+ GL_ALPHA_BITS
+ GL_RED_BITS
+ GL_GREEN_BITS
+ GL_BLUE_BITS
+ GL_INDEX_BITS
+ GL_SUBPIXEL_BITS
+ GL_AUX_BUFFERS
+ GL_READ_BUFFER
+ GL_DRAW_BUFFER
+ GL_DOUBLEBUFFER
+ GL_STEREO
+ GL_BITMAP
+ GL_COLOR
+ GL_DEPTH
+ GL_STENCIL
+ GL_DITHER
+ GL_RGB
+ GL_RGBA
+
+ # Implementation limits
+ GL_MAX_LIST_NESTING
+ GL_MAX_EVAL_ORDER
+ GL_MAX_LIGHTS
+ GL_MAX_CLIP_PLANES
+ GL_MAX_TEXTURE_SIZE
+ GL_MAX_PIXEL_MAP_TABLE
+ GL_MAX_ATTRIB_STACK_DEPTH
+ GL_MAX_MODELVIEW_STACK_DEPTH
+ GL_MAX_NAME_STACK_DEPTH
+ GL_MAX_PROJECTION_STACK_DEPTH
+ GL_MAX_TEXTURE_STACK_DEPTH
+ GL_MAX_VIEWPORT_DIMS
+ GL_MAX_CLIENT_ATTRIB_STACK_DEPTH
+
+ # Gets
+ GL_ATTRIB_STACK_DEPTH
+ GL_CLIENT_ATTRIB_STACK_DEPTH
+ GL_COLOR_CLEAR_VALUE
+ GL_COLOR_WRITEMASK
+ GL_CURRENT_INDEX
+ GL_CURRENT_COLOR
+ GL_CURRENT_NORMAL
+ GL_CURRENT_RASTER_COLOR
+ GL_CURRENT_RASTER_DISTANCE
+ GL_CURRENT_RASTER_INDEX
+ GL_CURRENT_RASTER_POSITION
+ GL_CURRENT_RASTER_TEXTURE_COORDS
+ GL_CURRENT_RASTER_POSITION_VALID
+ GL_CURRENT_TEXTURE_COORDS
+ GL_INDEX_CLEAR_VALUE
+ GL_INDEX_MODE
+ GL_INDEX_WRITEMASK
+ GL_MODELVIEW_MATRIX
+ GL_MODELVIEW_STACK_DEPTH
+ GL_NAME_STACK_DEPTH
+ GL_PROJECTION_MATRIX
+ GL_PROJECTION_STACK_DEPTH
+ GL_RENDER_MODE
+ GL_RGBA_MODE
+ GL_TEXTURE_MATRIX
+ GL_TEXTURE_STACK_DEPTH
+ GL_VIEWPORT
+
+ # Evaluators
+ GL_AUTO_NORMAL
+ GL_MAP1_COLOR_4
+ GL_MAP1_INDEX
+ GL_MAP1_NORMAL
+ GL_MAP1_TEXTURE_COORD_1
+ GL_MAP1_TEXTURE_COORD_2
+ GL_MAP1_TEXTURE_COORD_3
+ GL_MAP1_TEXTURE_COORD_4
+ GL_MAP1_VERTEX_3
+ GL_MAP1_VERTEX_4
+ GL_MAP2_COLOR_4
+ GL_MAP2_INDEX
+ GL_MAP2_NORMAL
+ GL_MAP2_TEXTURE_COORD_1
+ GL_MAP2_TEXTURE_COORD_2
+ GL_MAP2_TEXTURE_COORD_3
+ GL_MAP2_TEXTURE_COORD_4
+ GL_MAP2_VERTEX_3
+ GL_MAP2_VERTEX_4
+ GL_MAP1_GRID_DOMAIN
+ GL_MAP1_GRID_SEGMENTS
+ GL_MAP2_GRID_DOMAIN
+ GL_MAP2_GRID_SEGMENTS
+ GL_COEFF
+ GL_ORDER
+ GL_DOMAIN
+
+ # Hints
+ GL_PERSPECTIVE_CORRECTION_HINT
+ GL_POINT_SMOOTH_HINT
+ GL_LINE_SMOOTH_HINT
+ GL_POLYGON_SMOOTH_HINT
+ GL_FOG_HINT
+ GL_DONT_CARE
+ GL_FASTEST
+ GL_NICEST
+
+ # Scissor box
+ GL_SCISSOR_BOX
+ GL_SCISSOR_TEST
+
+ # Pixel Mode / Transfer
+ GL_MAP_COLOR
+ GL_MAP_STENCIL
+ GL_INDEX_SHIFT
+ GL_INDEX_OFFSET
+ GL_RED_SCALE
+ GL_RED_BIAS
+ GL_GREEN_SCALE
+ GL_GREEN_BIAS
+ GL_BLUE_SCALE
+ GL_BLUE_BIAS
+ GL_ALPHA_SCALE
+ GL_ALPHA_BIAS
+ GL_DEPTH_SCALE
+ GL_DEPTH_BIAS
+ GL_PIXEL_MAP_S_TO_S_SIZE
+ GL_PIXEL_MAP_I_TO_I_SIZE
+ GL_PIXEL_MAP_I_TO_R_SIZE
+ GL_PIXEL_MAP_I_TO_G_SIZE
+ GL_PIXEL_MAP_I_TO_B_SIZE
+ GL_PIXEL_MAP_I_TO_A_SIZE
+ GL_PIXEL_MAP_R_TO_R_SIZE
+ GL_PIXEL_MAP_G_TO_G_SIZE
+ GL_PIXEL_MAP_B_TO_B_SIZE
+ GL_PIXEL_MAP_A_TO_A_SIZE
+ GL_PIXEL_MAP_S_TO_S
+ GL_PIXEL_MAP_I_TO_I
+ GL_PIXEL_MAP_I_TO_R
+ GL_PIXEL_MAP_I_TO_G
+ GL_PIXEL_MAP_I_TO_B
+ GL_PIXEL_MAP_I_TO_A
+ GL_PIXEL_MAP_R_TO_R
+ GL_PIXEL_MAP_G_TO_G
+ GL_PIXEL_MAP_B_TO_B
+ GL_PIXEL_MAP_A_TO_A
+ GL_PACK_ALIGNMENT
+ GL_PACK_LSB_FIRST
+ GL_PACK_ROW_LENGTH
+ GL_PACK_SKIP_PIXELS
+ GL_PACK_SKIP_ROWS
+ GL_PACK_SWAP_BYTES
+ GL_UNPACK_ALIGNMENT
+ GL_UNPACK_LSB_FIRST
+ GL_UNPACK_ROW_LENGTH
+ GL_UNPACK_SKIP_PIXELS
+ GL_UNPACK_SKIP_ROWS
+ GL_UNPACK_SWAP_BYTES
+ GL_ZOOM_X
+ GL_ZOOM_Y
+
+ # Texture mapping
+ GL_TEXTURE_ENV
+ GL_TEXTURE_ENV_MODE
+ GL_TEXTURE_1D
+ GL_TEXTURE_2D
+ GL_TEXTURE_WRAP_S
+ GL_TEXTURE_WRAP_T
+ GL_TEXTURE_MAG_FILTER
+ GL_TEXTURE_MIN_FILTER
+ GL_TEXTURE_ENV_COLOR
+ GL_TEXTURE_GEN_S
+ GL_TEXTURE_GEN_T
+ GL_TEXTURE_GEN_MODE
+ GL_TEXTURE_BORDER_COLOR
+ GL_TEXTURE_WIDTH
+ GL_TEXTURE_HEIGHT
+ GL_TEXTURE_BORDER
+ GL_TEXTURE_COMPONENTS
+ GL_TEXTURE_RED_SIZE
+ GL_TEXTURE_GREEN_SIZE
+ GL_TEXTURE_BLUE_SIZE
+ GL_TEXTURE_ALPHA_SIZE
+ GL_TEXTURE_LUMINANCE_SIZE
+ GL_TEXTURE_INTENSITY_SIZE
+ GL_NEAREST_MIPMAP_NEAREST
+ GL_NEAREST_MIPMAP_LINEAR
+ GL_LINEAR_MIPMAP_NEAREST
+ GL_LINEAR_MIPMAP_LINEAR
+ GL_OBJECT_LINEAR
+ GL_OBJECT_PLANE
+ GL_EYE_LINEAR
+ GL_EYE_PLANE
+ GL_SPHERE_MAP
+ GL_DECAL
+ GL_MODULATE
+ GL_NEAREST
+ GL_REPEAT
+ GL_CLAMP
+ GL_S
+ GL_T
+ GL_R
+ GL_Q
+ GL_TEXTURE_GEN_R
+ GL_TEXTURE_GEN_Q
+
+ # Utility
+ GL_VENDOR
+ GL_RENDERER
+ GL_VERSION
+ GL_EXTENSIONS
+
+ # Errors
+ GL_NO_ERROR
+ GL_INVALID_ENUM
+ GL_INVALID_VALUE
+ GL_INVALID_OPERATION
+ GL_STACK_OVERFLOW
+ GL_STACK_UNDERFLOW
+ GL_OUT_OF_MEMORY
+
+ # glPush/PopAttrib bits
+ GL_CURRENT_BIT
+ GL_POINT_BIT
+ GL_LINE_BIT
+ GL_POLYGON_BIT
+ GL_POLYGON_STIPPLE_BIT
+ GL_PIXEL_MODE_BIT
+ GL_LIGHTING_BIT
+ GL_FOG_BIT
+ GL_DEPTH_BUFFER_BIT
+ GL_ACCUM_BUFFER_BIT
+ GL_STENCIL_BUFFER_BIT
+ GL_VIEWPORT_BIT
+ GL_TRANSFORM_BIT
+ GL_ENABLE_BIT
+ GL_COLOR_BUFFER_BIT
+ GL_HINT_BIT
+ GL_EVAL_BIT
+ GL_LIST_BIT
+ GL_TEXTURE_BIT
+ GL_SCISSOR_BIT
+ GL_ALL_ATTRIB_BITS
+
+ ##### OpenGL 1.1 #####
+
+ GL_PROXY_TEXTURE_1D
+ GL_PROXY_TEXTURE_2D
+ GL_TEXTURE_PRIORITY
+ GL_TEXTURE_RESIDENT
+ GL_TEXTURE_BINDING_1D
+ GL_TEXTURE_BINDING_2D
+ GL_TEXTURE_INTERNAL_FORMAT
+ GL_ALPHA4
+ GL_ALPHA8
+ GL_ALPHA12
+ GL_ALPHA16
+ GL_LUMINANCE4
+ GL_LUMINANCE8
+ GL_LUMINANCE12
+ GL_LUMINANCE16
+ GL_LUMINANCE4_ALPHA4
+ GL_LUMINANCE6_ALPHA2
+ GL_LUMINANCE8_ALPHA8
+ GL_LUMINANCE12_ALPHA4
+ GL_LUMINANCE12_ALPHA12
+ GL_LUMINANCE16_ALPHA16
+ GL_INTENSITY
+ GL_INTENSITY4
+ GL_INTENSITY8
+ GL_INTENSITY12
+ GL_INTENSITY16
+ GL_R3_G3_B2
+ GL_RGB4
+ GL_RGB5
+ GL_RGB8
+ GL_RGB10
+ GL_RGB12
+ GL_RGB16
+ GL_RGBA2
+ GL_RGBA4
+ GL_RGB5_A1
+ GL_RGBA8
+ GL_RGB10_A2
+ GL_RGBA12
+ GL_RGBA16
+ GL_CLIENT_PIXEL_STORE_BIT
+ GL_CLIENT_VERTEX_ARRAY_BIT
+ GL_ALL_CLIENT_ATTRIB_BITS
+ GL_CLIENT_ALL_ATTRIB_BITS
+
+ ##### OpenGL 1.2 #####
+
+ GL_RESCALE_NORMAL
+ GL_CLAMP_TO_EDGE
+ GL_MAX_ELEMENTS_VERTICES
+ GL_MAX_ELEMENTS_INDICES
+ GL_BGR
+ GL_BGRA
+ GL_UNSIGNED_BYTE_3_3_2
+ GL_UNSIGNED_BYTE_2_3_3_REV
+ GL_UNSIGNED_SHORT_5_6_5
+ GL_UNSIGNED_SHORT_5_6_5_REV
+ GL_UNSIGNED_SHORT_4_4_4_4
+ GL_UNSIGNED_SHORT_4_4_4_4_REV
+ GL_UNSIGNED_SHORT_5_5_5_1
+ GL_UNSIGNED_SHORT_1_5_5_5_REV
+ GL_UNSIGNED_INT_8_8_8_8
+ GL_UNSIGNED_INT_8_8_8_8_REV
+ GL_UNSIGNED_INT_10_10_10_2
+ GL_UNSIGNED_INT_2_10_10_10_REV
+ GL_LIGHT_MODEL_COLOR_CONTROL
+ GL_SINGLE_COLOR
+ GL_SEPARATE_SPECULAR_COLOR
+ GL_TEXTURE_MIN_LOD
+ GL_TEXTURE_MAX_LOD
+ GL_TEXTURE_BASE_LEVEL
+ GL_TEXTURE_MAX_LEVEL
+ GL_SMOOTH_POINT_SIZE_RANGE
+ GL_SMOOTH_POINT_SIZE_GRANULARITY
+ GL_SMOOTH_LINE_WIDTH_RANGE
+ GL_SMOOTH_LINE_WIDTH_GRANULARITY
+ GL_ALIASED_POINT_SIZE_RANGE
+ GL_ALIASED_LINE_WIDTH_RANGE
+ GL_PACK_SKIP_IMAGES
+ GL_PACK_IMAGE_HEIGHT
+ GL_UNPACK_SKIP_IMAGES
+ GL_UNPACK_IMAGE_HEIGHT
+ GL_TEXTURE_3D
+ GL_PROXY_TEXTURE_3D
+ GL_TEXTURE_DEPTH
+ GL_TEXTURE_WRAP_R
+ GL_MAX_3D_TEXTURE_SIZE
+ GL_TEXTURE_BINDING_3D
+
+ # GL_ARB_imaging
+ GL_CONSTANT_COLOR
+ GL_ONE_MINUS_CONSTANT_COLOR
+ GL_CONSTANT_ALPHA
+ GL_ONE_MINUS_CONSTANT_ALPHA
+ GL_COLOR_TABLE
+ GL_POST_CONVOLUTION_COLOR_TABLE
+ GL_POST_COLOR_MATRIX_COLOR_TABLE
+ GL_PROXY_COLOR_TABLE
+ GL_PROXY_POST_CONVOLUTION_COLOR_TABLE
+ GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE
+ GL_COLOR_TABLE_SCALE
+ GL_COLOR_TABLE_BIAS
+ GL_COLOR_TABLE_FORMAT
+ GL_COLOR_TABLE_WIDTH
+ GL_COLOR_TABLE_RED_SIZE
+ GL_COLOR_TABLE_GREEN_SIZE
+ GL_COLOR_TABLE_BLUE_SIZE
+ GL_COLOR_TABLE_ALPHA_SIZE
+ GL_COLOR_TABLE_LUMINANCE_SIZE
+ GL_COLOR_TABLE_INTENSITY_SIZE
+ GL_CONVOLUTION_1D
+ GL_CONVOLUTION_2D
+ GL_SEPARABLE_2D
+ GL_CONVOLUTION_BORDER_MODE
+ GL_CONVOLUTION_FILTER_SCALE
+ GL_CONVOLUTION_FILTER_BIAS
+ GL_REDUCE
+ GL_CONVOLUTION_FORMAT
+ GL_CONVOLUTION_WIDTH
+ GL_CONVOLUTION_HEIGHT
+ GL_MAX_CONVOLUTION_WIDTH
+ GL_MAX_CONVOLUTION_HEIGHT
+ GL_POST_CONVOLUTION_RED_SCALE
+ GL_POST_CONVOLUTION_GREEN_SCALE
+ GL_POST_CONVOLUTION_BLUE_SCALE
+ GL_POST_CONVOLUTION_ALPHA_SCALE
+ GL_POST_CONVOLUTION_RED_BIAS
+ GL_POST_CONVOLUTION_GREEN_BIAS
+ GL_POST_CONVOLUTION_BLUE_BIAS
+ GL_POST_CONVOLUTION_ALPHA_BIAS
+ GL_CONSTANT_BORDER
+ GL_REPLICATE_BORDER
+ GL_CONVOLUTION_BORDER_COLOR
+ GL_COLOR_MATRIX
+ GL_COLOR_MATRIX_STACK_DEPTH
+ GL_MAX_COLOR_MATRIX_STACK_DEPTH
+ GL_POST_COLOR_MATRIX_RED_SCALE
+ GL_POST_COLOR_MATRIX_GREEN_SCALE
+ GL_POST_COLOR_MATRIX_BLUE_SCALE
+ GL_POST_COLOR_MATRIX_ALPHA_SCALE
+ GL_POST_COLOR_MATRIX_RED_BIAS
+ GL_POST_COLOR_MATRIX_GREEN_BIAS
+ GL_POST_COLOR_MATRIX_BLUE_BIAS
+ GL_POST_COLOR_MATRIX_ALPHA_BIAS
+ GL_HISTOGRAM
+ GL_PROXY_HISTOGRAM
+ GL_HISTOGRAM_WIDTH
+ GL_HISTOGRAM_FORMAT
+ GL_HISTOGRAM_RED_SIZE
+ GL_HISTOGRAM_GREEN_SIZE
+ GL_HISTOGRAM_BLUE_SIZE
+ GL_HISTOGRAM_ALPHA_SIZE
+ GL_HISTOGRAM_LUMINANCE_SIZE
+ GL_HISTOGRAM_SINK
+ GL_MINMAX
+ GL_MINMAX_FORMAT
+ GL_MINMAX_SINK
+ GL_TABLE_TOO_LARGE
+ GL_BLEND_EQUATION
+ GL_MIN
+ GL_MAX
+ GL_FUNC_ADD
+ GL_FUNC_SUBTRACT
+ GL_FUNC_REVERSE_SUBTRACT
+ GL_BLEND_COLOR
+
+ ##### OpenGL 1.3 #####
+
+ # multitexture
+ GL_TEXTURE0
+ GL_TEXTURE1
+ GL_TEXTURE2
+ GL_TEXTURE3
+ GL_TEXTURE4
+ GL_TEXTURE5
+ GL_TEXTURE6
+ GL_TEXTURE7
+ GL_TEXTURE8
+ GL_TEXTURE9
+ GL_TEXTURE10
+ GL_TEXTURE11
+ GL_TEXTURE12
+ GL_TEXTURE13
+ GL_TEXTURE14
+ GL_TEXTURE15
+ GL_TEXTURE16
+ GL_TEXTURE17
+ GL_TEXTURE18
+ GL_TEXTURE19
+ GL_TEXTURE20
+ GL_TEXTURE21
+ GL_TEXTURE22
+ GL_TEXTURE23
+ GL_TEXTURE24
+ GL_TEXTURE25
+ GL_TEXTURE26
+ GL_TEXTURE27
+ GL_TEXTURE28
+ GL_TEXTURE29
+ GL_TEXTURE30
+ GL_TEXTURE31
+ GL_ACTIVE_TEXTURE
+ GL_CLIENT_ACTIVE_TEXTURE
+ GL_MAX_TEXTURE_UNITS
+
+ # texture_cube_map
+ GL_NORMAL_MAP
+ GL_REFLECTION_MAP
+ GL_TEXTURE_CUBE_MAP
+ GL_TEXTURE_BINDING_CUBE_MAP
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+ GL_PROXY_TEXTURE_CUBE_MAP
+ GL_MAX_CUBE_MAP_TEXTURE_SIZE
+
+ # texture_compression
+ GL_COMPRESSED_ALPHA
+ GL_COMPRESSED_LUMINANCE
+ GL_COMPRESSED_LUMINANCE_ALPHA
+ GL_COMPRESSED_INTENSITY
+ GL_COMPRESSED_RGB
+ GL_COMPRESSED_RGBA
+ GL_TEXTURE_COMPRESSION_HINT
+ GL_TEXTURE_COMPRESSED_IMAGE_SIZE
+ GL_TEXTURE_COMPRESSED
+ GL_NUM_COMPRESSED_TEXTURE_FORMATS
+ GL_COMPRESSED_TEXTURE_FORMATS
+
+ # multisample
+ GL_MULTISAMPLE
+ GL_SAMPLE_ALPHA_TO_COVERAGE
+ GL_SAMPLE_ALPHA_TO_ONE
+ GL_SAMPLE_COVERAGE
+ GL_SAMPLE_BUFFERS
+ GL_SAMPLES
+ GL_SAMPLE_COVERAGE_VALUE
+ GL_SAMPLE_COVERAGE_INVERT
+ GL_MULTISAMPLE_BIT
+
+ # transpose_matrix
+ GL_TRANSPOSE_MODELVIEW_MATRIX
+ GL_TRANSPOSE_PROJECTION_MATRIX
+ GL_TRANSPOSE_TEXTURE_MATRIX
+ GL_TRANSPOSE_COLOR_MATRIX
+
+ # texture_env_combine
+ GL_COMBINE
+ GL_COMBINE_RGB
+ GL_COMBINE_ALPHA
+ GL_SOURCE0_RGB
+ GL_SOURCE1_RGB
+ GL_SOURCE2_RGB
+ GL_SOURCE0_ALPHA
+ GL_SOURCE1_ALPHA
+ GL_SOURCE2_ALPHA
+ GL_OPERAND0_RGB
+ GL_OPERAND1_RGB
+ GL_OPERAND2_RGB
+ GL_OPERAND0_ALPHA
+ GL_OPERAND1_ALPHA
+ GL_OPERAND2_ALPHA
+ GL_RGB_SCALE
+ GL_ADD_SIGNED
+ GL_INTERPOLATE
+ GL_SUBTRACT
+ GL_CONSTANT
+ GL_PRIMARY_COLOR
+ GL_PREVIOUS
+
+ # texture_env_dot3
+ GL_DOT3_RGB
+ GL_DOT3_RGBA
+
+ # texture_border_clamp
+ GL_CLAMP_TO_BORDER
+
+
+ # GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
+ GL_TEXTURE0_ARB
+ GL_TEXTURE1_ARB
+ GL_TEXTURE2_ARB
+ GL_TEXTURE3_ARB
+ GL_TEXTURE4_ARB
+ GL_TEXTURE5_ARB
+ GL_TEXTURE6_ARB
+ GL_TEXTURE7_ARB
+ GL_TEXTURE8_ARB
+ GL_TEXTURE9_ARB
+ GL_TEXTURE10_ARB
+ GL_TEXTURE11_ARB
+ GL_TEXTURE12_ARB
+ GL_TEXTURE13_ARB
+ GL_TEXTURE14_ARB
+ GL_TEXTURE15_ARB
+ GL_TEXTURE16_ARB
+ GL_TEXTURE17_ARB
+ GL_TEXTURE18_ARB
+ GL_TEXTURE19_ARB
+ GL_TEXTURE20_ARB
+ GL_TEXTURE21_ARB
+ GL_TEXTURE22_ARB
+ GL_TEXTURE23_ARB
+ GL_TEXTURE24_ARB
+ GL_TEXTURE25_ARB
+ GL_TEXTURE26_ARB
+ GL_TEXTURE27_ARB
+ GL_TEXTURE28_ARB
+ GL_TEXTURE29_ARB
+ GL_TEXTURE30_ARB
+ GL_TEXTURE31_ARB
+ GL_ACTIVE_TEXTURE_ARB
+ GL_CLIENT_ACTIVE_TEXTURE_ARB
+ GL_MAX_TEXTURE_UNITS_ARB
+
+ # GLU quadratic flags
+ GLU_SMOOTH
+ GLU_FLAT
+ GLU_NONE
+
+ # GLEW response flags
+ GLEW_OK
+ GLEW_NO_ERROR
+ GLEW_ERROR_NO_GL_VERSION
+ GLEW_ERROR_GL_VERSION_10_ONLY
+ GLEW_ERROR_GLX_VERSION_11_ONLY
+
+ # GLEW rendering flags
+ GLEW_EXT_vertex_array
+ GLEW_ARB_vertex_buffer_object
+
+ # Data types
+ ctypedef unsigned int GLenum
+ ctypedef unsigned char GLboolean
+ ctypedef unsigned int GLbitfield
+ ctypedef void GLvoid
+ ctypedef signed char GLbyte
+ ctypedef short GLshort
+ ctypedef int GLint
+ ctypedef unsigned char GLubyte
+ ctypedef unsigned short GLushort
+ ctypedef unsigned int GLuint
+ ctypedef int GLsizei
+ ctypedef float GLfloat
+ ctypedef float GLclampf
+ ctypedef double GLdouble
+ ctypedef double GLclampd
+ ctypedef char GLchar
+ ctypedef unsigned int GLhandleARB
+ ctypedef long GLintptrARB
+ ctypedef long GLsizeiptrARB
+ ctypedef void GLUquadricObj
+
+
+ # Miscellaneous
+ cdef void glClearIndex ( GLfloat c )
+ cdef void glClearColor ( GLclampf, GLclampf, GLclampf,
+ GLclampf )
+ cdef void glClear ( GLbitfield )
+ cdef void glIndexMask ( GLuint )
+ cdef void glColorMask ( GLboolean, GLboolean, GLboolean,
+ GLboolean )
+ cdef void glAlphaFunc ( GLenum, GLclampf )
+ cdef void glBlendFunc ( GLenum, GLenum )
+ cdef void glLogicOp ( GLenum )
+ cdef void glCullFace ( GLenum )
+ cdef void glFrontFace ( GLenum )
+ cdef void glPointSize ( GLfloat )
+ cdef void glLineWidth ( GLfloat )
+ cdef void glLineStipple ( GLint, GLushort )
+ cdef void glPolygonMode ( GLenum, GLenum )
+ cdef void glPolygonOffset ( GLfloat, GLfloat )
+ cdef void glPolygonStipple ( GLubyte* )
+ cdef void glGetPolygonStipple ( GLubyte* )
+ cdef void glEdgeFlag ( GLboolean )
+ cdef void glEdgeFlagv ( GLboolean* )
+ cdef void glScissor ( GLint, GLint, GLsizei, GLsizei )
+ cdef void glClipPlane ( GLenum, GLdouble* )
+ cdef void glGetClipPlane ( GLenum plane, GLdouble *equation )
+ cdef void glDrawBuffer ( GLenum )
+ cdef void glReadBuffer ( GLenum )
+ cdef void glEnable ( GLenum )
+ cdef void glDisable ( GLenum )
+ cdef GLboolean glIsEnabled ( GLenum cap )
+ cdef void glEnableClientState ( GLenum )
+ cdef void glDisableClientState ( GLenum )
+ cdef void glGetBooleanv ( GLenum, GLboolean* )
+ cdef void glGetDoublev ( GLenum, GLdouble* )
+ cdef void glGetFloatv ( GLenum, GLfloat* )
+ cdef void glGetIntegerv ( GLenum, GLint* )
+ cdef void glPushAttrib ( GLbitfield )
+ cdef void glPopAttrib ( )
+ cdef void glPushClientAttrib ( GLbitfield ) # OpenGL 1.1
+ cdef void glPopClientAttrib ( ) # OpenGL 1.1
+ cdef GLint glRenderMode ( GLenum )
+ cdef GLenum glGetError ( )
+ cdef GLubyte *glGetString ( GLenum )
+ cdef void glFinish ( )
+ cdef void glFlush ( )
+ cdef void glHint ( GLenum, GLenum )
+
+ # Depth Buffer
+ cdef void glClearDepth ( GLclampd )
+ cdef void glDepthFunc ( GLenum )
+
+ # Transformations
+ cdef void glMatrixMode( GLenum )
+ cdef void glOrtho( GLdouble left, GLdouble right, \
+ GLdouble bottom, GLdouble top, \
+ GLdouble near_val, GLdouble far_val )
+ cdef void glViewport( GLint, GLint, GLsizei, GLsizei height )
+ cdef void glPushMatrix()
+ cdef void glPopMatrix()
+ cdef void glLoadIdentity()
+ cdef void glLoadMatrixf( GLfloat* )
+ cdef void glMultMatrixf( GLfloat* )
+ cdef void glScalef( GLfloat, GLfloat, GLfloat )
+ cdef void glTranslatef( GLfloat, GLfloat, GLfloat )
+
+ # Legacy Functions
+ cdef void glBegin( GLenum )
+ cdef void glEnd()
+ cdef void glVertex2f( GLfloat, GLfloat y )
+ cdef void glVertex3f( GLfloat, GLfloat, GLfloat z )
+ cdef void glNormal3f( GLfloat, GLfloat, GLfloat z )
+ cdef void glColor3f( GLfloat r, GLfloat g, GLfloat b )
+ cdef void glColor3ub( GLubyte r, GLubyte g, GLubyte b )
+ cdef void glColor4ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
+
+ # Vertex Array Functions
+ cdef void glVertexPointer ( GLint, GLenum, GLsizei, GLvoid* )
+ cdef void glNormalPointer ( GLenum, GLsizei, GLvoid* )
+ cdef void glColorPointer ( GLint, GLenum, GLsizei, GLvoid* )
+ cdef void glTexCoordPointer ( GLint, GLenum, GLsizei, GLvoid* )
+ cdef void glDrawArrays ( GLenum, GLint, GLsizei )
+ cdef void glDrawElements ( GLenum, GLsizei, GLenum, GLvoid* )
+
+ # VBO Functions
+ cdef void glBindBufferARB ( GLenum, GLuint )
+ cdef void glDeleteBuffersARB ( GLsizei, GLuint* )
+ cdef void glGenBuffersARB ( GLsizei, GLuint* )
+ cdef void glBufferDataARB ( GLenum, GLsizeiptrARB, GLvoid*,
+ GLenum )
+ cdef void glBufferSubDataARB ( GLenum, GLintptrARB,
+ GLsizeiptrARB, GLvoid* )
+ cdef void glGetBufferSubDataARB ( GLenum, GLintptrARB,
+ GLsizeiptrARB, GLvoid* )
+ cdef void *glMapBufferARB ( GLenum, GLenum )
+ cdef void glGetBufferParameterivARB ( GLenum, GLenum, GLint* )
+ cdef void glGetBufferPointervARB ( GLenum, GLenum, GLvoid** )
+ cdef GLboolean glIsBufferARB ( GLuint )
+ cdef GLboolean glUnmapBufferARB ( GLenum )
+
+ # Lighting
+ cdef void glShadeModel ( GLenum )
+ cdef void glLightf ( GLenum, GLenum, GLfloat )
+ cdef void glLighti ( GLenum, GLenum, GLint )
+ cdef void glLightfv ( GLenum, GLenum, GLfloat* )
+ cdef void glLightiv ( GLenum, GLenum, GLint* )
+ cdef void glGetLightfv ( GLenum, GLenum, GLfloat* )
+ cdef void glGetLightiv ( GLenum, GLenum, GLint* )
+ cdef void glLightModelf ( GLenum, GLfloat )
+ cdef void glLightModeli ( GLenum, GLint )
+ cdef void glLightModelfv ( GLenum, GLfloat* )
+ cdef void glLightModeliv ( GLenum, GLint* )
+ cdef void glMaterialf ( GLenum, GLenum, GLfloat )
+ cdef void glMateriali ( GLenum, GLenum, GLint )
+ cdef void glMaterialfv ( GLenum, GLenum, GLfloat* )
+ cdef void glMaterialiv ( GLenum, GLenum, GLint* )
+ cdef void glGetMaterialfv ( GLenum, GLenum, GLfloat* )
+ cdef void glGetMaterialiv ( GLenum, GLenum, GLint* )
+ cdef void glColorMaterial ( GLenum, GLenum )
+
+ # Texture Mapping
+ cdef void glTexParameterf ( GLenum, GLenum, GLfloat )
+ cdef void glTexParameteri ( GLenum, GLenum, GLint )
+ cdef void glTexImage1D ( GLenum, GLint, GLint, GLsizei, GLint, GLenum,
+ GLenum, GLvoid* )
+ cdef void glTexImage2D ( GLenum, GLint, GLint, GLsizei, GLsizei, GLint,
+ GLenum, GLenum, GLvoid* )
+ cdef void glTexImage3D ( GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei,
+ GLint, GLenum, GLenum, GLvoid* )
+ cdef void glGenTextures ( GLsizei, GLuint* )
+ cdef void glDeleteTextures ( GLsizei, GLuint* )
+ cdef void glBindTexture ( GLenum, GLuint )
+ cdef void glPrioritizeTextures( GLsizei, GLuint*, GLclampf* )
+ cdef GLboolean glAreTexturesResident( GLsizei, GLuint*, GLboolean* )
+ cdef GLboolean glIsTexture ( GLuint )
+ cdef void glTexSubImage1D ( GLenum, GLint, GLint, GLsizei, GLenum,
+ GLenum, GLvoid* )
+ cdef void glTexSubImage2D ( GLenum, GLint, GLint, GLint, GLsizei, GLsizei,
+ GLenum, GLenum, GLvoid* )
+ cdef void glTexSubImage3D ( GLenum, GLint, GLint, GLint, GLint, GLsizei,
+ GLsizei, GLsizei, GLenum, GLenum, GLvoid* )
+ cdef void glCopyTexImage1D ( GLenum, GLint, GLenum, GLint, GLint,
+ GLsizei, GLint )
+ cdef void glCopyTexImage2D ( GLenum, GLint, GLenum, GLint, GLint,
+ GLsizei, GLsizei, GLint )
+ cdef void glCopyTexSubImage1D( GLenum, GLint, GLint, GLint, GLint, GLsizei )
+ cdef void glCopyTexSubImage2D( GLenum, GLint, GLint, GLint, GLint, GLint,
+ GLsizei, GLsizei )
+ cdef void glCopyTexSubImage3D( GLenum, GLint, GLint, GLint, GLint, GLint,
+ GLint, GLsizei, GLsizei )
+
+ # GLU
+ cdef void gluPerspective( GLdouble, GLdouble,
+ GLdouble, GLdouble )
+ cdef void gluSphere( GLUquadricObj*, GLdouble, GLint, GLint )
+ cdef void gluCylinder( GLUquadricObj*, GLdouble, GLdouble, GLdouble,
+ GLint, GLint )
+ cdef GLUquadricObj* gluNewQuadric( )
+ cdef void gluDeleteQuadric( GLUquadricObj* )
+ cdef void gluQuadricNormals( GLUquadricObj*, GLenum )
+ cdef void gluQuadricTexture( GLUquadricObj*, GLenum )
+
+ # GLEW
+ cdef GLenum glewInit ( )
+ cdef GLboolean glewIsSupported ( char* )
+
+cdef extern from "GL/glu.h":
+
+ ctypedef enum:
+
+ # TessCallback
+ GLU_TESS_BEGIN
+ GLU_BEGIN
+ GLU_TESS_VERTEX
+ GLU_VERTEX
+ GLU_TESS_END
+ GLU_END
+ GLU_TESS_ERROR
+ GLU_TESS_EDGE_FLAG
+ GLU_EDGE_FLAG
+ GLU_TESS_COMBINE
+ GLU_TESS_BEGIN_DATA
+ GLU_TESS_VERTEX_DATA
+ GLU_TESS_END_DATA
+ GLU_TESS_ERROR_DATA
+ GLU_TESS_EDGE_FLAG_DATA
+ GLU_TESS_COMBINE_DATA
+
+ # TessProperty
+ GLU_TESS_WINDING_RULE
+
+ # TessWinding
+ GLU_TESS_WINDING_NONZERO
+
+ ctypedef struct GLUtesselator "GLUtesselator"
+ cdef GLUtesselator* gluNewTess ()
+ ctypedef void (*_GLUfuncptr)()
+ cdef void gluTessCallback (GLUtesselator*, GLenum, _GLUfuncptr)
+ cdef void gluTessNormal (GLUtesselator*, GLdouble, GLdouble, GLdouble)
+ cdef void gluTessProperty (GLUtesselator*, GLenum, GLdouble)
+ cdef void gluTessBeginPolygon (GLUtesselator*, GLvoid*)
+ cdef void gluTessBeginContour (GLUtesselator*)
+ cdef void gluTessVertex (GLUtesselator*, GLdouble *, GLvoid*)
+ cdef void gluTessEndContour (GLUtesselator*)
+ cdef void gluTessEndPolygon (GLUtesselator*)
\ No newline at end of file
diff --git a/python/include/glfw.pxd b/python/include/glfw.pxd
new file mode 100644
index 0000000..9c98436
--- /dev/null
+++ b/python/include/glfw.pxd
@@ -0,0 +1,70 @@
+# GLFW Declarations
+# Copyright 2009 Mason Green & Tom Novelli
+#
+# This file is part of OpenMelee.
+#
+# OpenMelee is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# any later version.
+#
+# OpenMelee is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenMelee. If not, see .
+
+cdef extern from "GL/glfw.h":
+
+ ctypedef enum:
+ GLFW_WINDOW
+ GLFW_FULLSCREEN
+ GLFW_STICKY_KEYS
+ GLFW_OPENED
+ GLFW_KEY_ESC
+ GLFW_PRESS
+
+ # Function pointer types
+ ctypedef void (__stdcall * GLFWwindowsizefun)(int, int)
+ ctypedef int (__stdcall * GLFWwindowclosefun)()
+ ctypedef void (__stdcall * GLFWwindowrefreshfun)()
+ ctypedef void (__stdcall * GLFWmousebuttonfun)(int, int)
+ ctypedef void (__stdcall * GLFWmouseposfun)(int, int)
+ ctypedef void (__stdcall * GLFWmousewheelfun)(int)
+ ctypedef void (__stdcall * GLFWkeyfun)(int, int)
+ ctypedef void (__stdcall * GLFWcharfun)(int, int)
+ ctypedef void (__stdcall * GLFWthreadfun)()
+
+ int glfwInit()
+ void glfwTerminate()
+ void glfwSetWindowTitle(char *title)
+ int glfwOpenWindow( int width, int height,
+ int redbits, int greenbits, int bluebits, int alphabits,
+ int depthbits, int stencilbits, int mode )
+ void glfwSwapInterval( int interval )
+ void glfwSwapBuffers()
+ void glfwEnable( int token )
+ int glfwGetWindowParam( int param )
+ int glfwGetKey( int key )
+ int glfwGetWindowParam( int param )
+ void glfwGetWindowSize( int *width, int *height )
+ double glfwGetTime()
+ void glfwSetTime(double time)
+
+ # Input handling
+ void glfwPollEvents()
+ void glfwWaitEvents()
+ int glfwGetKey( int key )
+ int glfwGetMouseButton( int button )
+ void glfwGetMousePos( int *xpos, int *ypos )
+ void glfwSetMousePos( int xpos, int ypos )
+ int glfwGetMouseWheel()
+ void glfwSetMouseWheel( int pos )
+ void glfwSetKeyCallback(GLFWkeyfun cbfun)
+ void glfwSetCharCallback( GLFWcharfun cbfun )
+ void glfwSetMouseButtonCallback( GLFWmousebuttonfun cbfun )
+ void glfwSetMousePosCallback( GLFWmouseposfun cbfun )
+ void glfwSetMouseWheelCallback( GLFWmousewheelfun cbfun )
+
\ No newline at end of file
diff --git a/python/setup.py b/python/setup.py
new file mode 100644
index 0000000..1e37dc5
--- /dev/null
+++ b/python/setup.py
@@ -0,0 +1,44 @@
+import sys
+import os
+
+from distutils.core import setup
+from distutils.extension import Extension
+from Cython.Distutils import build_ext
+
+# Usage: python setup.py build_ext --i
+
+version = '0.01'
+
+sourcefiles = ['engine/engine.pyx']
+
+# Platform-dependent submodules
+
+if sys.platform == 'win32':
+ # MS Windows
+ libs = ['glew32', 'glu32', 'glfw', 'opengl32']
+elif sys.platform == 'darwin':
+ # Apple OSX
+ raise SystemError('OSX is unsupported in this version')
+else:
+ # GNU/Linux, BSD, etc
+ libs = ['GLEW', 'GLU', 'glfw', 'GL']
+
+mod_engine = Extension(
+ "engine",
+ sourcefiles,
+ libraries = libs,
+ language = 'c'
+)
+
+setup(
+ name = 'OpenMelee',
+ version = version,
+ description = 'A Star Control Clone',
+ author = 'Mason Green & Tom Novelli',
+ author_email = '',
+ maintainer = '',
+ maintainer_email = '',
+ url = 'http://openmelee.org/',
+ cmdclass = {'build_ext': build_ext},
+ ext_modules = [mod_engine],
+)
\ No newline at end of file
diff --git a/python/triangulator.pyx b/python/triangulator.pyx
new file mode 100644
index 0000000..f0ac3a2
--- /dev/null
+++ b/python/triangulator.pyx
@@ -0,0 +1,647 @@
+#
+# Copyright (c) 2009 Mason Green & Tom Novelli
+#
+# This file is part of OpenMelee.
+#
+# OpenMelee is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# any later version.
+#
+# OpenMelee is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenMelee. If not, see .
+#
+from math import floor
+
+###
+### Based on Raimund Seidel's paper "A simple and fast incremental randomized
+### algorithm for computing trapezoidal decompositions and for triangulating polygons"
+### (Ported from poly2tri)
+
+class Triangulator(object) {
+
+ def __init__(points):
+
+ # Convex polygon list
+ self.polygons = []
+ # Order and randomize the Edges
+ self.EdgeList = initEdges()
+
+ # Initialize trapezoidal map and query structure
+ self.trapezoidalMap = new TrapezoidalMap
+ self.bounding_box = trapezoidalMap.bounding_box(EdgeList)
+ self.queryGraph = QueryGraph(Sink.init(bounding_box))
+ self.xMonoPoly = []
+
+ # The trapezoidal map
+ self.trapezoidMap = trapezoidalMap.map
+ # Trapezoid decomposition list
+ self.trapezoids = []
+
+ self.process()
+
+ // Build the trapezoidal map and query graph
+ def process(self):
+
+ i = 0
+ while(i < len(EdgeList)):
+
+ s = EdgeList(i)
+ traps = queryGraph.followEdge(s)
+
+ // Remove trapezoids from trapezoidal Map
+ for j in range(len(traps)):
+ trapezoidalMap.map -= traps(j)
+
+ for j in range(len(traps)):
+ t = traps(j)
+ tList = []
+ containsP = t.contains(s.p)
+ containsQ = t.contains(s.q)
+ if containsP and containsQ:
+ // Case 1
+ tList = trapezoidalMap.case1(t,s)
+ queryGraph.case1(t.sink, s, tList)
+ elif containsP and !containsQ:
+ // Case 2
+ tList = trapezoidalMap.case2(t,s)
+ queryGraph.case2(t.sink, s, tList)
+ elif !containsP and !containsQ:
+ // Case 3
+ tList = trapezoidalMap.case3(t, s)
+ queryGraph.case3(t.sink, s, tList)
+ else:
+ // Case 4
+ tList = trapezoidalMap.case4(t, s)
+ queryGraph.case4(t.sink, s, tList)
+
+ // Add new trapezoids to map
+ for k in range(len(tList)):
+ trapezoidalMap.map += tList[k]
+
+ trapezoidalMap.clear
+ i += 1
+
+ // Mark outside trapezoids
+ for t in trapezoidalMap.map
+ markOutside(t)
+
+ // Collect interior trapezoids
+ for t in trapezoidalMap.map
+ if t.inside:
+ trapezoids.append(t)
+ t.addPoints()
+
+ // Generate the triangles
+ createMountains
+
+ }
+
+ // Monotone polygons - these are monotone mountains
+ def monoPolies(self):
+ polies = []
+ for i in range(len(self.xMonoPoly)):
+ polies.append(self.xMonoPoly(i).monoPoly)
+ return polies
+
+
+ // Build a list of x-monotone mountains
+ private def createMountains {
+
+ var i = 0
+ while(i < EdgeList.size) {
+
+ val s = EdgeList(i)
+
+ if(s.mPoints.size > 0) {
+
+ val mountain = new MonotoneMountain
+ var k: List[Point] = None
+
+ // Sorting is a perfromance hit. Literature says this can be accomplised in
+ // linear time, although I don't see a way around using traditional methods
+ // when using a randomized incremental algorithm
+ if(s.mPoints.size < 10)
+ // Insertion sort is one of the fastest algorithms for sorting arrays containing
+ // fewer than ten elements, or for lists that are already mostly sorted.
+ k = Util.insertSort((p1: Point, p2: Point) => p1 < p2)(s.mPoints).toList
+ else
+ k = Util.msort((p1: Point, p2: Point) => p1 < p2)(s.mPoints.toList)
+
+ val points = s.p :: k ::: List(s.q)
+
+ var j = 0
+ while(j < points.size) {
+ mountain += points(j)
+ j += 1
+ }
+
+ // Triangulate monotone mountain
+ mountain process
+
+ // Extract the triangles into a single list
+ j = 0
+ while(j < mountain.triangles.size) {
+ polygons += mountain.triangles(j)
+ j += 1
+ }
+
+ xMonoPoly += mountain
+ }
+ i += 1
+ }
+ }
+
+ // Mark the outside trapezoids surrounding the polygon
+ private def markOutside(t: Trapezoid) {
+ if(t.top == bounding_box.top || t.bottom == bounding_box.bottom) {
+ t trimNeighbors
+ }
+ }
+
+ // Create Edges and connect end points; update edge event pointer
+ private def initEdges: ArrayBuffer[Edge] = {
+ var Edges = List[Edge]()
+ for(i <- 0 until points.size-1)
+ Edges = new Edge(points(i), points(i+1)) :: Edges
+ Edges = new Edge(points.first, points.last) :: Edges
+ orderEdges(Edges)
+ }
+
+ private def orderEdges(Edges: List[Edge]) = {
+
+ // Ignore vertical Edges!
+ val segs = new ArrayBuffer[Edge]
+ for(s <- Edges) {
+ val p = shearTransform(s.p)
+ val q = shearTransform(s.q)
+ // Point p must be to the left of point q
+ if(p.x > q.x) {
+ segs += new Edge(q, p)
+ } else if(p.x < q.x) {
+ segs += new Edge(p, q)
+ }
+ }
+ // Randomized triangulation improves performance
+ // See Seidel's paper, or O'Rourke's book, p. 57
+ Random.shuffle(segs)
+ segs
+ }
+
+ // Prevents any two distinct endpoints from lying on a common vertical line, and avoiding
+ // the degenerate case. See Mark de Berg et al, Chapter 6.3
+ //val SHEER = 0.0001f
+ def shearTransform(point: Point) = Point(point.x + 0.0001f * point.y, point.y)
+
+}
+
+// Doubly linked list
+class MonotoneMountain {
+
+ var tail, head: Point = None
+ var size = 0
+
+ private val convexPoints = new ArrayBuffer[Point]
+ // Monotone mountain points
+ val monoPoly = new ArrayBuffer[Point]
+ // Triangles that constitute the mountain
+ val triangles = new ArrayBuffer[Array[Point]]
+ // Convex polygons that constitute the mountain
+ val convexPolies = new ArrayBuffer[Array[Point]]
+ // Used to track which side of the line we are on
+ private var positive = false
+ // Almost Pi!
+ private val PI_SLOP = 3.1
+
+ // Append a point to the list
+ def +=(point: Point) {
+ size match {
+ case 0 =>
+ head = point
+ size += 1
+ case 1 =>
+ // Keep repeat points out of the list
+ if(point ! head) {
+ tail = point
+ tail.prev = head
+ head.next = tail
+ size += 1
+ }
+ case _ =>
+ // Keep repeat points out of the list
+ if(point ! tail) {
+ tail.next = point
+ point.prev = tail
+ tail = point
+ size += 1
+ }
+ }
+ }
+
+ // Remove a point from the list
+ def remove(point: Point) {
+ val next = point.next
+ val prev = point.prev
+ point.prev.next = next
+ point.next.prev = prev
+ size -= 1
+ }
+
+ // Partition a x-monotone mountain into triangles O(n)
+ // See "Computational Geometry in C", 2nd edition, by Joseph O'Rourke, page 52
+ def process {
+
+ // Establish the proper sign
+ positive = angleSign
+ // create monotone polygon - for dubug purposes
+ genMonoPoly
+
+ // Initialize internal angles at each nonbase vertex
+ // Link strictly convex vertices into a list, ignore reflex vertices
+ var p = head.next
+ while(p != tail) {
+ val a = angle(p)
+ // If the point is almost colinear with it's neighbor, remove it!
+ if(a >= PI_SLOP || a <= -PI_SLOP)
+ remove(p)
+ else
+ if(convex(p)) convexPoints += p
+ p = p.next
+ }
+
+ triangulate
+
+ }
+
+ private def triangulate {
+
+ while(!convexPoints.isEmpty) {
+
+ val ear = convexPoints.remove(0)
+ val a = ear.prev
+ val b = ear
+ val c = ear.next
+ val triangle = Array(a, b, c)
+
+ triangles += triangle
+
+ // Remove ear, update angles and convex list
+ remove(ear)
+ if(valid(a)) convexPoints += a
+ if(valid(c)) convexPoints += c
+ }
+ assert(size <= 3, "Triangulation bug, please report")
+
+ }
+
+ private def valid(p: Point) = (p != head && p != tail && convex(p))
+
+ // Create the monotone polygon
+ private def genMonoPoly {
+ var p = head
+ while(p != None) {
+ monoPoly += p
+ p = p.next
+ }
+ }
+
+ private def angle(p: Point) = {
+ val a = (p.next - p)
+ val b = (p.prev - p)
+ Math.atan2(a cross b, a dot b)
+ }
+
+ private def angleSign = {
+ val a = (head.next - head)
+ val b = (tail - head)
+ (Math.atan2(a cross b, a dot b) >= 0)
+ }
+
+ // Determines if the inslide angle is convex or reflex
+ private def convex(p: Point) = {
+ if(positive != (angle(p) >= 0)) false
+ else true
+ }
+
+}
+
+# Node for a Directed Acyclic graph (DAG)
+class Node(object):
+
+ def __init__(self, left, right):
+ self.left = left
+ self.right = right
+ if left is not None:
+ left.parentList.append(self)
+ if right is not None:
+ right.parentList.append(self)
+ parentList = []
+
+ def replace(self, node):
+ for parent in node.parentList:
+ if(parent.left == node):
+ parent.left = self
+ else:
+ parent.right = self
+ parentList.append(parent)
+
+# Directed Acyclic graph (DAG)
+# See "Computational Geometry", 3rd edition, by Mark de Berg et al, Chapter 6.2
+
+class QueryGraph(var head: Node) {
+
+ def locate(s: Edge) = head.locate(s).trapezoid
+
+ def followEdge(s: Edge) = {
+
+ val trapezoids = new ArrayBuffer[Trapezoid]
+ trapezoids += locate(s)
+ var j = 0
+ while(s.q.x > trapezoids(j).rightPoint.x) {
+ if(s > trapezoids(j).rightPoint) {
+ trapezoids += trapezoids(j).upperRight
+ } else {
+ trapezoids += trapezoids(j).lowerRight
+ }
+ j += 1
+ }
+ trapezoids
+ }
+
+ def replace(sink: Sink, node: Node) {
+ if(sink.parentList.size == 0) {
+ head = node
+ } else {
+ node replace sink
+ }
+ }
+
+ def case1(sink: Sink, s: Edge, tList: Array[Trapezoid]) {
+ val yNode = new YNode(s, Sink.init(tList(1)), Sink.init(tList(2)))
+ val qNode = new XNode(s.q, yNode, Sink.init(tList(3)))
+ val pNode = new XNode(s.p, Sink.init(tList(0)), qNode)
+ replace(sink, pNode)
+ }
+
+ def case2(sink: Sink, s: Edge, tList: Array[Trapezoid]) {
+ val yNode = new YNode(s, Sink.init(tList(1)), Sink.init(tList(2)))
+ val pNode = new XNode(s.p, Sink.init(tList(0)), yNode)
+ replace(sink, pNode)
+ }
+
+ def case3(sink: Sink, s: Edge, tList: Array[Trapezoid]) {
+ val yNode = new YNode(s, Sink.init(tList(0)), Sink.init(tList(1)))
+ replace(sink, yNode)
+ }
+
+ def case4(sink: Sink, s: Edge, tList: Array[Trapezoid]) {
+ val yNode = new YNode(s, Sink.init(tList(0)), Sink.init(tList(1)))
+ val qNode = new XNode(s.q, yNode, Sink.init(tList(2)))
+ replace(sink, qNode)
+ }
+
+}
+
+class Sink(Node):
+
+ def __new__(cls, trapezoid):
+ if trapezoid.sink is not None:
+ return trapezoid.sink
+ else
+ return Sink(trapezoid)
+
+ def __init__(self, trapezoid):
+ Node.__init__(self, None, None)
+ trapezoid.sink = self
+
+ def locate(e):
+ return self
+
+class TrapezoidalMap(object):
+
+ map = {}
+ margin = 50
+ bcross = None
+ tcross = None
+
+ def clear(self):
+ self.bcross = None
+ self.tcross = None
+
+ def case1(self, t, e):
+ trapezoids = (None, None, None, None)
+ trapezoids.append(Trapezoid(t.leftPoint, e.p, t.top, t.bottom))
+ trapezoids.append(Trapezoid(e.p, e.q, t.top, e))
+ trapezoids.append(Trapezoid(e.p, e.q, e, t.bottom))
+ trapezoids.append(Trapezoid(e.q, t.rightPoint, t.top, t.bottom))
+ trapezoids[0].updateLeft(t.upperLeft, t.lowerLeft)
+ trapezoids[1].updateLeftRight(trapezoids[0], None, trapezoids[3], None)
+ trapezoids[2].updateLeftRight(None, trapezoids[0], None, trapezoids[3])
+ trapezoids[3].updateRight(t.upperRight, t.lowerRight)
+ return trapezoids
+
+ def case2(self, t, e):
+ val rp = e.q if e.q.x == t.rightPoint.x else t.rightPoint
+ trapezoids = (None, None, None)
+ trapezoids.append(Trapezoid(t.leftPoint, e.p, t.top, t.bottom))
+ trapezoids.append(Trapezoid(e.p, rp, t.top, e))
+ trapezoids.append(Trapezoid(e.p, rp, e, t.bottom))
+ trapezoids[0].updateLeft(t.upperLeft, t.lowerLeft)
+ trapezoids[1].updateLeftRight(trapezoids[0], None, t.upperRight, None)
+ trapezoids[2].updateLeftRight(None, trapezoids[0], None, t.lowerRight)
+ self.bcross = t.bottom
+ self.tcross = t.top
+ e.above = trapezoids[1]
+ e.below = trapezoids[2]
+ return trapezoids
+
+ def case3(self, t, e):
+ lp = s.p if s.p.x == t.leftPoint.x else t.leftPoint
+ rp = s.q if s.q.x == t.rightPoint.x else t.rightPoint
+ trapezoids = (None, None)
+ if self.tcross is t.top:
+ trapezoids[0] = t.upperLeft
+ trapezoids[0].updateRight(t.upperRight, None)
+ trapezoids[0].rightPoint = rp
+ else:
+ trapezoids[0] = Trapezoid(lp, rp, t.top, s)
+ trapezoids[0].updateLeftRight(t.upperLeft, s.above, t.upperRight, None)
+ if self.bcross is t.bottom:
+ trapezoids[1] = t.lowerLeft
+ trapezoids[1].updateRight(None, t.lowerRight)
+ trapezoids[1].rightPoint = rp
+ else:
+ trapezoids[1] = Trapezoid(lp, rp, s, t.bottom)
+ trapezoids[1].updateLeftRight(s.below, t.lowerLeft, None, t.lowerRight)
+ self.bcross = t.bottom
+ self.tcross = t.top
+ s.above = trapezoids[0]
+ s.below = trapezoids[1]
+ return trapezoids
+
+ def case4(self, t, e):
+ lp = s.p if s.p.x == t.leftPoint.x else t.leftPoint
+ trapezoids = (None, None, None)
+ if self.tcross is t.top:
+ trapezoids[0] = t.upperLeft
+ trapezoids[0].rightPoint = s.q
+ else:
+ trapezoids[0] = Trapezoid(lp, s.q, t.top, s)
+ trapezoids[0].updateLeft(t.upperLeft, s.above)
+ if self.bcross is t.bottom:
+ trapezoids[1] = t.lowerLeft
+ trapezoids[1].rightPoint = s.q
+ else:
+ trapezoids[1] = Trapezoid(lp, s.q, s, t.bottom)
+ trapezoids[1].updateLeft(s.below, t.lowerLeft)
+ trapezoids[2] = Trapezoid(s.q, t.rightPoint, t.top, t.bottom)
+ trapezoids[2].updateLeftRight(trapezoids[0], trapezoids[1], t.upperRight, t.lowerRight)
+
+ return trapezoids
+
+ def bounding_box(self, edges):
+ max = edges[0].p + margin
+ min = edges[0].q - margin
+ for s in edges:
+ if s.p.x > max.x: max = Point(s.p.x + margin, max.y)
+ if s.p.y > max.y: max = Point(max.x, s.p.y + margin)
+ if s.q.x > max.x: max = Point(s.q.x+margin, max.y)
+ if s.q.y > max.y: max = Point(max.x, s.q.y+margin)
+ if s.p.x < min.x: min = Point(s.p.x-margin, min.y)
+ if s.p.y < min.y: min = Point(min.x, s.p.y-margin)
+ if s.q.x < min.x: min = Point(s.q.x-margin, min.y)
+ if s.q.y < min.y: min = Point(min.x, s.q.y-margin)
+ top = Edge(Point(min.x, max.y), Point(max.x, max.y))
+ bottom = Edge(Point(min.x, min.y), Point(max.x, min.y))
+ left = bottom.p
+ right = top.q
+ return Trapezoid(left, right, top, bottom)
+
+class XNode(Node):
+
+ def __init__(self, point, lchild, rchild):
+ Node.__init__(self, lChild, rChild)
+ self.point = point
+ self.lchild = lchild
+ self.rchild = rchils
+
+ def locate(self, e):
+ if e.p.x >= self.point.x:
+ return self.right.locate(e)
+ else:
+ return self.left.locate(e)
+
+class YNode(Node):
+
+ def __init__(self, edge, lchild, rchild):
+ Node.__init__(self, lChild, rChild)
+ self.edge = edge
+ self.lchild = lchild
+ self.rchile = rchild
+
+ def locate(self, e):
+ if edge > e.p:
+ return self.right.locate(e)
+ elif edge < e.p:
+ return self.left.locate(e)
+ else:
+ if e.slope < self.edge.slope:
+ return self.right.locate(e)
+ else:
+ return self.left.locate(e)
+
+cdef class Point(object):
+
+ def __init__(self, x, y):
+ self.x = x
+ self.y = y
+ next = None
+ prev = None
+ Edge = None
+ edges = []
+
+ cdef __sub__(self, Point p):
+ return Point(self.x - p.x, self.y - p.y)
+
+ cdef __sub__(self, float f):
+ return Point(self.x - f, self.y - f)
+
+ cdef __add__(self, Point p):
+ return Point(self.x + p.x, self.y + p.y)
+
+ cdef __add__(self, float f):
+ return Point(self.x + f, self.y + f)
+
+ cdef __mul__(self, float f):
+ return Point(self.x * f, self.y * f)
+
+ cdef __div__(self, float a):
+ return Point(self.x / a, self.y / a)
+
+ cdef cross(self, Point p):
+ return self.x * p.y - self.y * p.x
+
+ cdef dot(self, Point p):
+ return self.x * p.x + self.y * p.y
+
+ cdef length(self):
+ return math.sqrt(self.x * self.x + self.y * self.y)
+
+ cdef normalize(self):
+ return self / length
+
+ cdef __lt__(self, Point p):
+ return self.x < p.x
+
+ # Sort along y axis
+ cdef >(p: Point):
+ if y < p.y:
+ return True
+ elif y > p.y:
+ return False
+ else {
+ if x < p.x:
+ return True
+ else
+ return False
+
+ cdef !(p: Point) = !(p.x == x && p.y == y)
+ cdef clone = Point(x, y)
+
+
+// Represents a simple polygon's edge
+// TODO: Rename this class to Edge?
+class Edge(object):
+
+ def __init__(self, p, q):
+ self.p = p
+ self.q = q
+ self.above, self.below = None
+ mPoints = []
+ self.slope = (q.y - p.y)/(q.x - p.x)
+ self.b = p.y - (p.x * self.slope)
+
+ def __gt__(self, point):
+ return (floor(point.y) < floor(slope * point.x + b))
+ def __lt__(self, point):
+ return (floor(point.y) > floor(slope * point.x + b))
+
+ def intersect(self, c, d):
+ a = self.p
+ b = self.q
+ a1 = _signed_area(a, b, d)
+ a2 = _signed_area(a, b, c)
+ if a1 != 0 and a2 != 0 and a1 * a2 < 0:
+ a3 = _signed_area(c, d, a)
+ a4 = a3 + a2 - a1
+ if a3 * a4 < 0:
+ t = a3 / (a3 - a4)
+ return a + ((b - a) * t)
+
+ def _signed_area(self, a, b, c):
+ return (a.x - c.x) * (b.y - c.y) - (a.y - c.y) * (b.x - c.x)
\ No newline at end of file
diff --git a/src/org/poly2tri/Poly2Tri.scala b/scala/src/org/poly2tri/Poly2Tri.scala
similarity index 100%
rename from src/org/poly2tri/Poly2Tri.scala
rename to scala/src/org/poly2tri/Poly2Tri.scala
diff --git a/src/org/poly2tri/cdt/AFront.scala b/scala/src/org/poly2tri/cdt/AFront.scala
similarity index 100%
rename from src/org/poly2tri/cdt/AFront.scala
rename to scala/src/org/poly2tri/cdt/AFront.scala
diff --git a/src/org/poly2tri/cdt/CDT.scala b/scala/src/org/poly2tri/cdt/CDT.scala
similarity index 100%
rename from src/org/poly2tri/cdt/CDT.scala
rename to scala/src/org/poly2tri/cdt/CDT.scala
diff --git a/src/org/poly2tri/cdt/Mesh.scala b/scala/src/org/poly2tri/cdt/Mesh.scala
similarity index 100%
rename from src/org/poly2tri/cdt/Mesh.scala
rename to scala/src/org/poly2tri/cdt/Mesh.scala
diff --git a/src/org/poly2tri/earClip/EarClip.scala b/scala/src/org/poly2tri/earClip/EarClip.scala
similarity index 100%
rename from src/org/poly2tri/earClip/EarClip.scala
rename to scala/src/org/poly2tri/earClip/EarClip.scala
diff --git a/src/org/poly2tri/seidel/MonotoneMountain.scala b/scala/src/org/poly2tri/seidel/MonotoneMountain.scala
similarity index 100%
rename from src/org/poly2tri/seidel/MonotoneMountain.scala
rename to scala/src/org/poly2tri/seidel/MonotoneMountain.scala
diff --git a/src/org/poly2tri/seidel/Node.scala b/scala/src/org/poly2tri/seidel/Node.scala
similarity index 100%
rename from src/org/poly2tri/seidel/Node.scala
rename to scala/src/org/poly2tri/seidel/Node.scala
diff --git a/src/org/poly2tri/seidel/QueryGraph.scala b/scala/src/org/poly2tri/seidel/QueryGraph.scala
similarity index 100%
rename from src/org/poly2tri/seidel/QueryGraph.scala
rename to scala/src/org/poly2tri/seidel/QueryGraph.scala
diff --git a/src/org/poly2tri/seidel/Sink.scala b/scala/src/org/poly2tri/seidel/Sink.scala
similarity index 100%
rename from src/org/poly2tri/seidel/Sink.scala
rename to scala/src/org/poly2tri/seidel/Sink.scala
diff --git a/src/org/poly2tri/seidel/TrapezoidalMap.scala b/scala/src/org/poly2tri/seidel/TrapezoidalMap.scala
similarity index 100%
rename from src/org/poly2tri/seidel/TrapezoidalMap.scala
rename to scala/src/org/poly2tri/seidel/TrapezoidalMap.scala
diff --git a/src/org/poly2tri/seidel/Triangulator.scala b/scala/src/org/poly2tri/seidel/Triangulator.scala
similarity index 100%
rename from src/org/poly2tri/seidel/Triangulator.scala
rename to scala/src/org/poly2tri/seidel/Triangulator.scala
diff --git a/src/org/poly2tri/seidel/XNode.scala b/scala/src/org/poly2tri/seidel/XNode.scala
similarity index 100%
rename from src/org/poly2tri/seidel/XNode.scala
rename to scala/src/org/poly2tri/seidel/XNode.scala
diff --git a/src/org/poly2tri/seidel/YNode.scala b/scala/src/org/poly2tri/seidel/YNode.scala
similarity index 100%
rename from src/org/poly2tri/seidel/YNode.scala
rename to scala/src/org/poly2tri/seidel/YNode.scala
diff --git a/src/org/poly2tri/shapes/Point.scala b/scala/src/org/poly2tri/shapes/Point.scala
similarity index 100%
rename from src/org/poly2tri/shapes/Point.scala
rename to scala/src/org/poly2tri/shapes/Point.scala
diff --git a/src/org/poly2tri/shapes/Segment.scala b/scala/src/org/poly2tri/shapes/Segment.scala
similarity index 100%
rename from src/org/poly2tri/shapes/Segment.scala
rename to scala/src/org/poly2tri/shapes/Segment.scala
diff --git a/src/org/poly2tri/shapes/Trapezoid.scala b/scala/src/org/poly2tri/shapes/Trapezoid.scala
similarity index 100%
rename from src/org/poly2tri/shapes/Trapezoid.scala
rename to scala/src/org/poly2tri/shapes/Trapezoid.scala
diff --git a/src/org/poly2tri/shapes/Triangle.scala b/scala/src/org/poly2tri/shapes/Triangle.scala
similarity index 100%
rename from src/org/poly2tri/shapes/Triangle.scala
rename to scala/src/org/poly2tri/shapes/Triangle.scala
diff --git a/src/org/poly2tri/utils/Util.scala b/scala/src/org/poly2tri/utils/Util.scala
similarity index 100%
rename from src/org/poly2tri/utils/Util.scala
rename to scala/src/org/poly2tri/utils/Util.scala