adding files from merge.

This commit is contained in:
Joseph Eagar 2009-03-01 06:47:11 +00:00
commit 34dcf5fca2
10 changed files with 10141 additions and 0 deletions

@ -0,0 +1,240 @@
/******************************************************************************
*
* El'Beem - Free Surface Fluid Simulation with the Lattice Boltzmann Method
* All code distributed as part of El'Beem is covered by the version 2 of the
* GNU General Public License. See the file COPYING for details.
* Copyright 2003-2006 Nils Thuerey
*
* API header
*/
#ifndef ELBEEM_API_H
#define ELBEEM_API_H
// simulation run callback function type (elbeemSimulationSettings->runsimCallback)
// best use with FLUIDSIM_CBxxx defines below.
// >parameters
// return values: 0=continue, 1=stop, 2=abort
// data pointer: user data pointer from elbeemSimulationSettings->runsimUserData
// status integer: 1=running simulation, 2=new frame saved
// frame integer: if status is 1, contains current frame number
typedef int (*elbeemRunSimulationCallback)(void *data, int status, int frame);
#define FLUIDSIM_CBRET_CONTINUE 0
#define FLUIDSIM_CBRET_STOP 1
#define FLUIDSIM_CBRET_ABORT 2
#define FLUIDSIM_CBSTATUS_STEP 1
#define FLUIDSIM_CBSTATUS_NEWFRAME 2
// global settings for the simulation
typedef struct elbeemSimulationSettings {
/* version number */
short version;
/* id number of simulation domain, needed if more than a
* single domain should be simulated */
short domainId;
/* geometrical extent */
float geoStart[3], geoSize[3];
/* resolutions */
short resolutionxyz;
short previewresxyz;
/* size of the domain in real units (meters along largest resolution x,y,z extent) */
float realsize;
/* fluid properties */
double viscosity;
/* gravity strength */
float gravity[3];
/* anim start end time */
float animStart, aniFrameTime;
/* no. of frames to simulate & output */
short noOfFrames;
/* g star param (LBM compressibility) */
float gstar;
/* activate refinement? */
short maxRefine;
/* probability for surface particle generation (0.0=off) */
float generateParticles;
/* amount of tracer particles to generate (0=off) */
int numTracerParticles;
/* store output path, and file prefix for baked fluid surface */
char outputPath[160+80];
/* channel for frame time, visc & gravity animations */
int channelSizeFrameTime;
float *channelFrameTime;
int channelSizeViscosity;
float *channelViscosity;
int channelSizeGravity;
float *channelGravity; // vector
/* boundary types and settings for domain walls */
short domainobsType;
float domainobsPartslip;
/* generate speed vectors for vertices (e.g. for image based motion blur)*/
short generateVertexVectors;
/* strength of surface smoothing */
float surfaceSmoothing;
/* no. of surface subdivisions */
int surfaceSubdivs;
/* global transformation to apply to fluidsim mesh */
float surfaceTrafo[4*4];
/* development variables, testing for upcoming releases...*/
float farFieldSize;
/* callback function to notify calling program of performed simulation steps
* or newly available frame data, if NULL it is ignored */
elbeemRunSimulationCallback runsimCallback;
/* pointer passed to runsimCallback for user data storage */
void* runsimUserData;
} elbeemSimulationSettings;
// defines for elbeemMesh->type below
#define OB_FLUIDSIM_FLUID 4
#define OB_FLUIDSIM_OBSTACLE 8
#define OB_FLUIDSIM_INFLOW 16
#define OB_FLUIDSIM_OUTFLOW 32
// defines for elbeemMesh->obstacleType below
#define FLUIDSIM_OBSTACLE_NOSLIP 1
#define FLUIDSIM_OBSTACLE_PARTSLIP 2
#define FLUIDSIM_OBSTACLE_FREESLIP 3
#define OB_VOLUMEINIT_VOLUME 1
#define OB_VOLUMEINIT_SHELL 2
#define OB_VOLUMEINIT_BOTH (OB_VOLUMEINIT_SHELL|OB_VOLUMEINIT_VOLUME)
// a single mesh object
typedef struct elbeemMesh {
/* obstacle,fluid or inflow... */
short type;
/* id of simulation domain it belongs to */
short parentDomainId;
/* vertices */
int numVertices;
float *vertices; // = float[n][3];
/* animated vertices */
int channelSizeVertices;
float *channelVertices; // = float[channelSizeVertices* (n*3+1) ];
/* triangles */
int numTriangles;
int *triangles; // = int[][3];
/* animation channels */
int channelSizeTranslation;
float *channelTranslation;
int channelSizeRotation;
float *channelRotation;
int channelSizeScale;
float *channelScale;
/* active channel */
int channelSizeActive;
float *channelActive;
/* initial velocity channel (e.g. for inflow) */
int channelSizeInitialVel;
float *channelInitialVel; // vector
/* use initial velocity in object coordinates? (e.g. for rotation) */
short localInivelCoords;
/* boundary types and settings */
short obstacleType;
float obstaclePartslip;
/* amount of force transfer from fluid to obj, 0=off, 1=normal */
float obstacleImpactFactor;
/* init volume, shell or both? use OB_VOLUMEINIT_xxx defines above */
short volumeInitType;
/* name of the mesh, mostly for debugging */
const char *name;
} elbeemMesh;
// API functions
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// reset elbeemSimulationSettings struct with defaults
void elbeemResetSettings(struct elbeemSimulationSettings*);
// start fluidsim init (returns !=0 upon failure)
int elbeemInit(void);
// start fluidsim init (returns !=0 upon failure)
int elbeemAddDomain(struct elbeemSimulationSettings*);
// get failure message during simulation or init
// if an error occured (the string is copied into buffer,
// max. length = 256 chars )
void elbeemGetErrorString(char *buffer);
// reset elbeemMesh struct with zeroes
void elbeemResetMesh(struct elbeemMesh*);
// add mesh as fluidsim object
int elbeemAddMesh(struct elbeemMesh*);
// do the actual simulation
int elbeemSimulate(void);
// continue a previously stopped simulation
int elbeemContinueSimulation(void);
// helper functions
// simplify animation channels
// returns if the channel and its size changed
int elbeemSimplifyChannelFloat(float *channel, int *size);
int elbeemSimplifyChannelVec3(float *channel, int *size);
// helper functions implemented in utilities.cpp
/* set elbeem debug output level (0=off to 10=full on) */
void elbeemSetDebugLevel(int level);
/* elbeem debug output function, prints if debug level >0 */
void elbeemDebugOut(char *msg);
/* estimate how much memory a given setup will require */
double elbeemEstimateMemreq(int res,
float sx, float sy, float sz,
int refine, char *retstr);
#ifdef __cplusplus
}
#endif // __cplusplus
/******************************************************************************/
// internal defines, do not use for initializing elbeemMesh
// structs, for these use OB_xxx defines above
/*! fluid geometry init types */
#define FGI_FLAGSTART 16
#define FGI_FLUID (1<<(FGI_FLAGSTART+ 0))
#define FGI_NO_FLUID (1<<(FGI_FLAGSTART+ 1))
#define FGI_BNDNO (1<<(FGI_FLAGSTART+ 2))
#define FGI_BNDFREE (1<<(FGI_FLAGSTART+ 3))
#define FGI_BNDPART (1<<(FGI_FLAGSTART+ 4))
#define FGI_NO_BND (1<<(FGI_FLAGSTART+ 5))
#define FGI_MBNDINFLOW (1<<(FGI_FLAGSTART+ 6))
#define FGI_MBNDOUTFLOW (1<<(FGI_FLAGSTART+ 7))
// all boundary types at once
#define FGI_ALLBOUNDS ( FGI_BNDNO | FGI_BNDFREE | FGI_BNDPART | FGI_MBNDINFLOW | FGI_MBNDOUTFLOW )
#endif // ELBEEM_API_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,129 @@
#!BPY
"""
Name: 'UVs from unselected adjacent'
Blender: 242
Group: 'UVCalculation'
Tooltip: 'Assign UVs to selected faces from surrounding unselected faces.'
"""
__author__ = "Campbell Barton"
__url__ = ("blender", "elysiun")
__version__ = "1.0 2006/02/07"
__bpydoc__ = """\
This script sets the UV mapping and image of selected faces from adjacent unselected faces.
Use this script in face select mode for texturing between textured faces.
"""
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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 2
# 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, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import *
import bpy
def mostUsedImage(imageList): # Returns the image most used in the list.
if not imageList:
return None
elif len(imageList) < 3:
return imageList[0]
# 3+ Images, Get the most used image for surrounding faces.
imageCount = {}
for image in imageList:
if image:
image_key= image.name
else:
image_key = None
try:
imageCount[image_key]['imageCount'] +=1 # an extra user of this image
except:
imageCount[image_key] = {'imageCount':1, 'blenderImage':image} # start with 1 user.
# Now a list of tuples, (imageName, {imageCount, image})
imageCount = imageCount.items()
try: imageCount.sort(key=lambda a: a[1])
except: imageCount.sort(lambda a,b: cmp(a[1], b[1]))
return imageCount[-1][1]['blenderImage']
def main():
sce = bpy.data.scenes.active
ob = sce.objects.active
if ob == None or ob.type != 'Mesh':
Draw.PupMenu('ERROR: No mesh object in face select mode.')
return
me = ob.getData(mesh=1)
if not me.faceUV:
Draw.PupMenu('ERROR: No mesh object in face select mode.')
return
selfaces = [f for f in me.faces if f.sel]
unselfaces = [f for f in me.faces if not f.sel]
# Gather per Vert UV and Image, store in vertUvAverage
vertUvAverage = [[[],[]] for i in xrange(len(me.verts))]
for f in unselfaces: # Unselected faces only.
fuv = f.uv
for i,v in enumerate(f):
vertUvAverage[v.index][0].append(fuv[i])
vertUvAverage[v.index][1].append(f.image)
# Average per vectex UV coords
for vertUvData in vertUvAverage:
uvList = vertUvData[0]
if uvList:
# Convert from a list of vectors into 1 vector.
vertUvData[0] = reduce(lambda a,b: a+b, uvList, Mathutils.Vector(0,0)) * (1.0/len(uvList))
else:
vertUvData[0] = None
# Assign to selected faces
TEX_FLAG = Mesh.FaceModes['TEX']
for f in selfaces:
uvlist = []
imageList = []
for i,v in enumerate(f):
uv, vImages = vertUvAverage[v.index]
uvlist.append( uv )
imageList.extend(vImages)
if None not in uvlist:
# all the faces images used by this faces vert. some faces will be added twice but thats ok.
# Get the most used image and assign to the face.
image = mostUsedImage(imageList)
f.uv = uvlist
if image:
f.image = image
f.mode |= TEX_FLAG
Window.RedrawAll()
if __name__ == '__main__':
main()

@ -0,0 +1,34 @@
[Settings]
NumFields=4
[Field 1]
Type=label
Text=Please specify where you wish to install Blender's User Data files.
Left=0
Right=-1
Top=0
Bottom=10
[Field 2]
Type=RadioButton
Text=Use Application Data Directory (Win2k/XP only)
Left=0
Right=-1
Top=20
Bottom=30
[Field 3]
Type=RadioButton
Text=Use Installation Directory (ie. location chosen to install blender.exe).
Left=0
Right=-1
Top=40
Bottom=50
[Field 4]
Type=RadioButton
Text=I have defined a %HOME% variable, please install files here.
Left=0
Right=-1
Top=60
Bottom=70

@ -0,0 +1,13 @@
SOURCES=$(shell ls *.py)
TARGETS:=$(SOURCES:.py=.html)
PYDOC=/usr/lib/python2.2/pydoc.py
all: $(SOURCES)
epydoc -o BPY_GE_236 --url "http://www.blender.org" -t GameLogic.py \
-n "Blender GameEngine" --no-private --no-frames \
$(shell ls *.py )
clean:
rm *.html

@ -0,0 +1,150 @@
#ifndef __ARB_MULTITEXTURE_H__
#define __ARB_MULTITEXTURE_H__
/*
*/
/* ----------------------------------------------------------------------------
GL_ARB_multitexture
---------------------------------------------------------------------------- */
#ifdef GL_ARB_multitexture
#define GL_TEXTURE0_ARB 0x84C0
#define GL_TEXTURE1_ARB 0x84C1
#define GL_TEXTURE2_ARB 0x84C2
#define GL_TEXTURE3_ARB 0x84C3
#define GL_TEXTURE4_ARB 0x84C4
#define GL_TEXTURE5_ARB 0x84C5
#define GL_TEXTURE6_ARB 0x84C6
#define GL_TEXTURE7_ARB 0x84C7
#define GL_TEXTURE8_ARB 0x84C8
#define GL_TEXTURE9_ARB 0x84C9
#define GL_TEXTURE10_ARB 0x84CA
#define GL_ACTIVE_TEXTURE_ARB 0x84E0
#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
#endif
/* ----------------------------------------------------------------------------
GL_ARB_texture_env_combine
---------------------------------------------------------------------------- */
#ifdef GL_ARB_texture_env_combine
#define GL_COMBINE_ARB 0x8570
#define GL_COMBINE_RGB_ARB 0x8571
#define GL_COMBINE_ALPHA_ARB 0x8572
#define GL_SOURCE0_RGB_ARB 0x8580
#define GL_SOURCE1_RGB_ARB 0x8581
#define GL_SOURCE2_RGB_ARB 0x8582
#define GL_SOURCE0_ALPHA_ARB 0x8588
#define GL_SOURCE1_ALPHA_ARB 0x8589
#define GL_SOURCE2_ALPHA_ARB 0x858A
#define GL_OPERAND0_RGB_ARB 0x8590
#define GL_OPERAND1_RGB_ARB 0x8591
#define GL_OPERAND2_RGB_ARB 0x8592
#define GL_OPERAND0_ALPHA_ARB 0x8598
#define GL_OPERAND1_ALPHA_ARB 0x8599
#define GL_OPERAND2_ALPHA_ARB 0x859A
#define GL_RGB_SCALE_ARB 0x8573
#define GL_ADD_SIGNED_ARB 0x8574
#define GL_INTERPOLATE_ARB 0x8575
#define GL_SUBTRACT_ARB 0x84E7
#define GL_CONSTANT_ARB 0x8576
#define GL_PRIMARY_COLOR_ARB 0x8577
#define GL_PREVIOUS_ARB 0x8578
#endif
/* ----------------------------------------------------------------------------
GL_ARB_texture_cube_map
---------------------------------------------------------------------------- */
#ifdef GL_ARB_texture_cube_map
#define GL_NORMAL_MAP_ARB 0x8511
#define GL_REFLECTION_MAP_ARB 0x8512
#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
#endif
/* ----------------------------------------------------------------------------
GL_ARB_shader_objects
---------------------------------------------------------------------------- */
#ifdef GL_ARB_shader_objects
#define GL_PROGRAM_OBJECT_ARB 0x8B40
#define GL_SHADER_OBJECT_ARB 0x8B48
#define GL_OBJECT_TYPE_ARB 0x8B4E
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
#define GL_FLOAT_VEC2_ARB 0x8B50
#define GL_FLOAT_VEC3_ARB 0x8B51
#define GL_FLOAT_VEC4_ARB 0x8B52
#define GL_INT_VEC2_ARB 0x8B53
#define GL_INT_VEC3_ARB 0x8B54
#define GL_INT_VEC4_ARB 0x8B55
#define GL_BOOL_ARB 0x8B56
#define GL_BOOL_VEC2_ARB 0x8B57
#define GL_BOOL_VEC3_ARB 0x8B58
#define GL_BOOL_VEC4_ARB 0x8B59
#define GL_FLOAT_MAT2_ARB 0x8B5A
#define GL_FLOAT_MAT3_ARB 0x8B5B
#define GL_FLOAT_MAT4_ARB 0x8B5C
#define GL_SAMPLER_1D_ARB 0x8B5D
#define GL_SAMPLER_2D_ARB 0x8B5E
#define GL_SAMPLER_3D_ARB 0x8B5F
#define GL_SAMPLER_CUBE_ARB 0x8B60
#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
#endif
/* ----------------------------------------------------------------------------
GL_ARB_vertex_shader
---------------------------------------------------------------------------- */
#ifdef GL_ARB_vertex_shader
#define GL_VERTEX_SHADER_ARB 0x8B31
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
#endif
/* ----------------------------------------------------------------------------
GL_ARB_fragment_shader
---------------------------------------------------------------------------- */
#ifdef GL_ARB_fragment_shader
#define GL_FRAGMENT_SHADER_ARB 0x8B30
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
#endif
/* ----------------------------------------------------------------------------
GL_ARB_depth_texture
---------------------------------------------------------------------------- */
#ifndef GL_ARB_depth_texture
#define GL_DEPTH_COMPONENT16_ARB 0x81A5
#define GL_DEPTH_COMPONENT24_ARB 0x81A6
#define GL_DEPTH_COMPONENT32_ARB 0x81A7
#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
#endif
#endif//__ARB_MULTITEXTURE_H__

@ -0,0 +1,12 @@
#ifndef GL_EXT_separate_specular_color
#define GL_EXT_separate_specular_color 1
#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8
#define GL_SINGLE_COLOR_EXT 0x81F9
#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
#endif
#ifndef GL_VERSION_1_2
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
#define GL_SINGLE_COLOR 0x81F9
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,630 @@
#!/usr/bin/python
#
# $Id: mkglext.py 2638 2004-06-07 11:01:31Z kester $
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
#
# 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 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
#
# 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, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
#
# mkglext.py generates code for linking extensions.
#
# It reads the glext.h header from stdin and writes code to stdout.
#
# Usage: mkglext.py < glext.h > tmp
# Code can be copied & pasted from tmp to GL_ExtensionManager.cpp.
#
# glext.h is available here: http://oss.sgi.com/projects/ogl-sample/ABI/glext.h
#
from sys import stdin
import string, re
glext_h = string.split(stdin.read(), '\n')
# These extensions have been incorporated into the core GL or been superceded.
# Code will not be generated for these extensions
blacklist = [
"GL_EXT_multisample",
"GL_INGR_blend_func_separate",
"GL_SGIX_fragment_lighting",
"GL_SGIX_polynomial_ffd",
"GL_SGIS_point_parameters",
"GL_EXT_texture_object",
"GL_EXT_subtexture",
"GL_EXT_copy_texture",
"GL_EXT_vertex_array",
"GL_EXT_point_parameters",
"GL_EXT_blend_color",
"GL_EXT_polygon_offset",
"GL_EXT_texture"]
# Only code for these extensions will be generated. Extensions on both the
# blacklist & whitelist will not have code generated.
# This list is from http://oss.sgi.com/projects/ogl-sample/registry/ at 14-Mar-04
whitelist = [
# ARB Extensions
"GL_ARB_multitexture",
"GLX_ARB_get_proc_address",
"GL_ARB_transpose_matrix",
"WGL_ARB_buffer_region",
"GL_ARB_multisample",
"GL_ARB_texture_env_add",
"GL_ARB_texture_cube_map",
"WGL_ARB_extensions_string",
"WGL_ARB_pixel_format",
"WGL_ARB_make_current_read",
"WGL_ARB_pbuffer",
"GL_ARB_texture_compression",
"GL_ARB_texture_border_clamp",
"GL_ARB_point_parameters",
"GL_ARB_vertex_blend",
"GL_ARB_matrix_palette",
"GL_ARB_texture_env_combine",
"GL_ARB_texture_env_crossbar",
"GL_ARB_texture_env_dot3",
"WGL_ARB_render_texture",
"GL_ARB_texture_mirrored_repeat",
"GL_ARB_depth_texture",
"GL_ARB_shadow",
"GL_ARB_shadow_ambient",
"GL_ARB_window_pos",
"GL_ARB_vertex_program",
"GL_ARB_fragment_program",
"GL_ARB_vertex_buffer_object",
"GL_ARB_occlusion_query",
"GL_ARB_shader_objects",
"GL_ARB_vertex_shader",
"GL_ARB_fragment_shader",
"GL_ARB_shading_language_100",
"GL_ARB_texture_non_power_of_two",
"GL_ARB_point_sprite",
"GL_ARB_fragment_program_shadow",
# Non ARB Extensions
"GL_EXT_abgr",
"GL_EXT_blend_color",
"GL_EXT_polygon_offset",
"GL_EXT_texture",
"GL_EXT_texture3D",
"GL_SGIS_texture_filter4",
"GL_EXT_subtexture",
"GL_EXT_copy_texture",
"GL_EXT_histogram",
"GL_EXT_convolution",
"GL_SGI_color_matrix",
"GL_SGI_color_table",
"GL_SGIS_pixel_texture",
"GL_SGIS_texture4D",
"GL_SGI_texture_color_table",
"GL_EXT_cmyka",
"GL_EXT_texture_object",
"GL_SGIS_detail_texture",
"GL_SGIS_sharpen_texture",
"GL_EXT_packed_pixels",
"GL_SGIS_texture_lod",
"GL_SGIS_multisample",
"GL_EXT_rescale_normal",
"GLX_EXT_visual_info",
"GL_EXT_vertex_array",
"GL_EXT_misc_attribute",
"GL_SGIS_generate_mipmap",
"GL_SGIX_clipmap",
"GL_SGIX_shadow",
"GL_SGIS_texture_edge_clamp",
"GL_SGIS_texture_border_clamp",
"GL_EXT_blend_minmax",
"GL_EXT_blend_subtract",
"GL_EXT_blend_logic_op",
"GLX_SGI_swap_control",
"GLX_SGI_video_sync",
"GLX_SGI_make_current_read",
"GLX_SGIX_video_source",
"GLX_EXT_visual_rating",
"GL_SGIX_interlace",
"GLX_EXT_import_context",
"GLX_SGIX_fbconfig",
"GLX_SGIX_pbuffer",
"GL_SGIS_texture_select",
"GL_SGIX_sprite",
"GL_SGIX_texture_multi_buffer",
"GL_EXT_point_parameters",
"GL_SGIX_instruments",
"GL_SGIX_texture_scale_bias",
"GL_SGIX_framezoom",
"GL_SGIX_tag_sample_buffer",
"GL_SGIX_reference_plane",
"GL_SGIX_flush_raster",
"GLX_SGI_cushion",
"GL_SGIX_depth_texture",
"GL_SGIS_fog_function",
"GL_SGIX_fog_offset",
"GL_HP_image_transform",
"GL_HP_convolution_border_modes",
"GL_SGIX_texture_add_env",
"GL_EXT_color_subtable",
"GLU_EXT_object_space_tess",
"GL_PGI_vertex_hints",
"GL_PGI_misc_hints",
"GL_EXT_paletted_texture",
"GL_EXT_clip_volume_hint",
"GL_SGIX_list_priority",
"GL_SGIX_ir_instrument1",
"GLX_SGIX_video_resize",
"GL_SGIX_texture_lod_bias",
"GLU_SGI_filter4_parameters",
"GLX_SGIX_dm_buffer",
"GL_SGIX_shadow_ambient",
"GLX_SGIX_swap_group",
"GLX_SGIX_swap_barrier",
"GL_EXT_index_texture",
"GL_EXT_index_material",
"GL_EXT_index_func",
"GL_EXT_index_array_formats",
"GL_EXT_compiled_vertex_array",
"GL_EXT_cull_vertex",
"GLU_EXT_nurbs_tessellator",
"GL_SGIX_ycrcb",
"GL_EXT_fragment_lighting",
"GL_IBM_rasterpos_clip",
"GL_HP_texture_lighting",
"GL_EXT_draw_range_elements",
"GL_WIN_phong_shading",
"GL_WIN_specular_fog",
"GLX_SGIS_color_range",
"GL_EXT_light_texture",
"GL_SGIX_blend_alpha_minmax",
"GL_EXT_scene_marker",
"GL_SGIX_pixel_texture_bits",
"GL_EXT_bgra",
"GL_SGIX_async",
"GL_SGIX_async_pixel",
"GL_SGIX_async_histogram",
"GL_INTEL_texture_scissor",
"GL_INTEL_parallel_arrays",
"GL_HP_occlusion_test",
"GL_EXT_pixel_transform",
"GL_EXT_pixel_transform_color_table",
"GL_EXT_shared_texture_palette",
"GLX_SGIS_blended_overlay",
"GL_EXT_separate_specular_color",
"GL_EXT_secondary_color",
"GL_EXT_texture_env",
"GL_EXT_texture_perturb_normal",
"GL_EXT_multi_draw_arrays",
"GL_EXT_fog_coord",
"GL_REND_screen_coordinates",
"GL_EXT_coordinate_frame",
"GL_EXT_texture_env_combine",
"GL_APPLE_specular_vector",
"GL_SGIX_pixel_texture",
"GL_APPLE_transform_hint",
"GL_SUNX_constant_data",
"GL_SUN_global_alpha",
"GL_SUN_triangle_list",
"GL_SUN_vertex",
"WGL_EXT_display_color_table",
"WGL_EXT_extensions_string",
"WGL_EXT_make_current_read",
"WGL_EXT_pixel_format",
"WGL_EXT_pbuffer",
"WGL_EXT_swap_control",
"GL_EXT_blend_func_separate",
"GL_INGR_color_clamp",
"GL_INGR_interlace_read",
"GL_EXT_stencil_wrap",
"WGL_EXT_depth_float",
"GL_EXT_422_pixels",
"GL_NV_texgen_reflection",
"GL_SGIX_texture_range",
"GL_SUN_convolution_border_modes",
"GLX_SUN_get_transparent_index",
"GL_EXT_texture_env_add",
"GL_EXT_texture_lod_bias",
"GL_EXT_texture_filter_anisotropic",
"GL_EXT_vertex_weighting",
"GL_NV_light_max_exponent",
"GL_NV_vertex_array_range",
"GL_NV_register_combiners",
"GL_NV_fog_distance",
"GL_NV_texgen_emboss",
"GL_NV_blend_square",
"GL_NV_texture_env_combine4",
"GL_MESA_resize_buffers",
"GL_MESA_window_pos",
"GL_EXT_texture_compression_s3tc",
"GL_IBM_cull_vertex",
"GL_IBM_multimode_draw_arrays",
"GL_IBM_vertex_array_lists",
"GL_3DFX_texture_compression_FXT1",
"GL_3DFX_multisample",
"GL_3DFX_tbuffer",
"WGL_EXT_multisample",
"GL_SGIX_vertex_preclip",
"GL_SGIX_resample",
"GL_SGIS_texture_color_mask",
"GLX_MESA_copy_sub_buffer",
"GLX_MESA_pixmap_colormap",
"GLX_MESA_release_buffers",
"GLX_MESA_set_3dfx_mode",
"GL_EXT_texture_env_dot3",
"GL_ATI_texture_mirror_once",
"GL_NV_fence",
"GL_IBM_static_data",
"GL_IBM_texture_mirrored_repeat",
"GL_NV_evaluators",
"GL_NV_packed_depth_stencil",
"GL_NV_register_combiners2",
"GL_NV_texture_compression_vtc",
"GL_NV_texture_rectangle",
"GL_NV_texture_shader",
"GL_NV_texture_shader2",
"GL_NV_vertex_array_range2",
"GL_NV_vertex_program",
"GLX_SGIX_visual_select_group",
"GL_SGIX_texture_coordinate_clamp",
"GLX_OML_swap_method",
"GLX_OML_sync_control",
"GL_OML_interlace",
"GL_OML_subsample",
"GL_OML_resample",
"WGL_OML_sync_control",
"GL_NV_copy_depth_to_color",
"GL_ATI_envmap_bumpmap",
"GL_ATI_fragment_shader",
"GL_ATI_pn_triangles",
"GL_ATI_vertex_array_object",
"GL_EXT_vertex_shader",
"GL_ATI_vertex_streams",
"WGL_I3D_digital_video_control",
"WGL_I3D_gamma",
"WGL_I3D_genlock",
"WGL_I3D_image_buffer",
"WGL_I3D_swap_frame_lock",
"WGL_I3D_swap_frame_usage",
"GL_ATI_element_array",
"GL_SUN_mesh_array",
"GL_SUN_slice_accum",
"GL_NV_multisample_filter_hint",
"GL_NV_depth_clamp",
"GL_NV_occlusion_query",
"GL_NV_point_sprite",
"WGL_NV_render_depth_texture",
"WGL_NV_render_texture_rectangle",
"GL_NV_texture_shader3",
"GL_NV_vertex_program1_1",
"GL_EXT_shadow_funcs",
"GL_EXT_stencil_two_side",
"GL_ATI_text_fragment_shader",
"GL_APPLE_client_storage",
"GL_APPLE_element_array",
"GL_APPLE_fence",
"GL_APPLE_vertex_array_object",
"GL_APPLE_vertex_array_range",
"GL_APPLE_ycbcr_422",
"GL_S3_s3tc",
"GL_ATI_draw_buffers",
"WGL_ATI_pixel_format_float",
"GL_ATI_texture_env_combine3",
"GL_ATI_texture_float",
"GL_NV_float_buffer",
"GL_NV_fragment_program",
"GL_NV_half_float",
"GL_NV_pixel_data_range",
"GL_NV_primitive_restart",
"GL_NV_texture_expand_normal",
"GL_NV_vertex_program2",
"GL_ATI_map_object_buffer",
"GL_ATI_separate_stencil",
"GL_ATI_vertex_attrib_array_object",
"GL_OES_byte_coordinates",
"GL_OES_fixed_point",
"GL_OES_single_precision",
"GL_OES_compressed_paletted_texture",
"GL_OES_read_format",
"GL_OES_query_matrix",
"GL_EXT_depth_bounds_test",
"GL_EXT_texture_mirror_clamp",
"GL_EXT_blend_equation_separate",
"GL_MESA_pack_invert",
"GL_MESA_ycbcr_texture"]
"""
Example code output:
#ifdef GL_EXT_compiled_vertex_array
if (QueryExtension("GL_EXT_compiled_vertex_array"))
{
glUnlockArraysEXT = reinterpret_cast<PFNGLUNLOCKARRAYSEXTPROC>(bglGetProcAddress((const GLubyte *) "glUnlockArraysEXT"));
glLockArraysEXT = reinterpret_cast<PFNGLLOCKARRAYSEXTPROC>(bglGetProcAddress((const GLubyte *) "glLockArraysEXT"));
if (glUnlockArraysEXT && glLockArraysEXT)
{
EnableExtension(_GL_EXT_compiled_vertex_array);
if (doDebugMessages)
std::cout << "Detected GL_EXT_compiled_vertex_array" << std::endl;
} else {
std::cout << "ERROR: GL_EXT_compiled_vertex_array implementation is broken!" << std::endl;
}
}
#endif
"""
def writeext(ext, fnlist):
if (find(blacklist, ext)):
return
if (len(fnlist) == 0):
# This extension has no functions to detect - don't need to wrap in
# #ifdef GL_extension names
print "\tif (QueryExtension(\"" + ext + "\"))"
print "\t{"
print "\t\tEnableExtension(_" + ext + ");"
print "\t\tif (doDebugMessages)"
print "\t\t\tstd::cout << \"Detected " + ext + "\" << std::endl;"
print "\t}"
print
return
print "#if defined(" + ext + ")"
print "\tif (QueryExtension(\"" + ext + "\"))"
print "\t{"
for fn in fnlist:
print "\t\t" + fn[0] + " = reinterpret_cast<" + fn[1] + ">(bglGetProcAddress((const GLubyte *) \"" + fn[0] + "\"));"
errcheck = ""
for fn in fnlist:
if (errcheck == ""):
errcheck = fn[0]
else:
errcheck = errcheck + " && " + fn[0]
print "\t\tif (" + errcheck + ") {"
print "\t\t\tEnableExtension(_" + ext + ");"
print "\t\t\tif (doDebugMessages)"
print "\t\t\t\tstd::cout << \"Enabled " + ext + "\" << std::endl;"
print "\t\t} else {"
print "\t\t\tstd::cout << \"ERROR: " + ext + " implementation is broken!\" << std::endl;"
print "\t\t}"
print "\t}"
print "#endif"
print
"""
Example Output:
#if defined(GL_EXT_compiled_vertex_array)
PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
#endif
"""
def writeproto(ext, fnlist):
if (find(blacklist, ext) or not find(whitelist, ext)):
return
print "#if defined(" + ext + ")"
for fn in fnlist:
print fn[1] + " " + fn[0] + ";"
print "#endif"
print
"""
#ifdef GL_EXT_compiled_vertex_array
extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
#endif
"""
def writeheader(ext, fnlisti):
if (find(blacklist, ext) or not find(whitelist, ext)):
return
print "#if defined(" + ext + ")"
for fn in fnlist:
print "extern " + fn[1] + " " + fn[0] + ";"
print "#endif"
print
def find(l, x):
for i in l:
if (i == x):
return 1
return 0
# Write Prototypes
ext = ""
fns = []
fnlist = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
writeproto(ext, fnlist)
ext = ""
fns = []
fnlist = []
if (ext != ""):
line = re.search('.* (gl.*) \(.*\);', i)
if (line):
fns += [line.group(1)]
line = re.search('.*PFN(.*)PROC.*', i)
if (line):
for j in fns:
if (string.lower(line.group(1)) == string.lower(j)):
fnlist += [(j, "PFN" + line.group(1) + "PROC")]
# Write link code
ext = ""
fns = []
fnlist = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
writeext(ext, fnlist)
ext = ""
fns = []
fnlist = []
if (ext != ""):
line = re.search('.* (gl.*) \(.*\);', i)
if (line):
fns += [line.group(1)]
line = re.search('.*PFN(.*)PROC.*', i)
if (line):
for j in fns:
if (string.lower(line.group(1)) == string.lower(j)):
fnlist += [(j, "PFN" + line.group(1) + "PROC")]
# Write header code
ext = ""
fns = []
fnlist = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
writeheader(ext, fnlist)
ext = ""
fns = []
fnlist = []
if (ext != ""):
line = re.search('.* (gl.*) \(.*\);', i)
if (line):
fns += [line.group(1)]
line = re.search('.*PFN(.*)PROC.*', i)
if (line):
for j in fns:
if (string.lower(line.group(1)) == string.lower(j)):
fnlist += [(j, "PFN" + line.group(1) + "PROC")]
# Write Python link code
ext = ""
extensions = []
fns = []
defines = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
done = 0
for e in range(len(extensions)):
if extensions[e][0] == ext:
extensions[e] = (ext, defines + extensions[e][1], fns + extensions[e][2])
done = 1
if not done:
extensions = extensions + [(ext, defines, fns)]
ext = ""
fns = []
defines = []
if (ext != ""):
line = re.search('#define +(GL.*) +(0x.*)', i) # #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
if (line):
defines += [(line.group(1), line.group(2))]
line = re.search('(.* )(gl.*)(\(.*\));', i) # GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat);
if (line):
fns += [(line.group(1), line.group(2), line.group(3))]
for ext in extensions:
if (find(blacklist, ext[0]) or not find(whitelist, ext[0])):
continue
print "#if defined(" + ext[0] + ")"
for fn in ext[2]:
line = re.search('gl(.*)', fn[1])
# BGL_Wrap(2, RasterPos2f, void, (GLfloat, GLfloat))
rtype = ""
for r in string.split(fn[0]):
if r != "GLAPI" and r != "APIENTRY":
rtype = rtype + " " + r
params = ""
for p in string.split(fn[2], ','):
pline = re.search('(.*) \*', p)
if (pline):
p = pline.group(1) + "P"
if params == "":
params = p
else:
params = params + "," + p
if not params[-1] == ")":
params = params + ")"
print "BGL_Wrap(" + str(len(string.split(fn[2], ','))) + ", " + line.group(1) + ",\t" + rtype + ",\t" + params + ")"
print "#endif"
print
for ext in extensions:
if (find(blacklist, ext[0]) or not find(whitelist, ext[0])):
continue
print 'PyDict_SetItemString(dict, "' + ext[0] + '", PyInt_FromLong(_' + ext[0] + '))'
print "#if defined(" + ext[0] + ")"
print "if (bglQueryExtension(_" + ext[0] + ")) {"
if len(ext[2]) > 0:
for fn in ext[2]:
line = re.search('gl(.*)', fn[1])
# MethodDef(Vertex3iv),
print " BGL_AddMethod(" + line.group(1) + ");"
print
for define in ext[1]:
print " BGL_AddConst(" + define[0] + ");"
print
print "}"
print "#endif"
print