diff options
Diffstat (limited to 'progs/util')
-rw-r--r-- | progs/util/README | 21 | ||||
-rw-r--r-- | progs/util/SConscript | 15 | ||||
-rw-r--r-- | progs/util/dumpstate.c | 1959 | ||||
-rw-r--r-- | progs/util/errcheck.c | 27 | ||||
-rw-r--r-- | progs/util/extfuncs.h | 277 | ||||
-rw-r--r-- | progs/util/glstate.c | 502 | ||||
-rw-r--r-- | progs/util/glstate.h | 51 | ||||
-rw-r--r-- | progs/util/glutskel.c | 141 | ||||
-rw-r--r-- | progs/util/idproj.c | 26 | ||||
-rw-r--r-- | progs/util/imagesgi.cpp | 369 | ||||
-rw-r--r-- | progs/util/imagesgi.h | 55 | ||||
-rw-r--r-- | progs/util/matrix.c | 181 | ||||
-rw-r--r-- | progs/util/mwmborder.c | 91 | ||||
-rw-r--r-- | progs/util/readtex.c | 495 | ||||
-rw-r--r-- | progs/util/readtex.h | 26 | ||||
-rw-r--r-- | progs/util/sampleMakefile | 47 | ||||
-rw-r--r-- | progs/util/shaderutil.c | 323 | ||||
-rw-r--r-- | progs/util/shaderutil.h | 63 | ||||
-rw-r--r-- | progs/util/showbuffer.c | 198 | ||||
-rw-r--r-- | progs/util/showbuffer.h | 36 | ||||
-rw-r--r-- | progs/util/trackball.c | 338 | ||||
-rw-r--r-- | progs/util/trackball.h | 84 | ||||
-rw-r--r-- | progs/util/winpos.c | 42 |
23 files changed, 0 insertions, 5367 deletions
diff --git a/progs/util/README b/progs/util/README deleted file mode 100644 index ea71ebd2b9..0000000000 --- a/progs/util/README +++ /dev/null @@ -1,21 +0,0 @@ - -This directory is a collection of function which may be useful to -OpenGL/Mesa programmers. - - -errcheck.c - an OpenGL error check/report function -glutskel.c - handy skeleton for GLUT programs -idproj.c - setup an identity projection -mwmborder.c - remove Motif window decoration/border -winpos.c - set absolute window raster position -readtex.c - load textures/mipmaps from an .rgb file -showbuffer.[ch] - show depth, alpha, or stencil buffer contents -glstate.[ch] - query/print GL state variables, for debugging, etc. -sampleMakefile - example Makefile for making OpenGL/Mesa apps on Unix -dumpsate.c - dump all OpenGL state, from Stephane Rehel -imagesgi.cpp,.h - read SGI image files - - -more to come... - ----------------------------------------------------------------------- diff --git a/progs/util/SConscript b/progs/util/SConscript deleted file mode 100644 index 8ad2466291..0000000000 --- a/progs/util/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -Import('env') - -env = env.Clone() - -util = env.StaticLibrary( - target = ['util'], - source = [ - 'readtex.c', - 'trackball.c', - 'showbuffer.c', - 'shaderutil.c', - ], -) - -Export('util') diff --git a/progs/util/dumpstate.c b/progs/util/dumpstate.c deleted file mode 100644 index 4c039a40f9..0000000000 --- a/progs/util/dumpstate.c +++ /dev/null @@ -1,1959 +0,0 @@ - -/* - * - * From: Stephane Rehel <rehel@worldnet.fr> - * Date: Mon, 31 May 1999 18:40:54 -0400 - * To: Paul Brian <brianp@ra.avid.com> - * Subject: OpenGL State Dump Function - * - * Here is a function that dumps the current OpenGL state. I wrote it - * some time ago. - * - * In the attachment: - * + the code itself - * + its output - * - * I think Mesa is wrong on some getBooleanv(). For example, GL_VERTEX_ARRAY - * is queried by IsEnabled() (cf. p. 196 of the spec). But on page 193 - * we can read that all the boolean attribs that can be queried by IsEnabled() - * can also be queried by IsEnabled(). - * - * I had duplicated all the enums (LOCAL_*) so that the code can run on any - * OpenGL version, even if an enum is not recognized. - * - * The code can be shipped in the public domain. - * - * Stephane. - */ - - -/* - * Stephane Rehel - * Creation: February 5 1999 - */ - -#include <stdio.h> -#include <GL/gl.h> - -/***************************************************************************/ - -enum { - /* Data types */ - LOCAL_GL_BYTE = 0x1400, - LOCAL_GL_UNSIGNED_BYTE = 0x1401, - LOCAL_GL_SHORT = 0x1402, - LOCAL_GL_UNSIGNED_SHORT = 0x1403, - LOCAL_GL_INT = 0x1404, - LOCAL_GL_UNSIGNED_INT = 0x1405, - LOCAL_GL_FLOAT = 0x1406, - LOCAL_GL_DOUBLE = 0x140A, - LOCAL_GL_2_BYTES = 0x1407, - LOCAL_GL_3_BYTES = 0x1408, - LOCAL_GL_4_BYTES = 0x1409, - - /* Primitives */ - LOCAL_GL_LINES = 0x0001, - LOCAL_GL_POINTS = 0x0000, - LOCAL_GL_LINE_STRIP = 0x0003, - LOCAL_GL_LINE_LOOP = 0x0002, - LOCAL_GL_TRIANGLES = 0x0004, - LOCAL_GL_TRIANGLE_STRIP = 0x0005, - LOCAL_GL_TRIANGLE_FAN = 0x0006, - LOCAL_GL_QUADS = 0x0007, - LOCAL_GL_QUAD_STRIP = 0x0008, - LOCAL_GL_POLYGON = 0x0009, - LOCAL_GL_EDGE_FLAG = 0x0B43, - - /* Vertex Arrays */ - LOCAL_GL_VERTEX_ARRAY = 0x8074, - LOCAL_GL_NORMAL_ARRAY = 0x8075, - LOCAL_GL_COLOR_ARRAY = 0x8076, - LOCAL_GL_INDEX_ARRAY = 0x8077, - LOCAL_GL_TEXTURE_COORD_ARRAY = 0x8078, - LOCAL_GL_EDGE_FLAG_ARRAY = 0x8079, - LOCAL_GL_VERTEX_ARRAY_SIZE = 0x807A, - LOCAL_GL_VERTEX_ARRAY_TYPE = 0x807B, - LOCAL_GL_VERTEX_ARRAY_STRIDE = 0x807C, - LOCAL_GL_NORMAL_ARRAY_TYPE = 0x807E, - LOCAL_GL_NORMAL_ARRAY_STRIDE = 0x807F, - LOCAL_GL_COLOR_ARRAY_SIZE = 0x8081, - LOCAL_GL_COLOR_ARRAY_TYPE = 0x8082, - LOCAL_GL_COLOR_ARRAY_STRIDE = 0x8083, - LOCAL_GL_INDEX_ARRAY_TYPE = 0x8085, - LOCAL_GL_INDEX_ARRAY_STRIDE = 0x8086, - LOCAL_GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088, - LOCAL_GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089, - LOCAL_GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A, - LOCAL_GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C, - LOCAL_GL_VERTEX_ARRAY_POINTER = 0x808E, - LOCAL_GL_NORMAL_ARRAY_POINTER = 0x808F, - LOCAL_GL_COLOR_ARRAY_POINTER = 0x8090, - LOCAL_GL_INDEX_ARRAY_POINTER = 0x8091, - LOCAL_GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092, - LOCAL_GL_EDGE_FLAG_ARRAY_POINTER = 0x8093, - LOCAL_GL_V2F = 0x2A20, - LOCAL_GL_V3F = 0x2A21, - LOCAL_GL_C4UB_V2F = 0x2A22, - LOCAL_GL_C4UB_V3F = 0x2A23, - LOCAL_GL_C3F_V3F = 0x2A24, - LOCAL_GL_N3F_V3F = 0x2A25, - LOCAL_GL_C4F_N3F_V3F = 0x2A26, - LOCAL_GL_T2F_V3F = 0x2A27, - LOCAL_GL_T4F_V4F = 0x2A28, - LOCAL_GL_T2F_C4UB_V3F = 0x2A29, - LOCAL_GL_T2F_C3F_V3F = 0x2A2A, - LOCAL_GL_T2F_N3F_V3F = 0x2A2B, - LOCAL_GL_T2F_C4F_N3F_V3F = 0x2A2C, - LOCAL_GL_T4F_C4F_N3F_V4F = 0x2A2D, - - /* Matrix Mode */ - LOCAL_GL_MATRIX_MODE = 0x0BA0, - LOCAL_GL_MODELVIEW = 0x1700, - LOCAL_GL_PROJECTION = 0x1701, - LOCAL_GL_TEXTURE = 0x1702, - - /* Points */ - LOCAL_GL_POINT_SMOOTH = 0x0B10, - LOCAL_GL_POINT_SIZE = 0x0B11, - LOCAL_GL_POINT_SIZE_GRANULARITY = 0x0B13, - LOCAL_GL_POINT_SIZE_RANGE = 0x0B12, - - /* Lines */ - LOCAL_GL_LINE_SMOOTH = 0x0B20, - LOCAL_GL_LINE_STIPPLE = 0x0B24, - LOCAL_GL_LINE_STIPPLE_PATTERN = 0x0B25, - LOCAL_GL_LINE_STIPPLE_REPEAT = 0x0B26, - LOCAL_GL_LINE_WIDTH = 0x0B21, - LOCAL_GL_LINE_WIDTH_GRANULARITY = 0x0B23, - LOCAL_GL_LINE_WIDTH_RANGE = 0x0B22, - - /* Polygons */ - LOCAL_GL_POINT = 0x1B00, - LOCAL_GL_LINE = 0x1B01, - LOCAL_GL_FILL = 0x1B02, - LOCAL_GL_CCW = 0x0901, - LOCAL_GL_CW = 0x0900, - LOCAL_GL_FRONT = 0x0404, - LOCAL_GL_BACK = 0x0405, - LOCAL_GL_CULL_FACE = 0x0B44, - LOCAL_GL_CULL_FACE_MODE = 0x0B45, - LOCAL_GL_POLYGON_SMOOTH = 0x0B41, - LOCAL_GL_POLYGON_STIPPLE = 0x0B42, - LOCAL_GL_FRONT_FACE = 0x0B46, - LOCAL_GL_POLYGON_MODE = 0x0B40, - LOCAL_GL_POLYGON_OFFSET_FACTOR = 0x8038, - LOCAL_GL_POLYGON_OFFSET_UNITS = 0x2A00, - LOCAL_GL_POLYGON_OFFSET_POINT = 0x2A01, - LOCAL_GL_POLYGON_OFFSET_LINE = 0x2A02, - LOCAL_GL_POLYGON_OFFSET_FILL = 0x8037, - - /* Display Lists */ - LOCAL_GL_COMPILE = 0x1300, - LOCAL_GL_COMPILE_AND_EXECUTE = 0x1301, - LOCAL_GL_LIST_BASE = 0x0B32, - LOCAL_GL_LIST_INDEX = 0x0B33, - LOCAL_GL_LIST_MODE = 0x0B30, - - /* Depth buffer */ - LOCAL_GL_NEVER = 0x0200, - LOCAL_GL_LESS = 0x0201, - LOCAL_GL_GEQUAL = 0x0206, - LOCAL_GL_LEQUAL = 0x0203, - LOCAL_GL_GREATER = 0x0204, - LOCAL_GL_NOTEQUAL = 0x0205, - LOCAL_GL_EQUAL = 0x0202, - LOCAL_GL_ALWAYS = 0x0207, - LOCAL_GL_DEPTH_TEST = 0x0B71, - LOCAL_GL_DEPTH_BITS = 0x0D56, - LOCAL_GL_DEPTH_CLEAR_VALUE = 0x0B73, - LOCAL_GL_DEPTH_FUNC = 0x0B74, - LOCAL_GL_DEPTH_RANGE = 0x0B70, - LOCAL_GL_DEPTH_WRITEMASK = 0x0B72, - LOCAL_GL_DEPTH_COMPONENT = 0x1902, - - /* Lighting */ - LOCAL_GL_LIGHTING = 0x0B50, - LOCAL_GL_LIGHT0 = 0x4000, - LOCAL_GL_LIGHT1 = 0x4001, - LOCAL_GL_LIGHT2 = 0x4002, - LOCAL_GL_LIGHT3 = 0x4003, - LOCAL_GL_LIGHT4 = 0x4004, - LOCAL_GL_LIGHT5 = 0x4005, - LOCAL_GL_LIGHT6 = 0x4006, - LOCAL_GL_LIGHT7 = 0x4007, - LOCAL_GL_SPOT_EXPONENT = 0x1205, - LOCAL_GL_SPOT_CUTOFF = 0x1206, - LOCAL_GL_CONSTANT_ATTENUATION = 0x1207, - LOCAL_GL_LINEAR_ATTENUATION = 0x1208, - LOCAL_GL_QUADRATIC_ATTENUATION = 0x1209, - LOCAL_GL_AMBIENT = 0x1200, - LOCAL_GL_DIFFUSE = 0x1201, - LOCAL_GL_SPECULAR = 0x1202, - LOCAL_GL_SHININESS = 0x1601, - LOCAL_GL_EMISSION = 0x1600, - LOCAL_GL_POSITION = 0x1203, - LOCAL_GL_SPOT_DIRECTION = 0x1204, - LOCAL_GL_AMBIENT_AND_DIFFUSE = 0x1602, - LOCAL_GL_COLOR_INDEXES = 0x1603, - LOCAL_GL_LIGHT_MODEL_TWO_SIDE = 0x0B52, - LOCAL_GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51, - LOCAL_GL_LIGHT_MODEL_AMBIENT = 0x0B53, - LOCAL_GL_FRONT_AND_BACK = 0x0408, - LOCAL_GL_SHADE_MODEL = 0x0B54, - LOCAL_GL_FLAT = 0x1D00, - LOCAL_GL_SMOOTH = 0x1D01, - LOCAL_GL_COLOR_MATERIAL = 0x0B57, - LOCAL_GL_COLOR_MATERIAL_FACE = 0x0B55, - LOCAL_GL_COLOR_MATERIAL_PARAMETER = 0x0B56, - LOCAL_GL_NORMALIZE = 0x0BA1, - - /* User clipping planes */ - LOCAL_GL_CLIP_PLANE0 = 0x3000, - LOCAL_GL_CLIP_PLANE1 = 0x3001, - LOCAL_GL_CLIP_PLANE2 = 0x3002, - LOCAL_GL_CLIP_PLANE3 = 0x3003, - LOCAL_GL_CLIP_PLANE4 = 0x3004, - LOCAL_GL_CLIP_PLANE5 = 0x3005, - - /* Accumulation buffer */ - LOCAL_GL_ACCUM_RED_BITS = 0x0D58, - LOCAL_GL_ACCUM_GREEN_BITS = 0x0D59, - LOCAL_GL_ACCUM_BLUE_BITS = 0x0D5A, - LOCAL_GL_ACCUM_ALPHA_BITS = 0x0D5B, - LOCAL_GL_ACCUM_CLEAR_VALUE = 0x0B80, - LOCAL_GL_ACCUM = 0x0100, - LOCAL_GL_ADD = 0x0104, - LOCAL_GL_LOAD = 0x0101, - LOCAL_GL_MULT = 0x0103, - LOCAL_GL_RETURN = 0x0102, - - /* Alpha testing */ - LOCAL_GL_ALPHA_TEST = 0x0BC0, - LOCAL_GL_ALPHA_TEST_REF = 0x0BC2, - LOCAL_GL_ALPHA_TEST_FUNC = 0x0BC1, - - /* Blending */ - LOCAL_GL_BLEND = 0x0BE2, - LOCAL_GL_BLEND_SRC = 0x0BE1, - LOCAL_GL_BLEND_DST = 0x0BE0, - LOCAL_GL_ZERO = 0, - LOCAL_GL_ONE = 1, - LOCAL_GL_SRC_COLOR = 0x0300, - LOCAL_GL_ONE_MINUS_SRC_COLOR = 0x0301, - LOCAL_GL_DST_COLOR = 0x0306, - LOCAL_GL_ONE_MINUS_DST_COLOR = 0x0307, - LOCAL_GL_SRC_ALPHA = 0x0302, - LOCAL_GL_ONE_MINUS_SRC_ALPHA = 0x0303, - LOCAL_GL_DST_ALPHA = 0x0304, - LOCAL_GL_ONE_MINUS_DST_ALPHA = 0x0305, - LOCAL_GL_SRC_ALPHA_SATURATE = 0x0308, - LOCAL_GL_CONSTANT_COLOR = 0x8001, - LOCAL_GL_ONE_MINUS_CONSTANT_COLOR = 0x8002, - LOCAL_GL_CONSTANT_ALPHA = 0x8003, - LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004, - - /* Render Mode */ - LOCAL_GL_FEEDBACK = 0x1C01, - LOCAL_GL_RENDER = 0x1C00, - LOCAL_GL_SELECT = 0x1C02, - - /* Feedback */ - LOCAL_GL_2D = 0x0600, - LOCAL_GL_3D = 0x0601, - LOCAL_GL_3D_COLOR = 0x0602, - LOCAL_GL_3D_COLOR_TEXTURE = 0x0603, - LOCAL_GL_4D_COLOR_TEXTURE = 0x0604, - LOCAL_GL_POINT_TOKEN = 0x0701, - LOCAL_GL_LINE_TOKEN = 0x0702, - LOCAL_GL_LINE_RESET_TOKEN = 0x0707, - LOCAL_GL_POLYGON_TOKEN = 0x0703, - LOCAL_GL_BITMAP_TOKEN = 0x0704, - LOCAL_GL_DRAW_PIXEL_TOKEN = 0x0705, - LOCAL_GL_COPY_PIXEL_TOKEN = 0x0706, - LOCAL_GL_PASS_THROUGH_TOKEN = 0x0700, - LOCAL_GL_FEEDBACK_BUFFER_POINTER = 0x0DF0, - LOCAL_GL_FEEDBACK_BUFFER_SIZE = 0x0DF1, - LOCAL_GL_FEEDBACK_BUFFER_TYPE = 0x0DF2, - - /* Selection */ - LOCAL_GL_SELECTION_BUFFER_POINTER = 0x0DF3, - LOCAL_GL_SELECTION_BUFFER_SIZE = 0x0DF4, - - /* Fog */ - LOCAL_GL_FOG = 0x0B60, - LOCAL_GL_FOG_MODE = 0x0B65, - LOCAL_GL_FOG_DENSITY = 0x0B62, - LOCAL_GL_FOG_COLOR = 0x0B66, - LOCAL_GL_FOG_INDEX = 0x0B61, - LOCAL_GL_FOG_START = 0x0B63, - LOCAL_GL_FOG_END = 0x0B64, - LOCAL_GL_LINEAR = 0x2601, - LOCAL_GL_EXP = 0x0800, - LOCAL_GL_EXP2 = 0x0801, - - /* Logic Ops */ - LOCAL_GL_LOGIC_OP = 0x0BF1, - LOCAL_GL_INDEX_LOGIC_OP = 0x0BF1, - LOCAL_GL_COLOR_LOGIC_OP = 0x0BF2, - LOCAL_GL_LOGIC_OP_MODE = 0x0BF0, - LOCAL_GL_CLEAR = 0x1500, - LOCAL_GL_SET = 0x150F, - LOCAL_GL_COPY = 0x1503, - LOCAL_GL_COPY_INVERTED = 0x150C, - LOCAL_GL_NOOP = 0x1505, - LOCAL_GL_INVERT = 0x150A, - LOCAL_GL_AND = 0x1501, - LOCAL_GL_NAND = 0x150E, - LOCAL_GL_OR = 0x1507, - LOCAL_GL_NOR = 0x1508, - LOCAL_GL_XOR = 0x1506, - LOCAL_GL_EQUIV = 0x1509, - LOCAL_GL_AND_REVERSE = 0x1502, - LOCAL_GL_AND_INVERTED = 0x1504, - LOCAL_GL_OR_REVERSE = 0x150B, - LOCAL_GL_OR_INVERTED = 0x150D, - - /* Stencil */ - LOCAL_GL_STENCIL_TEST = 0x0B90, - LOCAL_GL_STENCIL_WRITEMASK = 0x0B98, - LOCAL_GL_STENCIL_BITS = 0x0D57, - LOCAL_GL_STENCIL_FUNC = 0x0B92, - LOCAL_GL_STENCIL_VALUE_MASK = 0x0B93, - LOCAL_GL_STENCIL_REF = 0x0B97, - LOCAL_GL_STENCIL_FAIL = 0x0B94, - LOCAL_GL_STENCIL_PASS_DEPTH_PASS = 0x0B96, - LOCAL_GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95, - LOCAL_GL_STENCIL_CLEAR_VALUE = 0x0B91, - LOCAL_GL_STENCIL_INDEX = 0x1901, - LOCAL_GL_KEEP = 0x1E00, - LOCAL_GL_REPLACE = 0x1E01, - LOCAL_GL_INCR = 0x1E02, - LOCAL_GL_DECR = 0x1E03, - - /* Buffers, Pixel Drawing/Reading */ - LOCAL_GL_NONE = 0, - LOCAL_GL_LEFT = 0x0406, - LOCAL_GL_RIGHT = 0x0407, - /*LOCAL_GL_FRONT = 0x0404, */ - /*LOCAL_GL_BACK = 0x0405, */ - /*LOCAL_GL_FRONT_AND_BACK = 0x0408, */ - LOCAL_GL_FRONT_LEFT = 0x0400, - LOCAL_GL_FRONT_RIGHT = 0x0401, - LOCAL_GL_BACK_LEFT = 0x0402, - LOCAL_GL_BACK_RIGHT = 0x0403, - LOCAL_GL_AUX0 = 0x0409, - LOCAL_GL_AUX1 = 0x040A, - LOCAL_GL_AUX2 = 0x040B, - LOCAL_GL_AUX3 = 0x040C, - LOCAL_GL_COLOR_INDEX = 0x1900, - LOCAL_GL_RED = 0x1903, - LOCAL_GL_GREEN = 0x1904, - LOCAL_GL_BLUE = 0x1905, - LOCAL_GL_ALPHA = 0x1906, - LOCAL_GL_LUMINANCE = 0x1909, - LOCAL_GL_LUMINANCE_ALPHA = 0x190A, - LOCAL_GL_ALPHA_BITS = 0x0D55, - LOCAL_GL_RED_BITS = 0x0D52, - LOCAL_GL_GREEN_BITS = 0x0D53, - LOCAL_GL_BLUE_BITS = 0x0D54, - LOCAL_GL_INDEX_BITS = 0x0D51, - LOCAL_GL_SUBPIXEL_BITS = 0x0D50, - LOCAL_GL_AUX_BUFFERS = 0x0C00, - LOCAL_GL_READ_BUFFER = 0x0C02, - LOCAL_GL_DRAW_BUFFER = 0x0C01, - LOCAL_GL_DOUBLEBUFFER = 0x0C32, - LOCAL_GL_STEREO = 0x0C33, - LOCAL_GL_BITMAP = 0x1A00, - LOCAL_GL_COLOR = 0x1800, - LOCAL_GL_DEPTH = 0x1801, - LOCAL_GL_STENCIL = 0x1802, - LOCAL_GL_DITHER = 0x0BD0, - LOCAL_GL_RGB = 0x1907, - LOCAL_GL_RGBA = 0x1908, - - /* Implementation limits */ - LOCAL_GL_MAX_LIST_NESTING = 0x0B31, - LOCAL_GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35, - LOCAL_GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36, - LOCAL_GL_MAX_NAME_STACK_DEPTH = 0x0D37, - LOCAL_GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38, - LOCAL_GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39, - LOCAL_GL_MAX_EVAL_ORDER = 0x0D30, - LOCAL_GL_MAX_LIGHTS = 0x0D31, - LOCAL_GL_MAX_CLIP_PLANES = 0x0D32, - LOCAL_GL_MAX_TEXTURE_SIZE = 0x0D33, - LOCAL_GL_MAX_PIXEL_MAP_TABLE = 0x0D34, - LOCAL_GL_MAX_VIEWPORT_DIMS = 0x0D3A, - LOCAL_GL_MAX_CLIENT_ATTRIB_STACK_DEPTH= 0x0D3B, - - /* Gets */ - LOCAL_GL_ATTRIB_STACK_DEPTH = 0x0BB0, - LOCAL_GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1, - LOCAL_GL_COLOR_CLEAR_VALUE = 0x0C22, - LOCAL_GL_COLOR_WRITEMASK = 0x0C23, - LOCAL_GL_CURRENT_INDEX = 0x0B01, - LOCAL_GL_CURRENT_COLOR = 0x0B00, - LOCAL_GL_CURRENT_NORMAL = 0x0B02, - LOCAL_GL_CURRENT_RASTER_COLOR = 0x0B04, - LOCAL_GL_CURRENT_RASTER_DISTANCE = 0x0B09, - LOCAL_GL_CURRENT_RASTER_INDEX = 0x0B05, - LOCAL_GL_CURRENT_RASTER_POSITION = 0x0B07, - LOCAL_GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06, - LOCAL_GL_CURRENT_RASTER_POSITION_VALID = 0x0B08, - LOCAL_GL_CURRENT_TEXTURE_COORDS = 0x0B03, - LOCAL_GL_INDEX_CLEAR_VALUE = 0x0C20, - LOCAL_GL_INDEX_MODE = 0x0C30, - LOCAL_GL_INDEX_WRITEMASK = 0x0C21, - LOCAL_GL_MODELVIEW_MATRIX = 0x0BA6, - LOCAL_GL_MODELVIEW_STACK_DEPTH = 0x0BA3, - LOCAL_GL_NAME_STACK_DEPTH = 0x0D70, - LOCAL_GL_PROJECTION_MATRIX = 0x0BA7, - LOCAL_GL_PROJECTION_STACK_DEPTH = 0x0BA4, - LOCAL_GL_RENDER_MODE = 0x0C40, - LOCAL_GL_RGBA_MODE = 0x0C31, - LOCAL_GL_TEXTURE_MATRIX = 0x0BA8, - LOCAL_GL_TEXTURE_STACK_DEPTH = 0x0BA5, - LOCAL_GL_VIEWPORT = 0x0BA2, - - - /* Evaluators */ - LOCAL_GL_AUTO_NORMAL = 0x0D80, - LOCAL_GL_MAP1_COLOR_4 = 0x0D90, - LOCAL_GL_MAP1_GRID_DOMAIN = 0x0DD0, - LOCAL_GL_MAP1_GRID_SEGMENTS = 0x0DD1, - LOCAL_GL_MAP1_INDEX = 0x0D91, - LOCAL_GL_MAP1_NORMAL = 0x0D92, - LOCAL_GL_MAP1_TEXTURE_COORD_1 = 0x0D93, - LOCAL_GL_MAP1_TEXTURE_COORD_2 = 0x0D94, - LOCAL_GL_MAP1_TEXTURE_COORD_3 = 0x0D95, - LOCAL_GL_MAP1_TEXTURE_COORD_4 = 0x0D96, - LOCAL_GL_MAP1_VERTEX_3 = 0x0D97, - LOCAL_GL_MAP1_VERTEX_4 = 0x0D98, - LOCAL_GL_MAP2_COLOR_4 = 0x0DB0, - LOCAL_GL_MAP2_GRID_DOMAIN = 0x0DD2, - LOCAL_GL_MAP2_GRID_SEGMENTS = 0x0DD3, - LOCAL_GL_MAP2_INDEX = 0x0DB1, - LOCAL_GL_MAP2_NORMAL = 0x0DB2, - LOCAL_GL_MAP2_TEXTURE_COORD_1 = 0x0DB3, - LOCAL_GL_MAP2_TEXTURE_COORD_2 = 0x0DB4, - LOCAL_GL_MAP2_TEXTURE_COORD_3 = 0x0DB5, - LOCAL_GL_MAP2_TEXTURE_COORD_4 = 0x0DB6, - LOCAL_GL_MAP2_VERTEX_3 = 0x0DB7, - LOCAL_GL_MAP2_VERTEX_4 = 0x0DB8, - LOCAL_GL_COEFF = 0x0A00, - LOCAL_GL_DOMAIN = 0x0A02, - LOCAL_GL_ORDER = 0x0A01, - - /* Hints */ - LOCAL_GL_FOG_HINT = 0x0C54, - LOCAL_GL_LINE_SMOOTH_HINT = 0x0C52, - LOCAL_GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50, - LOCAL_GL_POINT_SMOOTH_HINT = 0x0C51, - LOCAL_GL_POLYGON_SMOOTH_HINT = 0x0C53, - LOCAL_GL_DONT_CARE = 0x1100, - LOCAL_GL_FASTEST = 0x1101, - LOCAL_GL_NICEST = 0x1102, - - /* Scissor box */ - LOCAL_GL_SCISSOR_TEST = 0x0C11, - LOCAL_GL_SCISSOR_BOX = 0x0C10, - - /* Pixel Mode / Transfer */ - LOCAL_GL_MAP_COLOR = 0x0D10, - LOCAL_GL_MAP_STENCIL = 0x0D11, - LOCAL_GL_INDEX_SHIFT = 0x0D12, - LOCAL_GL_INDEX_OFFSET = 0x0D13, - LOCAL_GL_RED_SCALE = 0x0D14, - LOCAL_GL_RED_BIAS = 0x0D15, - LOCAL_GL_GREEN_SCALE = 0x0D18, - LOCAL_GL_GREEN_BIAS = 0x0D19, - LOCAL_GL_BLUE_SCALE = 0x0D1A, - LOCAL_GL_BLUE_BIAS = 0x0D1B, - LOCAL_GL_ALPHA_SCALE = 0x0D1C, - LOCAL_GL_ALPHA_BIAS = 0x0D1D, - LOCAL_GL_DEPTH_SCALE = 0x0D1E, - LOCAL_GL_DEPTH_BIAS = 0x0D1F, - LOCAL_GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1, - LOCAL_GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0, - LOCAL_GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2, - LOCAL_GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3, - LOCAL_GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4, - LOCAL_GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5, - LOCAL_GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6, - LOCAL_GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7, - LOCAL_GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8, - LOCAL_GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9, - LOCAL_GL_PIXEL_MAP_S_TO_S = 0x0C71, - LOCAL_GL_PIXEL_MAP_I_TO_I = 0x0C70, - LOCAL_GL_PIXEL_MAP_I_TO_R = 0x0C72, - LOCAL_GL_PIXEL_MAP_I_TO_G = 0x0C73, - LOCAL_GL_PIXEL_MAP_I_TO_B = 0x0C74, - LOCAL_GL_PIXEL_MAP_I_TO_A = 0x0C75, - LOCAL_GL_PIXEL_MAP_R_TO_R = 0x0C76, - LOCAL_GL_PIXEL_MAP_G_TO_G = 0x0C77, - LOCAL_GL_PIXEL_MAP_B_TO_B = 0x0C78, - LOCAL_GL_PIXEL_MAP_A_TO_A = 0x0C79, - LOCAL_GL_PACK_ALIGNMENT = 0x0D05, - LOCAL_GL_PACK_LSB_FIRST = 0x0D01, - LOCAL_GL_PACK_ROW_LENGTH = 0x0D02, - LOCAL_GL_PACK_SKIP_PIXELS = 0x0D04, - LOCAL_GL_PACK_SKIP_ROWS = 0x0D03, - LOCAL_GL_PACK_SWAP_BYTES = 0x0D00, - LOCAL_GL_UNPACK_ALIGNMENT = 0x0CF5, - LOCAL_GL_UNPACK_LSB_FIRST = 0x0CF1, - LOCAL_GL_UNPACK_ROW_LENGTH = 0x0CF2, - LOCAL_GL_UNPACK_SKIP_PIXELS = 0x0CF4, - LOCAL_GL_UNPACK_SKIP_ROWS = 0x0CF3, - LOCAL_GL_UNPACK_SWAP_BYTES = 0x0CF0, - LOCAL_GL_ZOOM_X = 0x0D16, - LOCAL_GL_ZOOM_Y = 0x0D17, - - /* Texture mapping */ - LOCAL_GL_TEXTURE_ENV = 0x2300, - LOCAL_GL_TEXTURE_ENV_MODE = 0x2200, - LOCAL_GL_TEXTURE_1D = 0x0DE0, - LOCAL_GL_TEXTURE_2D = 0x0DE1, - LOCAL_GL_TEXTURE_WRAP_S = 0x2802, - LOCAL_GL_TEXTURE_WRAP_T = 0x2803, - LOCAL_GL_TEXTURE_MAG_FILTER = 0x2800, - LOCAL_GL_TEXTURE_MIN_FILTER = 0x2801, - LOCAL_GL_TEXTURE_ENV_COLOR = 0x2201, - LOCAL_GL_TEXTURE_GEN_S = 0x0C60, - LOCAL_GL_TEXTURE_GEN_T = 0x0C61, - LOCAL_GL_TEXTURE_GEN_MODE = 0x2500, - LOCAL_GL_TEXTURE_BORDER_COLOR = 0x1004, - LOCAL_GL_TEXTURE_WIDTH = 0x1000, - LOCAL_GL_TEXTURE_HEIGHT = 0x1001, - LOCAL_GL_TEXTURE_BORDER = 0x1005, - LOCAL_GL_TEXTURE_COMPONENTS = 0x1003, - LOCAL_GL_TEXTURE_RED_SIZE = 0x805C, - LOCAL_GL_TEXTURE_GREEN_SIZE = 0x805D, - LOCAL_GL_TEXTURE_BLUE_SIZE = 0x805E, - LOCAL_GL_TEXTURE_ALPHA_SIZE = 0x805F, - LOCAL_GL_TEXTURE_LUMINANCE_SIZE = 0x8060, - LOCAL_GL_TEXTURE_INTENSITY_SIZE = 0x8061, - LOCAL_GL_NEAREST_MIPMAP_NEAREST = 0x2700, - LOCAL_GL_NEAREST_MIPMAP_LINEAR = 0x2702, - LOCAL_GL_LINEAR_MIPMAP_NEAREST = 0x2701, - LOCAL_GL_LINEAR_MIPMAP_LINEAR = 0x2703, - LOCAL_GL_OBJECT_LINEAR = 0x2401, - LOCAL_GL_OBJECT_PLANE = 0x2501, - LOCAL_GL_EYE_LINEAR = 0x2400, - LOCAL_GL_EYE_PLANE = 0x2502, - LOCAL_GL_SPHERE_MAP = 0x2402, - LOCAL_GL_DECAL = 0x2101, - LOCAL_GL_MODULATE = 0x2100, - LOCAL_GL_NEAREST = 0x2600, - LOCAL_GL_REPEAT = 0x2901, - LOCAL_GL_CLAMP = 0x2900, - LOCAL_GL_S = 0x2000, - LOCAL_GL_T = 0x2001, - LOCAL_GL_R = 0x2002, - LOCAL_GL_Q = 0x2003, - LOCAL_GL_TEXTURE_GEN_R = 0x0C62, - LOCAL_GL_TEXTURE_GEN_Q = 0x0C63, - - /* GL 1.1 texturing */ - LOCAL_GL_PROXY_TEXTURE_1D = 0x8063, - LOCAL_GL_PROXY_TEXTURE_2D = 0x8064, - LOCAL_GL_TEXTURE_PRIORITY = 0x8066, - LOCAL_GL_TEXTURE_RESIDENT = 0x8067, - LOCAL_GL_TEXTURE_BINDING_1D = 0x8068, - LOCAL_GL_TEXTURE_BINDING_2D = 0x8069, - LOCAL_GL_TEXTURE_INTERNAL_FORMAT = 0x1003, - - /* GL 1.2 texturing */ - LOCAL_GL_PACK_SKIP_IMAGES = 0x806B, - LOCAL_GL_PACK_IMAGE_HEIGHT = 0x806C, - LOCAL_GL_UNPACK_SKIP_IMAGES = 0x806D, - LOCAL_GL_UNPACK_IMAGE_HEIGHT = 0x806E, - LOCAL_GL_TEXTURE_3D = 0x806F, - LOCAL_GL_PROXY_TEXTURE_3D = 0x8070, - LOCAL_GL_TEXTURE_DEPTH = 0x8071, - LOCAL_GL_TEXTURE_WRAP_R = 0x8072, - LOCAL_GL_MAX_3D_TEXTURE_SIZE = 0x8073, - LOCAL_GL_TEXTURE_BINDING_3D = 0x806A, - - /* Internal texture formats (GL 1.1) */ - LOCAL_GL_ALPHA4 = 0x803B, - LOCAL_GL_ALPHA8 = 0x803C, - LOCAL_GL_ALPHA12 = 0x803D, - LOCAL_GL_ALPHA16 = 0x803E, - LOCAL_GL_LUMINANCE4 = 0x803F, - LOCAL_GL_LUMINANCE8 = 0x8040, - LOCAL_GL_LUMINANCE12 = 0x8041, - LOCAL_GL_LUMINANCE16 = 0x8042, - LOCAL_GL_LUMINANCE4_ALPHA4 = 0x8043, - LOCAL_GL_LUMINANCE6_ALPHA2 = 0x8044, - LOCAL_GL_LUMINANCE8_ALPHA8 = 0x8045, - LOCAL_GL_LUMINANCE12_ALPHA4 = 0x8046, - LOCAL_GL_LUMINANCE12_ALPHA12 = 0x8047, - LOCAL_GL_LUMINANCE16_ALPHA16 = 0x8048, - LOCAL_GL_INTENSITY = 0x8049, - LOCAL_GL_INTENSITY4 = 0x804A, - LOCAL_GL_INTENSITY8 = 0x804B, - LOCAL_GL_INTENSITY12 = 0x804C, - LOCAL_GL_INTENSITY16 = 0x804D, - LOCAL_GL_R3_G3_B2 = 0x2A10, - LOCAL_GL_RGB4 = 0x804F, - LOCAL_GL_RGB5 = 0x8050, - LOCAL_GL_RGB8 = 0x8051, - LOCAL_GL_RGB10 = 0x8052, - LOCAL_GL_RGB12 = 0x8053, - LOCAL_GL_RGB16 = 0x8054, - LOCAL_GL_RGBA2 = 0x8055, - LOCAL_GL_RGBA4 = 0x8056, - LOCAL_GL_RGB5_A1 = 0x8057, - LOCAL_GL_RGBA8 = 0x8058, - LOCAL_GL_RGB10_A2 = 0x8059, - LOCAL_GL_RGBA12 = 0x805A, - LOCAL_GL_RGBA16 = 0x805B, - - /* Utility */ - LOCAL_GL_VENDOR = 0x1F00, - LOCAL_GL_RENDERER = 0x1F01, - LOCAL_GL_VERSION = 0x1F02, - LOCAL_GL_EXTENSIONS = 0x1F03, - - /* Errors */ - LOCAL_GL_INVALID_VALUE = 0x0501, - LOCAL_GL_INVALID_ENUM = 0x0500, - LOCAL_GL_INVALID_OPERATION = 0x0502, - LOCAL_GL_STACK_OVERFLOW = 0x0503, - LOCAL_GL_STACK_UNDERFLOW = 0x0504, - LOCAL_GL_OUT_OF_MEMORY = 0x0505, - - /* - * Extensions - */ - - /* LOCAL_GL_EXT_blend_minmax and LOCAL_GL_EXT_blend_color */ - LOCAL_GL_CONSTANT_COLOR_EXT = 0x8001, - LOCAL_GL_ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002, - LOCAL_GL_CONSTANT_ALPHA_EXT = 0x8003, - LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004, - LOCAL_GL_BLEND_EQUATION_EXT = 0x8009, - LOCAL_GL_MIN_EXT = 0x8007, - LOCAL_GL_MAX_EXT = 0x8008, - LOCAL_GL_FUNC_ADD_EXT = 0x8006, - LOCAL_GL_FUNC_SUBTRACT_EXT = 0x800A, - LOCAL_GL_FUNC_REVERSE_SUBTRACT_EXT = 0x800B, - LOCAL_GL_BLEND_COLOR_EXT = 0x8005, - - /* LOCAL_GL_EXT_polygon_offset */ - LOCAL_GL_POLYGON_OFFSET_EXT = 0x8037, - LOCAL_GL_POLYGON_OFFSET_FACTOR_EXT = 0x8038, - LOCAL_GL_POLYGON_OFFSET_BIAS_EXT = 0x8039, - - /* LOCAL_GL_EXT_vertex_array */ - LOCAL_GL_VERTEX_ARRAY_EXT = 0x8074, - LOCAL_GL_NORMAL_ARRAY_EXT = 0x8075, - LOCAL_GL_COLOR_ARRAY_EXT = 0x8076, - LOCAL_GL_INDEX_ARRAY_EXT = 0x8077, - LOCAL_GL_TEXTURE_COORD_ARRAY_EXT = 0x8078, - LOCAL_GL_EDGE_FLAG_ARRAY_EXT = 0x8079, - LOCAL_GL_VERTEX_ARRAY_SIZE_EXT = 0x807A, - LOCAL_GL_VERTEX_ARRAY_TYPE_EXT = 0x807B, - LOCAL_GL_VERTEX_ARRAY_STRIDE_EXT = 0x807C, - LOCAL_GL_VERTEX_ARRAY_COUNT_EXT = 0x807D, - LOCAL_GL_NORMAL_ARRAY_TYPE_EXT = 0x807E, - LOCAL_GL_NORMAL_ARRAY_STRIDE_EXT = 0x807F, - LOCAL_GL_NORMAL_ARRAY_COUNT_EXT = 0x8080, - LOCAL_GL_COLOR_ARRAY_SIZE_EXT = 0x8081, - LOCAL_GL_COLOR_ARRAY_TYPE_EXT = 0x8082, - LOCAL_GL_COLOR_ARRAY_STRIDE_EXT = 0x8083, - LOCAL_GL_COLOR_ARRAY_COUNT_EXT = 0x8084, - LOCAL_GL_INDEX_ARRAY_TYPE_EXT = 0x8085, - LOCAL_GL_INDEX_ARRAY_STRIDE_EXT = 0x8086, - LOCAL_GL_INDEX_ARRAY_COUNT_EXT = 0x8087, - LOCAL_GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088, - LOCAL_GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089, - LOCAL_GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = 0x808A, - LOCAL_GL_TEXTURE_COORD_ARRAY_COUNT_EXT = 0x808B, - LOCAL_GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C, - LOCAL_GL_EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D, - LOCAL_GL_VERTEX_ARRAY_POINTER_EXT = 0x808E, - LOCAL_GL_NORMAL_ARRAY_POINTER_EXT = 0x808F, - LOCAL_GL_COLOR_ARRAY_POINTER_EXT = 0x8090, - LOCAL_GL_INDEX_ARRAY_POINTER_EXT = 0x8091, - LOCAL_GL_TEXTURE_COORD_ARRAY_POINTER_EXT = 0x8092, - LOCAL_GL_EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093, - - /* LOCAL_GL_EXT_texture_object */ - LOCAL_GL_TEXTURE_PRIORITY_EXT = 0x8066, - LOCAL_GL_TEXTURE_RESIDENT_EXT = 0x8067, - LOCAL_GL_TEXTURE_1D_BINDING_EXT = 0x8068, - LOCAL_GL_TEXTURE_2D_BINDING_EXT = 0x8069, - - /* LOCAL_GL_EXT_texture3D */ - LOCAL_GL_PACK_SKIP_IMAGES_EXT = 0x806B, - LOCAL_GL_PACK_IMAGE_HEIGHT_EXT = 0x806C, - LOCAL_GL_UNPACK_SKIP_IMAGES_EXT = 0x806D, - LOCAL_GL_UNPACK_IMAGE_HEIGHT_EXT = 0x806E, - LOCAL_GL_TEXTURE_3D_EXT = 0x806F, - LOCAL_GL_PROXY_TEXTURE_3D_EXT = 0x8070, - LOCAL_GL_TEXTURE_DEPTH_EXT = 0x8071, - LOCAL_GL_TEXTURE_WRAP_R_EXT = 0x8072, - LOCAL_GL_MAX_3D_TEXTURE_SIZE_EXT = 0x8073, - LOCAL_GL_TEXTURE_3D_BINDING_EXT = 0x806A, - - /* LOCAL_GL_EXT_paletted_texture */ - LOCAL_GL_TABLE_TOO_LARGE_EXT = 0x8031, - LOCAL_GL_COLOR_TABLE_FORMAT_EXT = 0x80D8, - LOCAL_GL_COLOR_TABLE_WIDTH_EXT = 0x80D9, - LOCAL_GL_COLOR_TABLE_RED_SIZE_EXT = 0x80DA, - LOCAL_GL_COLOR_TABLE_GREEN_SIZE_EXT = 0x80DB, - LOCAL_GL_COLOR_TABLE_BLUE_SIZE_EXT = 0x80DC, - LOCAL_GL_COLOR_TABLE_ALPHA_SIZE_EXT = 0x80DD, - LOCAL_GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = 0x80DE, - LOCAL_GL_COLOR_TABLE_INTENSITY_SIZE_EXT = 0x80DF, - LOCAL_GL_TEXTURE_INDEX_SIZE_EXT = 0x80ED, - LOCAL_GL_COLOR_INDEX1_EXT = 0x80E2, - LOCAL_GL_COLOR_INDEX2_EXT = 0x80E3, - LOCAL_GL_COLOR_INDEX4_EXT = 0x80E4, - LOCAL_GL_COLOR_INDEX8_EXT = 0x80E5, - LOCAL_GL_COLOR_INDEX12_EXT = 0x80E6, - LOCAL_GL_COLOR_INDEX16_EXT = 0x80E7, - - /* LOCAL_GL_EXT_shared_texture_palette */ - LOCAL_GL_SHARED_TEXTURE_PALETTE_EXT = 0x81FB, - - /* LOCAL_GL_EXT_point_parameters */ - LOCAL_GL_POINT_SIZE_MIN_EXT = 0x8126, - LOCAL_GL_POINT_SIZE_MAX_EXT = 0x8127, - LOCAL_GL_POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128, - LOCAL_GL_DISTANCE_ATTENUATION_EXT = 0x8129, - - /* LOCAL_GL_EXT_rescale_normal */ - LOCAL_GL_RESCALE_NORMAL_EXT = 0x803A, - - /* LOCAL_GL_EXT_abgr */ - LOCAL_GL_ABGR_EXT = 0x8000, - - /* LOCAL_GL_SGIS_multitexture */ - LOCAL_GL_SELECTED_TEXTURE_SGIS = 0x835C, - LOCAL_GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835D, - LOCAL_GL_MAX_TEXTURES_SGIS = 0x835E, - LOCAL_GL_TEXTURE0_SGIS = 0x835F, - LOCAL_GL_TEXTURE1_SGIS = 0x8360, - LOCAL_GL_TEXTURE2_SGIS = 0x8361, - LOCAL_GL_TEXTURE3_SGIS = 0x8362, - LOCAL_GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363, - - /* LOCAL_GL_EXT_multitexture */ - LOCAL_GL_SELECTED_TEXTURE_EXT = 0x83C0, - LOCAL_GL_SELECTED_TEXTURE_COORD_SET_EXT = 0x83C1, - LOCAL_GL_SELECTED_TEXTURE_TRANSFORM_EXT = 0x83C2, - LOCAL_GL_MAX_TEXTURES_EXT = 0x83C3, - LOCAL_GL_MAX_TEXTURE_COORD_SETS_EXT = 0x83C4, - LOCAL_GL_TEXTURE_ENV_COORD_SET_EXT = 0x83C5, - LOCAL_GL_TEXTURE0_EXT = 0x83C6, - LOCAL_GL_TEXTURE1_EXT = 0x83C7, - LOCAL_GL_TEXTURE2_EXT = 0x83C8, - LOCAL_GL_TEXTURE3_EXT = 0x83C9, - - /* LOCAL_GL_SGIS_texture_edge_clamp */ - LOCAL_GL_CLAMP_TO_EDGE_SGIS = 0x812F, - - /* OpenGL 1.2 */ - LOCAL_GL_RESCALE_NORMAL = 0x803A, - LOCAL_GL_CLAMP_TO_EDGE = 0x812F, - LOCAL_GL_MAX_ELEMENTS_VERTICES = 0xF0E8, - LOCAL_GL_MAX_ELEMENTS_INDICES = 0xF0E9, - LOCAL_GL_BGR = 0x80E0, - LOCAL_GL_BGRA = 0x80E1, - LOCAL_GL_UNSIGNED_BYTE_3_3_2 = 0x8032, - LOCAL_GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362, - LOCAL_GL_UNSIGNED_SHORT_5_6_5 = 0x8363, - LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364, - LOCAL_GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033, - LOCAL_GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365, - LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034, - LOCAL_GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366, - LOCAL_GL_UNSIGNED_INT_8_8_8_8 = 0x8035, - LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367, - LOCAL_GL_UNSIGNED_INT_10_10_10_2 = 0x8036, - LOCAL_GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368, - LOCAL_GL_LIGHT_MODEL_COLOR_CONTROL = 0x81F8, - LOCAL_GL_SINGLE_COLOR = 0x81F9, - LOCAL_GL_SEPARATE_SPECULAR_COLOR = 0x81FA, - LOCAL_GL_TEXTURE_MIN_LOD = 0x813A, - LOCAL_GL_TEXTURE_MAX_LOD = 0x813B, - LOCAL_GL_TEXTURE_BASE_LEVEL = 0x813C, - LOCAL_GL_TEXTURE_MAX_LEVEL = 0x813D -}; - -typedef struct { GLenum e; const char* name; } ENUM; -#define EDEF(VAR) { (GLenum)(LOCAL_GL_##VAR), #VAR } - -static ENUM enums[] = - { - EDEF(BYTE), - EDEF(UNSIGNED_BYTE), - EDEF(SHORT), - EDEF(UNSIGNED_SHORT), - EDEF(INT), - EDEF(UNSIGNED_INT), - EDEF(FLOAT), - EDEF(DOUBLE), - EDEF(2_BYTES), - EDEF(3_BYTES), - EDEF(4_BYTES), -/* - EDEF(LINES), - EDEF(POINTS), - EDEF(LINE_STRIP), - EDEF(LINE_LOOP), - EDEF(TRIANGLES), - EDEF(TRIANGLE_STRIP), - EDEF(TRIANGLE_FAN), - EDEF(QUADS), - EDEF(QUAD_STRIP), - EDEF(POLYGON), - EDEF(EDGE_FLAG), -*/ - EDEF(VERTEX_ARRAY), - EDEF(NORMAL_ARRAY), - EDEF(COLOR_ARRAY), - EDEF(INDEX_ARRAY), - EDEF(TEXTURE_COORD_ARRAY), - EDEF(EDGE_FLAG_ARRAY), - EDEF(VERTEX_ARRAY_SIZE), - EDEF(VERTEX_ARRAY_TYPE), - EDEF(VERTEX_ARRAY_STRIDE), - EDEF(NORMAL_ARRAY_TYPE), - EDEF(NORMAL_ARRAY_STRIDE), - EDEF(COLOR_ARRAY_SIZE), - EDEF(COLOR_ARRAY_TYPE), - EDEF(COLOR_ARRAY_STRIDE), - EDEF(INDEX_ARRAY_TYPE), - EDEF(INDEX_ARRAY_STRIDE), - EDEF(TEXTURE_COORD_ARRAY_SIZE), - EDEF(TEXTURE_COORD_ARRAY_TYPE), - EDEF(TEXTURE_COORD_ARRAY_STRIDE), - EDEF(EDGE_FLAG_ARRAY_STRIDE), - EDEF(VERTEX_ARRAY_POINTER), - EDEF(NORMAL_ARRAY_POINTER), - EDEF(COLOR_ARRAY_POINTER), - EDEF(INDEX_ARRAY_POINTER), - EDEF(TEXTURE_COORD_ARRAY_POINTER), - EDEF(EDGE_FLAG_ARRAY_POINTER), - EDEF(V2F), - EDEF(V3F), - EDEF(C4UB_V2F), - EDEF(C4UB_V3F), - EDEF(C3F_V3F), - EDEF(N3F_V3F), - EDEF(C4F_N3F_V3F), - EDEF(T2F_V3F), - EDEF(T4F_V4F), - EDEF(T2F_C4UB_V3F), - EDEF(T2F_C3F_V3F), - EDEF(T2F_N3F_V3F), - EDEF(T2F_C4F_N3F_V3F), - EDEF(T4F_C4F_N3F_V4F), - EDEF(MATRIX_MODE), - EDEF(MODELVIEW), - EDEF(PROJECTION), - EDEF(TEXTURE), - EDEF(POINT_SMOOTH), - EDEF(POINT_SIZE), - EDEF(POINT_SIZE_GRANULARITY), - EDEF(POINT_SIZE_RANGE), - EDEF(LINE_SMOOTH), - EDEF(LINE_STIPPLE), - EDEF(LINE_STIPPLE_PATTERN), - EDEF(LINE_STIPPLE_REPEAT), - EDEF(LINE_WIDTH), - EDEF(LINE_WIDTH_GRANULARITY), - EDEF(LINE_WIDTH_RANGE), - EDEF(POINT), - EDEF(LINE), - EDEF(FILL), - EDEF(CCW), - EDEF(CW), - EDEF(FRONT), - EDEF(BACK), - EDEF(CULL_FACE), - EDEF(CULL_FACE_MODE), - EDEF(POLYGON_SMOOTH), - EDEF(POLYGON_STIPPLE), - EDEF(FRONT_FACE), - EDEF(POLYGON_MODE), - EDEF(POLYGON_OFFSET_FACTOR), - EDEF(POLYGON_OFFSET_UNITS), - EDEF(POLYGON_OFFSET_POINT), - EDEF(POLYGON_OFFSET_LINE), - EDEF(POLYGON_OFFSET_FILL), - EDEF(COMPILE), - EDEF(COMPILE_AND_EXECUTE), - EDEF(LIST_BASE), - EDEF(LIST_INDEX), - EDEF(LIST_MODE), - EDEF(NEVER), - EDEF(LESS), - EDEF(GEQUAL), - EDEF(LEQUAL), - EDEF(GREATER), - EDEF(NOTEQUAL), - EDEF(EQUAL), - EDEF(ALWAYS), - EDEF(DEPTH_TEST), - EDEF(DEPTH_BITS), - EDEF(DEPTH_CLEAR_VALUE), - EDEF(DEPTH_FUNC), - EDEF(DEPTH_RANGE), - EDEF(DEPTH_WRITEMASK), - EDEF(DEPTH_COMPONENT), - EDEF(LIGHTING), - EDEF(LIGHT0), - EDEF(LIGHT1), - EDEF(LIGHT2), - EDEF(LIGHT3), - EDEF(LIGHT4), - EDEF(LIGHT5), - EDEF(LIGHT6), - EDEF(LIGHT7), - EDEF(SPOT_EXPONENT), - EDEF(SPOT_CUTOFF), - EDEF(CONSTANT_ATTENUATION), - EDEF(LINEAR_ATTENUATION), - EDEF(QUADRATIC_ATTENUATION), - EDEF(AMBIENT), - EDEF(DIFFUSE), - EDEF(SPECULAR), - EDEF(SHININESS), - EDEF(EMISSION), - EDEF(POSITION), - EDEF(SPOT_DIRECTION), - EDEF(AMBIENT_AND_DIFFUSE), - EDEF(COLOR_INDEXES), - EDEF(LIGHT_MODEL_TWO_SIDE), - EDEF(LIGHT_MODEL_LOCAL_VIEWER), - EDEF(LIGHT_MODEL_AMBIENT), - EDEF(FRONT_AND_BACK), - EDEF(SHADE_MODEL), - EDEF(FLAT), - EDEF(SMOOTH), - EDEF(COLOR_MATERIAL), - EDEF(COLOR_MATERIAL_FACE), - EDEF(COLOR_MATERIAL_PARAMETER), - EDEF(NORMALIZE), - EDEF(CLIP_PLANE0), - EDEF(CLIP_PLANE1), - EDEF(CLIP_PLANE2), - EDEF(CLIP_PLANE3), - EDEF(CLIP_PLANE4), - EDEF(CLIP_PLANE5), - EDEF(ACCUM_RED_BITS), - EDEF(ACCUM_GREEN_BITS), - EDEF(ACCUM_BLUE_BITS), - EDEF(ACCUM_ALPHA_BITS), - EDEF(ACCUM_CLEAR_VALUE), - EDEF(ACCUM), - EDEF(ADD), - EDEF(LOAD), - EDEF(MULT), - EDEF(RETURN), - EDEF(ALPHA_TEST), - EDEF(ALPHA_TEST_REF), - EDEF(ALPHA_TEST_FUNC), - EDEF(BLEND), - EDEF(BLEND_SRC), - EDEF(BLEND_DST), - EDEF(ZERO), - EDEF(ONE), - EDEF(SRC_COLOR), - EDEF(ONE_MINUS_SRC_COLOR), - EDEF(DST_COLOR), - EDEF(ONE_MINUS_DST_COLOR), - EDEF(SRC_ALPHA), - EDEF(ONE_MINUS_SRC_ALPHA), - EDEF(DST_ALPHA), - EDEF(ONE_MINUS_DST_ALPHA), - EDEF(SRC_ALPHA_SATURATE), - EDEF(CONSTANT_COLOR), - EDEF(ONE_MINUS_CONSTANT_COLOR), - EDEF(CONSTANT_ALPHA), - EDEF(ONE_MINUS_CONSTANT_ALPHA), - EDEF(FEEDBACK), - EDEF(RENDER), - EDEF(SELECT), - EDEF(2D), - EDEF(3D), - EDEF(3D_COLOR), - EDEF(3D_COLOR_TEXTURE), - EDEF(4D_COLOR_TEXTURE), - EDEF(POINT_TOKEN), - EDEF(LINE_TOKEN), - EDEF(LINE_RESET_TOKEN), - EDEF(POLYGON_TOKEN), - EDEF(BITMAP_TOKEN), - EDEF(DRAW_PIXEL_TOKEN), - EDEF(COPY_PIXEL_TOKEN), - EDEF(PASS_THROUGH_TOKEN), - EDEF(FEEDBACK_BUFFER_POINTER), - EDEF(FEEDBACK_BUFFER_SIZE), - EDEF(FEEDBACK_BUFFER_TYPE), - EDEF(SELECTION_BUFFER_POINTER), - EDEF(SELECTION_BUFFER_SIZE), - EDEF(FOG), - EDEF(FOG_MODE), - EDEF(FOG_DENSITY), - EDEF(FOG_COLOR), - EDEF(FOG_INDEX), - EDEF(FOG_START), - EDEF(FOG_END), - EDEF(LINEAR), - EDEF(EXP), - EDEF(EXP2), - EDEF(LOGIC_OP), - EDEF(INDEX_LOGIC_OP), - EDEF(COLOR_LOGIC_OP), - EDEF(LOGIC_OP_MODE), - EDEF(CLEAR), - EDEF(SET), - EDEF(COPY), - EDEF(COPY_INVERTED), - EDEF(NOOP), - EDEF(INVERT), - EDEF(AND), - EDEF(NAND), - EDEF(OR), - EDEF(NOR), - EDEF(XOR), - EDEF(EQUIV), - EDEF(AND_REVERSE), - EDEF(AND_INVERTED), - EDEF(OR_REVERSE), - EDEF(OR_INVERTED), - EDEF(STENCIL_TEST), - EDEF(STENCIL_WRITEMASK), - EDEF(STENCIL_BITS), - EDEF(STENCIL_FUNC), - EDEF(STENCIL_VALUE_MASK), - EDEF(STENCIL_REF), - EDEF(STENCIL_FAIL), - EDEF(STENCIL_PASS_DEPTH_PASS), - EDEF(STENCIL_PASS_DEPTH_FAIL), - EDEF(STENCIL_CLEAR_VALUE), - EDEF(STENCIL_INDEX), - EDEF(KEEP), - EDEF(REPLACE), - EDEF(INCR), - EDEF(DECR), - EDEF(NONE), - EDEF(LEFT), - EDEF(RIGHT), - EDEF(FRONT_LEFT), - EDEF(FRONT_RIGHT), - EDEF(BACK_LEFT), - EDEF(BACK_RIGHT), - EDEF(AUX0), - EDEF(AUX1), - EDEF(AUX2), - EDEF(AUX3), - EDEF(COLOR_INDEX), - EDEF(RED), - EDEF(GREEN), - EDEF(BLUE), - EDEF(ALPHA), - EDEF(LUMINANCE), - EDEF(LUMINANCE_ALPHA), - EDEF(ALPHA_BITS), - EDEF(RED_BITS), - EDEF(GREEN_BITS), - EDEF(BLUE_BITS), - EDEF(INDEX_BITS), - EDEF(SUBPIXEL_BITS), - EDEF(AUX_BUFFERS), - EDEF(READ_BUFFER), - EDEF(DRAW_BUFFER), - EDEF(DOUBLEBUFFER), - EDEF(STEREO), - EDEF(BITMAP), - EDEF(COLOR), - EDEF(DEPTH), - EDEF(STENCIL), - EDEF(DITHER), - EDEF(RGB), - EDEF(RGBA), - EDEF(MAX_LIST_NESTING), - EDEF(MAX_ATTRIB_STACK_DEPTH), - EDEF(MAX_MODELVIEW_STACK_DEPTH), - EDEF(MAX_NAME_STACK_DEPTH), - EDEF(MAX_PROJECTION_STACK_DEPTH), - EDEF(MAX_TEXTURE_STACK_DEPTH), - EDEF(MAX_EVAL_ORDER), - EDEF(MAX_LIGHTS), - EDEF(MAX_CLIP_PLANES), - EDEF(MAX_TEXTURE_SIZE), - EDEF(MAX_PIXEL_MAP_TABLE), - EDEF(MAX_VIEWPORT_DIMS), - EDEF(MAX_CLIENT_ATTRIB_STACK_DEPTH), - EDEF(ATTRIB_STACK_DEPTH), - EDEF(CLIENT_ATTRIB_STACK_DEPTH), - EDEF(COLOR_CLEAR_VALUE), - EDEF(COLOR_WRITEMASK), - EDEF(CURRENT_INDEX), - EDEF(CURRENT_COLOR), - EDEF(CURRENT_NORMAL), - EDEF(CURRENT_RASTER_COLOR), - EDEF(CURRENT_RASTER_DISTANCE), - EDEF(CURRENT_RASTER_INDEX), - EDEF(CURRENT_RASTER_POSITION), - EDEF(CURRENT_RASTER_TEXTURE_COORDS), - EDEF(CURRENT_RASTER_POSITION_VALID), - EDEF(CURRENT_TEXTURE_COORDS), - EDEF(INDEX_CLEAR_VALUE), - EDEF(INDEX_MODE), - EDEF(INDEX_WRITEMASK), - EDEF(MODELVIEW_MATRIX), - EDEF(MODELVIEW_STACK_DEPTH), - EDEF(NAME_STACK_DEPTH), - EDEF(PROJECTION_MATRIX), - EDEF(PROJECTION_STACK_DEPTH), - EDEF(RENDER_MODE), - EDEF(RGBA_MODE), - EDEF(TEXTURE_MATRIX), - EDEF(TEXTURE_STACK_DEPTH), - EDEF(VIEWPORT), - EDEF(AUTO_NORMAL), - EDEF(MAP1_COLOR_4), - EDEF(MAP1_GRID_DOMAIN), - EDEF(MAP1_GRID_SEGMENTS), - EDEF(MAP1_INDEX), - EDEF(MAP1_NORMAL), - EDEF(MAP1_TEXTURE_COORD_1), - EDEF(MAP1_TEXTURE_COORD_2), - EDEF(MAP1_TEXTURE_COORD_3), - EDEF(MAP1_TEXTURE_COORD_4), - EDEF(MAP1_VERTEX_3), - EDEF(MAP1_VERTEX_4), - EDEF(MAP2_COLOR_4), - EDEF(MAP2_GRID_DOMAIN), - EDEF(MAP2_GRID_SEGMENTS), - EDEF(MAP2_INDEX), - EDEF(MAP2_NORMAL), - EDEF(MAP2_TEXTURE_COORD_1), - EDEF(MAP2_TEXTURE_COORD_2), - EDEF(MAP2_TEXTURE_COORD_3), - EDEF(MAP2_TEXTURE_COORD_4), - EDEF(MAP2_VERTEX_3), - EDEF(MAP2_VERTEX_4), - EDEF(COEFF), - EDEF(DOMAIN), - EDEF(ORDER), - EDEF(FOG_HINT), - EDEF(LINE_SMOOTH_HINT), - EDEF(PERSPECTIVE_CORRECTION_HINT), - EDEF(POINT_SMOOTH_HINT), - EDEF(POLYGON_SMOOTH_HINT), - EDEF(DONT_CARE), - EDEF(FASTEST), - EDEF(NICEST), - EDEF(SCISSOR_TEST), - EDEF(SCISSOR_BOX), - EDEF(MAP_COLOR), - EDEF(MAP_STENCIL), - EDEF(INDEX_SHIFT), - EDEF(INDEX_OFFSET), - EDEF(RED_SCALE), - EDEF(RED_BIAS), - EDEF(GREEN_SCALE), - EDEF(GREEN_BIAS), - EDEF(BLUE_SCALE), - EDEF(BLUE_BIAS), - EDEF(ALPHA_SCALE), - EDEF(ALPHA_BIAS), - EDEF(DEPTH_SCALE), - EDEF(DEPTH_BIAS), - EDEF(PIXEL_MAP_S_TO_S_SIZE), - EDEF(PIXEL_MAP_I_TO_I_SIZE), - EDEF(PIXEL_MAP_I_TO_R_SIZE), - EDEF(PIXEL_MAP_I_TO_G_SIZE), - EDEF(PIXEL_MAP_I_TO_B_SIZE), - EDEF(PIXEL_MAP_I_TO_A_SIZE), - EDEF(PIXEL_MAP_R_TO_R_SIZE), - EDEF(PIXEL_MAP_G_TO_G_SIZE), - EDEF(PIXEL_MAP_B_TO_B_SIZE), - EDEF(PIXEL_MAP_A_TO_A_SIZE), - EDEF(PIXEL_MAP_S_TO_S), - EDEF(PIXEL_MAP_I_TO_I), - EDEF(PIXEL_MAP_I_TO_R), - EDEF(PIXEL_MAP_I_TO_G), - EDEF(PIXEL_MAP_I_TO_B), - EDEF(PIXEL_MAP_I_TO_A), - EDEF(PIXEL_MAP_R_TO_R), - EDEF(PIXEL_MAP_G_TO_G), - EDEF(PIXEL_MAP_B_TO_B), - EDEF(PIXEL_MAP_A_TO_A), - EDEF(PACK_ALIGNMENT), - EDEF(PACK_LSB_FIRST), - EDEF(PACK_ROW_LENGTH), - EDEF(PACK_SKIP_PIXELS), - EDEF(PACK_SKIP_ROWS), - EDEF(PACK_SWAP_BYTES), - EDEF(UNPACK_ALIGNMENT), - EDEF(UNPACK_LSB_FIRST), - EDEF(UNPACK_ROW_LENGTH), - EDEF(UNPACK_SKIP_PIXELS), - EDEF(UNPACK_SKIP_ROWS), - EDEF(UNPACK_SWAP_BYTES), - EDEF(ZOOM_X), - EDEF(ZOOM_Y), - EDEF(TEXTURE_ENV), - EDEF(TEXTURE_ENV_MODE), - EDEF(TEXTURE_1D), - EDEF(TEXTURE_2D), - EDEF(TEXTURE_WRAP_S), - EDEF(TEXTURE_WRAP_T), - EDEF(TEXTURE_MAG_FILTER), - EDEF(TEXTURE_MIN_FILTER), - EDEF(TEXTURE_ENV_COLOR), - EDEF(TEXTURE_GEN_S), - EDEF(TEXTURE_GEN_T), - EDEF(TEXTURE_GEN_MODE), - EDEF(TEXTURE_BORDER_COLOR), - EDEF(TEXTURE_WIDTH), - EDEF(TEXTURE_HEIGHT), - EDEF(TEXTURE_BORDER), - EDEF(TEXTURE_COMPONENTS), - EDEF(TEXTURE_RED_SIZE), - EDEF(TEXTURE_GREEN_SIZE), - EDEF(TEXTURE_BLUE_SIZE), - EDEF(TEXTURE_ALPHA_SIZE), - EDEF(TEXTURE_LUMINANCE_SIZE), - EDEF(TEXTURE_INTENSITY_SIZE), - EDEF(NEAREST_MIPMAP_NEAREST), - EDEF(NEAREST_MIPMAP_LINEAR), - EDEF(LINEAR_MIPMAP_NEAREST), - EDEF(LINEAR_MIPMAP_LINEAR), - EDEF(OBJECT_LINEAR), - EDEF(OBJECT_PLANE), - EDEF(EYE_LINEAR), - EDEF(EYE_PLANE), - EDEF(SPHERE_MAP), - EDEF(DECAL), - EDEF(MODULATE), - EDEF(NEAREST), - EDEF(REPEAT), - EDEF(CLAMP), - EDEF(S), - EDEF(T), - EDEF(R), - EDEF(Q), - EDEF(TEXTURE_GEN_R), - EDEF(TEXTURE_GEN_Q), - EDEF(PROXY_TEXTURE_1D), - EDEF(PROXY_TEXTURE_2D), - EDEF(TEXTURE_PRIORITY), - EDEF(TEXTURE_RESIDENT), - EDEF(TEXTURE_BINDING_1D), - EDEF(TEXTURE_BINDING_2D), - EDEF(TEXTURE_INTERNAL_FORMAT), - EDEF(PACK_SKIP_IMAGES), - EDEF(PACK_IMAGE_HEIGHT), - EDEF(UNPACK_SKIP_IMAGES), - EDEF(UNPACK_IMAGE_HEIGHT), - EDEF(TEXTURE_3D), - EDEF(PROXY_TEXTURE_3D), - EDEF(TEXTURE_DEPTH), - EDEF(TEXTURE_WRAP_R), - EDEF(MAX_3D_TEXTURE_SIZE), - EDEF(TEXTURE_BINDING_3D), - EDEF(ALPHA4), - EDEF(ALPHA8), - EDEF(ALPHA12), - EDEF(ALPHA16), - EDEF(LUMINANCE4), - EDEF(LUMINANCE8), - EDEF(LUMINANCE12), - EDEF(LUMINANCE16), - EDEF(LUMINANCE4_ALPHA4), - EDEF(LUMINANCE6_ALPHA2), - EDEF(LUMINANCE8_ALPHA8), - EDEF(LUMINANCE12_ALPHA4), - EDEF(LUMINANCE12_ALPHA12), - EDEF(LUMINANCE16_ALPHA16), - EDEF(INTENSITY), - EDEF(INTENSITY4), - EDEF(INTENSITY8), - EDEF(INTENSITY12), - EDEF(INTENSITY16), - EDEF(R3_G3_B2), - EDEF(RGB4), - EDEF(RGB5), - EDEF(RGB8), - EDEF(RGB10), - EDEF(RGB12), - EDEF(RGB16), - EDEF(RGBA2), - EDEF(RGBA4), - EDEF(RGB5_A1), - EDEF(RGBA8), - EDEF(RGB10_A2), - EDEF(RGBA12), - EDEF(RGBA16), - EDEF(VENDOR), - EDEF(RENDERER), - EDEF(VERSION), - EDEF(EXTENSIONS), - EDEF(INVALID_VALUE), - EDEF(INVALID_ENUM), - EDEF(INVALID_OPERATION), - EDEF(STACK_OVERFLOW), - EDEF(STACK_UNDERFLOW), - EDEF(OUT_OF_MEMORY), - - /* extensions */ - EDEF(CONSTANT_COLOR_EXT), - EDEF(ONE_MINUS_CONSTANT_COLOR_EXT), - EDEF(CONSTANT_ALPHA_EXT), - EDEF(ONE_MINUS_CONSTANT_ALPHA_EXT), - EDEF(BLEND_EQUATION_EXT), - EDEF(MIN_EXT), - EDEF(MAX_EXT), - EDEF(FUNC_ADD_EXT), - EDEF(FUNC_SUBTRACT_EXT), - EDEF(FUNC_REVERSE_SUBTRACT_EXT), - EDEF(BLEND_COLOR_EXT), - EDEF(POLYGON_OFFSET_EXT), - EDEF(POLYGON_OFFSET_FACTOR_EXT), - EDEF(POLYGON_OFFSET_BIAS_EXT), - EDEF(VERTEX_ARRAY_EXT), - EDEF(NORMAL_ARRAY_EXT), - EDEF(COLOR_ARRAY_EXT), - EDEF(INDEX_ARRAY_EXT), - EDEF(TEXTURE_COORD_ARRAY_EXT), - EDEF(EDGE_FLAG_ARRAY_EXT), - EDEF(VERTEX_ARRAY_SIZE_EXT), - EDEF(VERTEX_ARRAY_TYPE_EXT), - EDEF(VERTEX_ARRAY_STRIDE_EXT), - EDEF(VERTEX_ARRAY_COUNT_EXT), - EDEF(NORMAL_ARRAY_TYPE_EXT), - EDEF(NORMAL_ARRAY_STRIDE_EXT), - EDEF(NORMAL_ARRAY_COUNT_EXT), - EDEF(COLOR_ARRAY_SIZE_EXT), - EDEF(COLOR_ARRAY_TYPE_EXT), - EDEF(COLOR_ARRAY_STRIDE_EXT), - EDEF(COLOR_ARRAY_COUNT_EXT), - EDEF(INDEX_ARRAY_TYPE_EXT), - EDEF(INDEX_ARRAY_STRIDE_EXT), - EDEF(INDEX_ARRAY_COUNT_EXT), - EDEF(TEXTURE_COORD_ARRAY_SIZE_EXT), - EDEF(TEXTURE_COORD_ARRAY_TYPE_EXT), - EDEF(TEXTURE_COORD_ARRAY_STRIDE_EXT), - EDEF(TEXTURE_COORD_ARRAY_COUNT_EXT), - EDEF(EDGE_FLAG_ARRAY_STRIDE_EXT), - EDEF(EDGE_FLAG_ARRAY_COUNT_EXT), - EDEF(VERTEX_ARRAY_POINTER_EXT), - EDEF(NORMAL_ARRAY_POINTER_EXT), - EDEF(COLOR_ARRAY_POINTER_EXT), - EDEF(INDEX_ARRAY_POINTER_EXT), - EDEF(TEXTURE_COORD_ARRAY_POINTER_EXT), - EDEF(EDGE_FLAG_ARRAY_POINTER_EXT), - EDEF(TEXTURE_PRIORITY_EXT), - EDEF(TEXTURE_RESIDENT_EXT), - EDEF(TEXTURE_1D_BINDING_EXT), - EDEF(TEXTURE_2D_BINDING_EXT), - EDEF(PACK_SKIP_IMAGES_EXT), - EDEF(PACK_IMAGE_HEIGHT_EXT), - EDEF(UNPACK_SKIP_IMAGES_EXT), - EDEF(UNPACK_IMAGE_HEIGHT_EXT), - EDEF(TEXTURE_3D_EXT), - EDEF(PROXY_TEXTURE_3D_EXT), - EDEF(TEXTURE_DEPTH_EXT), - EDEF(TEXTURE_WRAP_R_EXT), - EDEF(MAX_3D_TEXTURE_SIZE_EXT), - EDEF(TEXTURE_3D_BINDING_EXT), - EDEF(TABLE_TOO_LARGE_EXT), - EDEF(COLOR_TABLE_FORMAT_EXT), - EDEF(COLOR_TABLE_WIDTH_EXT), - EDEF(COLOR_TABLE_RED_SIZE_EXT), - EDEF(COLOR_TABLE_GREEN_SIZE_EXT), - EDEF(COLOR_TABLE_BLUE_SIZE_EXT), - EDEF(COLOR_TABLE_ALPHA_SIZE_EXT), - EDEF(COLOR_TABLE_LUMINANCE_SIZE_EXT), - EDEF(COLOR_TABLE_INTENSITY_SIZE_EXT), - EDEF(TEXTURE_INDEX_SIZE_EXT), - EDEF(COLOR_INDEX1_EXT), - EDEF(COLOR_INDEX2_EXT), - EDEF(COLOR_INDEX4_EXT), - EDEF(COLOR_INDEX8_EXT), - EDEF(COLOR_INDEX12_EXT), - EDEF(COLOR_INDEX16_EXT), - EDEF(SHARED_TEXTURE_PALETTE_EXT), - EDEF(POINT_SIZE_MIN_EXT), - EDEF(POINT_SIZE_MAX_EXT), - EDEF(POINT_FADE_THRESHOLD_SIZE_EXT), - EDEF(DISTANCE_ATTENUATION_EXT), - EDEF(RESCALE_NORMAL_EXT), - EDEF(ABGR_EXT), - EDEF(SELECTED_TEXTURE_SGIS), - EDEF(SELECTED_TEXTURE_COORD_SET_SGIS), - EDEF(MAX_TEXTURES_SGIS), - EDEF(TEXTURE0_SGIS), - EDEF(TEXTURE1_SGIS), - EDEF(TEXTURE2_SGIS), - EDEF(TEXTURE3_SGIS), - EDEF(TEXTURE_COORD_SET_SOURCE_SGIS), - EDEF(SELECTED_TEXTURE_EXT), - EDEF(SELECTED_TEXTURE_COORD_SET_EXT), - EDEF(SELECTED_TEXTURE_TRANSFORM_EXT), - EDEF(MAX_TEXTURES_EXT), - EDEF(MAX_TEXTURE_COORD_SETS_EXT), - EDEF(TEXTURE_ENV_COORD_SET_EXT), - EDEF(TEXTURE0_EXT), - EDEF(TEXTURE1_EXT), - EDEF(TEXTURE2_EXT), - EDEF(TEXTURE3_EXT), - EDEF(CLAMP_TO_EDGE_SGIS), - EDEF(RESCALE_NORMAL), - EDEF(CLAMP_TO_EDGE), - EDEF(MAX_ELEMENTS_VERTICES), - EDEF(MAX_ELEMENTS_INDICES), - EDEF(BGR), - EDEF(BGRA), - EDEF(UNSIGNED_BYTE_3_3_2), - EDEF(UNSIGNED_BYTE_2_3_3_REV), - EDEF(UNSIGNED_SHORT_5_6_5), - EDEF(UNSIGNED_SHORT_5_6_5_REV), - EDEF(UNSIGNED_SHORT_4_4_4_4), - EDEF(UNSIGNED_SHORT_4_4_4_4_REV), - EDEF(UNSIGNED_SHORT_5_5_5_1), - EDEF(UNSIGNED_SHORT_1_5_5_5_REV), - EDEF(UNSIGNED_INT_8_8_8_8), - EDEF(UNSIGNED_INT_8_8_8_8_REV), - EDEF(UNSIGNED_INT_10_10_10_2), - EDEF(UNSIGNED_INT_2_10_10_10_REV), - EDEF(LIGHT_MODEL_COLOR_CONTROL), - EDEF(SINGLE_COLOR), - EDEF(SEPARATE_SPECULAR_COLOR), - EDEF(TEXTURE_MIN_LOD), - EDEF(TEXTURE_MAX_LOD), - EDEF(TEXTURE_BASE_LEVEL), - EDEF(TEXTURE_MAX_LEVEL) -}; - -#undef EDEF - -#define N_ENUMS (sizeof(enums) / sizeof(ENUM)) - -/***************************************************************************/ - -static void print_enum_name( FILE* OUT, GLenum e ) -{ - int i, found= 0; - for( i= 0; i < N_ENUMS; ++i ) - { - if( enums[i].e == e ) - { - if( found ) - fprintf( OUT, "/" ); - found= 1; - fprintf( OUT, "%s", enums[i].name ); - } - } - if( ! found ) - fprintf( OUT, "*UNKNOWN* [%04x]", (int)e ); - fprintf( OUT, "\n" ); -} - -#define BOOL_STRING(b) (b ? "true" : "false") - -#define VAR_ENUM(VAR) \ - { \ - GLint e= 0; \ - glGetIntegerv(GL_##VAR,&e); \ - fprintf( OUT, "%s: ", #VAR ); \ - print_enum_name( OUT, (GLenum) e ); \ - } - -#define VAR_FLOAT4(VAR) \ - { \ - GLfloat f[4]; \ - f[0]= f[1]= f[2]= f[3]= 0.0; \ - glGetFloatv(GL_##VAR,f); \ - fprintf( OUT, "%s: [%f %f %f %f]\n", \ - #VAR, f[0], f[1], f[2], f[3] ); \ - } - -#define VAR_MAT_FLOAT4(VAR) \ - { \ - GLfloat f[4]; \ - f[0]= f[1]= f[2]= f[3]= 0.0; \ - glGetMaterialfv(GL_FRONT,GL_##VAR,f); \ - fprintf( OUT, "FRONT_%s: [%f %f %f %f]\n", \ - #VAR, f[0], f[1], f[2], f[3] ); \ - glGetMaterialfv(GL_BACK,GL_##VAR,f); \ - fprintf( OUT, " BACK_%s: [%f %f %f %f]\n", \ - #VAR, f[0], f[1], f[2], f[3] ); \ - } - -#define VAR_LIGHT_FLOAT4(LIGHT,VAR) \ - { \ - GLfloat f[4]; \ - f[0]= f[1]= f[2]= f[3]= 0.0; \ - glGetLightfv(GL_LIGHT0+LIGHT,GL_##VAR,f); \ - fprintf( OUT, "LIGHT%d.%s: [%f %f %f %f]\n", \ - LIGHT, #VAR, f[0], f[1], f[2], f[3] ); \ - } - -#define VAR_LIGHT_FLOAT3(LIGHT,VAR) \ - { \ - GLfloat f[3]; \ - f[0]= f[1]= f[2]= 0.0; \ - glGetLightfv(GL_LIGHT0+LIGHT,GL_##VAR,f); \ - fprintf( OUT, "LIGHT%d.%s: [%f %f %f]\n", \ - LIGHT, #VAR, f[0], f[1], f[2] ); \ - } - -#define VAR_FLOAT3(VAR) \ - { \ - GLfloat f[3]; \ - f[0]= f[1]= f[2]= 0.0; \ - glGetFloatv(GL_##VAR,f) ; \ - fprintf( OUT, "%s: [%f %f %f]\n", \ - #VAR, f[0], f[1], f[2] ); \ - } -#define VAR_FLOAT2(VAR) \ - { \ - GLfloat f[2]; \ - f[0]= f[1]= 0.0; \ - glGetFloatv(GL_##VAR,f); \ - fprintf( OUT, "%s: [%f %f]\n", \ - #VAR, f[0], f[1] ); \ - } - -#define VAR_COLOR(VAR) VAR_FLOAT4(VAR) -#define VAR_TEXCOORD(VAR) VAR_FLOAT4(VAR) -#define VAR_NORMAL(VAR) VAR_FLOAT3(VAR) - -#define VAR_MAT_COLOR(VAR) VAR_MAT_FLOAT4(VAR) -#define VAR_LIGHT_COLOR(LIGHT,VAR) VAR_LIGHT_FLOAT4(LIGHT,VAR) - -#define VAR_FLOAT(VAR) \ - { \ - GLfloat f= 0.0; \ - glGetFloatv(GL_##VAR,&f); \ - fprintf( OUT, "%s: %f\n", #VAR, f ); \ - } - -#define VAR_MAT_FLOAT(VAR) \ - { \ - GLfloat f= 0.0; \ - glGetMaterialfv(GL_FRONT,GL_##VAR,&f); \ - fprintf( OUT, "FRONT_%s: %f\n", #VAR, f ); \ - glGetMaterialfv(GL_BACK,GL_##VAR,&f); \ - fprintf( OUT, " BACK_%s: %f\n", #VAR, f ); \ - } - -#define VAR_LIGHT_FLOAT(LIGHT,VAR) \ - { \ - GLfloat f= 0.0; \ - glGetLightfv(GL_LIGHT0+LIGHT,GL_##VAR,&f); \ - fprintf( OUT, "LIGHT%d.%s: %f\n", \ - LIGHT, #VAR, f ); \ - } - -#define VAR_INT(VAR) \ - { \ - GLint i= 0; \ - glGetIntegerv(GL_##VAR,&i); \ - fprintf( OUT, "%s: %d\n", #VAR, (int)i ); \ - } -#define VAR_INTEGER(VAR) VAR_INT(VAR) -#define VAR_INDEX(VAR) VAR_INT(VAR) -#define VAR_HEXINT(VAR) \ - { \ - GLint i= 0; \ - glGetIntegerv(GL_##VAR,&i); \ - fprintf( OUT, "%s: 0x%04x\n", #VAR, (int)i ); \ - } -#define VAR_INT4(VAR) \ - { \ - GLint i[4]; \ - i[0]= i[1]= i[2]= i[3]= 0; \ - glGetIntegerv(GL_##VAR,i); \ - fprintf( OUT, "%s: [%d %d %d %d]\n", \ - #VAR, (int)i[0], (int)i[1], (int)i[2], (int)i[3] ); \ - } -#define VAR_BOOL(VAR) \ - { \ - GLboolean b= 0; \ - glGetBooleanv(GL_##VAR,&b); \ - fprintf( OUT, "%s: %s\n", #VAR, BOOL_STRING(b) ); \ - } -#define VAR_BOOL4(VAR) \ - { \ - GLboolean b[4]; \ - b[0]= b[1]= b[2]= b[3]= 0; \ - glGetBooleanv(GL_##VAR,b); \ - fprintf( OUT, "%s: [%s %s %s %s]\n", \ - #VAR, \ - BOOL_STRING(b[0]), \ - BOOL_STRING(b[1]), \ - BOOL_STRING(b[2]), \ - BOOL_STRING(b[3]) ); \ - } -#define VAR_PTR(VAR) \ - { \ - GLvoid* p= 0; \ - glGetPointerv(GL_##VAR,&p); \ - fprintf( OUT, "%s: %p\n", #VAR, p ); \ - } -#define VAR_MATRIX(VAR) \ - { \ - GLfloat m[16]; \ - int i; \ - for( i= 0; i < 16; ++i ) m[i]= 0.0; \ - glGetFloatv(GL_##VAR,m); \ - fprintf( OUT, \ - "%s:\n\t[%+.6f %+.6f %+.6f %+.6f]\n\t[%+.6f %+.6f %+.6f -%+.6f]\n\t[%+.6f %+.6f %+.6f %+.6f]\n\t[%+.6f %+.6f %+.6f %+.6f]\n", \ - #VAR, \ - m[0+0*4], m[0+1*4], m[0+2*4], m[0+3*4], \ - m[1+0*4], m[1+1*4], m[1+2*4], m[1+3*4], \ - m[2+0*4], m[2+1*4], m[2+2*4], m[2+3*4], \ - m[3+0*4], m[3+1*4], m[3+2*4], m[3+3*4] ); \ - } - -/***************************************************************************/ - -/* -#define OUT stderr -*/ -void dump_opengl_state( FILE* OUT ) -{ - int i; - GLint n_lights= 0; - - glGetIntegerv( GL_MAX_LIGHTS, &n_lights ); - - VAR_COLOR(CURRENT_COLOR) - VAR_INDEX(CURRENT_INDEX) - VAR_TEXCOORD(CURRENT_TEXTURE_COORDS) - VAR_NORMAL(CURRENT_NORMAL) - VAR_FLOAT4(CURRENT_RASTER_POSITION) - VAR_FLOAT(CURRENT_RASTER_DISTANCE) - VAR_COLOR(CURRENT_RASTER_COLOR) - VAR_INDEX(CURRENT_RASTER_INDEX) - VAR_TEXCOORD(CURRENT_RASTER_TEXTURE_COORDS) - VAR_BOOL(CURRENT_RASTER_POSITION_VALID) - VAR_BOOL(EDGE_FLAG) - - VAR_BOOL (VERTEX_ARRAY) - VAR_INTEGER(VERTEX_ARRAY_SIZE) - VAR_ENUM (VERTEX_ARRAY_TYPE) - VAR_INTEGER(VERTEX_ARRAY_STRIDE) - VAR_PTR (VERTEX_ARRAY_POINTER) - - VAR_BOOL (NORMAL_ARRAY) - VAR_ENUM (NORMAL_ARRAY_TYPE) - VAR_INTEGER(NORMAL_ARRAY_STRIDE) - VAR_PTR (NORMAL_ARRAY_POINTER) - - VAR_BOOL (COLOR_ARRAY) - VAR_INTEGER(COLOR_ARRAY_SIZE) - VAR_ENUM (COLOR_ARRAY_TYPE) - VAR_INTEGER(COLOR_ARRAY_STRIDE) - VAR_PTR (COLOR_ARRAY_POINTER) - - VAR_BOOL (INDEX_ARRAY) - VAR_ENUM (INDEX_ARRAY_TYPE) - VAR_INTEGER(INDEX_ARRAY_STRIDE) - VAR_PTR (INDEX_ARRAY_POINTER) - - VAR_BOOL (TEXTURE_COORD_ARRAY) - VAR_INTEGER(TEXTURE_COORD_ARRAY_SIZE) - VAR_ENUM (TEXTURE_COORD_ARRAY_TYPE) - VAR_INTEGER(TEXTURE_COORD_ARRAY_STRIDE) - VAR_PTR (TEXTURE_COORD_ARRAY_POINTER) - - VAR_BOOL (EDGE_FLAG_ARRAY) - VAR_INTEGER(EDGE_FLAG_ARRAY_STRIDE) - VAR_PTR (EDGE_FLAG_ARRAY_POINTER) - - VAR_MATRIX(MODELVIEW_MATRIX) - VAR_MATRIX(PROJECTION_MATRIX) - VAR_MATRIX(TEXTURE_MATRIX) - VAR_INT4(VIEWPORT) - VAR_FLOAT2(DEPTH_RANGE) - VAR_INT(MODELVIEW_STACK_DEPTH) - VAR_INT(PROJECTION_STACK_DEPTH) - VAR_INT(TEXTURE_STACK_DEPTH) - VAR_ENUM(MATRIX_MODE) - VAR_BOOL(NORMALIZE) - VAR_BOOL(RESCALE_NORMAL_EXT) - VAR_BOOL(CLIP_PLANE0) - VAR_BOOL(CLIP_PLANE1) - VAR_BOOL(CLIP_PLANE2) - VAR_BOOL(CLIP_PLANE3) - VAR_BOOL(CLIP_PLANE4) - VAR_BOOL(CLIP_PLANE5) - /* + glGetClipPlane() */ - - VAR_COLOR(FOG_COLOR) - VAR_INDEX(FOG_INDEX) - VAR_FLOAT(FOG_DENSITY) - VAR_FLOAT(FOG_START) - VAR_FLOAT(FOG_END) - VAR_ENUM(FOG_MODE) - VAR_BOOL(FOG) - VAR_ENUM(SHADE_MODEL) - - VAR_BOOL(LIGHTING) - VAR_BOOL(COLOR_MATERIAL) - VAR_ENUM(COLOR_MATERIAL_PARAMETER) - VAR_ENUM(COLOR_MATERIAL_FACE) - - VAR_MAT_COLOR(AMBIENT) - VAR_MAT_COLOR(DIFFUSE) - VAR_MAT_COLOR(SPECULAR) - VAR_MAT_COLOR(EMISSION) - VAR_MAT_FLOAT(SHININESS) - - VAR_COLOR(LIGHT_MODEL_AMBIENT) - VAR_BOOL(LIGHT_MODEL_LOCAL_VIEWER) - VAR_BOOL(LIGHT_MODEL_TWO_SIDE) -/* VAR_ENUM(LIGHT_MODEL_COLOR_CONTROL)*/ - - for( i= 0; i < n_lights; ++i ) - { - GLboolean b= 0; - - glGetBooleanv( GL_LIGHT0 + i, &b ); - fprintf( OUT, "LIGHT%d: %s\n", i, BOOL_STRING(b) ); - - if( ! b ) - continue; - - VAR_LIGHT_COLOR(i,AMBIENT) - VAR_LIGHT_COLOR(i,DIFFUSE) - VAR_LIGHT_COLOR(i,SPECULAR) - VAR_LIGHT_FLOAT4(i,POSITION) - VAR_LIGHT_FLOAT(i,CONSTANT_ATTENUATION) - VAR_LIGHT_FLOAT(i,LINEAR_ATTENUATION) - VAR_LIGHT_FLOAT(i,QUADRATIC_ATTENUATION) - VAR_LIGHT_FLOAT3(i,SPOT_DIRECTION) - VAR_LIGHT_FLOAT(i,SPOT_EXPONENT) - VAR_LIGHT_FLOAT(i,SPOT_CUTOFF) - /* COLOR_INDEXES */ - } - - VAR_FLOAT(POINT_SIZE) - VAR_BOOL(POINT_SMOOTH) - VAR_FLOAT(LINE_WIDTH) - VAR_BOOL(LINE_SMOOTH) - VAR_HEXINT(LINE_STIPPLE_PATTERN) - VAR_INT(LINE_STIPPLE_REPEAT) - VAR_BOOL(LINE_STIPPLE) - VAR_BOOL(CULL_FACE) - VAR_ENUM(CULL_FACE_MODE) - VAR_ENUM(FRONT_FACE) - VAR_BOOL(POLYGON_SMOOTH) - VAR_ENUM(POLYGON_MODE) - VAR_FLOAT(POLYGON_OFFSET_FACTOR) - VAR_FLOAT(POLYGON_OFFSET_UNITS) - VAR_BOOL(POLYGON_OFFSET_POINT) - VAR_BOOL(POLYGON_OFFSET_LINE) - VAR_BOOL(POLYGON_OFFSET_FILL) - /* GetPolygonStipple */ - VAR_BOOL(POLYGON_STIPPLE) - - VAR_BOOL(TEXTURE_1D) - VAR_BOOL(TEXTURE_2D) -/* VAR_BOOL(TEXTURE_3D)*/ - - VAR_INT(TEXTURE_BINDING_1D) - VAR_INT(TEXTURE_BINDING_2D) -/* VAR_INT(TEXTURE_BINDING_3D)*/ - - /* GetTexImage() */ - /* GetTexLevelParameter() */ - /* GetTexEnv() */ - - VAR_BOOL(TEXTURE_GEN_S) - VAR_BOOL(TEXTURE_GEN_T) - VAR_BOOL(TEXTURE_GEN_R) - VAR_BOOL(TEXTURE_GEN_Q) - - /* GetTexGen() */ - - VAR_BOOL(SCISSOR_TEST) - VAR_INT4(SCISSOR_BOX) - VAR_BOOL(ALPHA_TEST) - VAR_ENUM(ALPHA_TEST_FUNC) - VAR_FLOAT(ALPHA_TEST_REF) - VAR_BOOL(STENCIL_TEST) - VAR_ENUM(STENCIL_FUNC) - VAR_HEXINT(STENCIL_VALUE_MASK) - VAR_INT(STENCIL_REF) - VAR_ENUM(STENCIL_FAIL) - VAR_ENUM(STENCIL_PASS_DEPTH_FAIL) - VAR_ENUM(STENCIL_PASS_DEPTH_PASS) - VAR_BOOL(DEPTH_TEST) - VAR_ENUM(DEPTH_FUNC) - VAR_BOOL(BLEND) - VAR_ENUM(BLEND_SRC) - VAR_ENUM(BLEND_DST) - - VAR_BOOL(DITHER) - VAR_BOOL(LOGIC_OP) /* INDEX_LOGIC_OP */ - VAR_BOOL(COLOR_LOGIC_OP) - - VAR_ENUM(DRAW_BUFFER) - VAR_INT(INDEX_WRITEMASK) - VAR_BOOL4(COLOR_WRITEMASK) - VAR_BOOL(DEPTH_WRITEMASK) - VAR_HEXINT(STENCIL_WRITEMASK) - VAR_COLOR(COLOR_CLEAR_VALUE) - VAR_INDEX(INDEX_CLEAR_VALUE) - VAR_FLOAT(DEPTH_CLEAR_VALUE) - VAR_INT(STENCIL_CLEAR_VALUE) - VAR_FLOAT(ACCUM_CLEAR_VALUE) - - VAR_BOOL(UNPACK_SWAP_BYTES) - VAR_BOOL(UNPACK_LSB_FIRST) -#ifdef UNPACK_IMAGE_HEIGHT - VAR_INT(UNPACK_IMAGE_HEIGHT) -#endif -#ifdef UNPACK_SKIP_IMAGES - VAR_INT(UNPACK_SKIP_IMAGES) -#endif - VAR_INT(UNPACK_ROW_LENGTH) - VAR_INT(UNPACK_SKIP_ROWS) - VAR_INT(UNPACK_SKIP_PIXELS) - VAR_INT(UNPACK_ALIGNMENT) - - VAR_BOOL(PACK_SWAP_BYTES) - VAR_BOOL(PACK_LSB_FIRST) -#ifdef PACK_IMAGE_HEIGHT - VAR_INT(PACK_IMAGE_HEIGHT) -#endif -#ifdef PACK_SKIP_IMAGES - VAR_INT(PACK_SKIP_IMAGES) -#endif - VAR_INT(PACK_ROW_LENGTH) - VAR_INT(PACK_SKIP_ROWS) - VAR_INT(PACK_SKIP_PIXELS) - VAR_INT(PACK_ALIGNMENT) - - VAR_BOOL(MAP_COLOR) - VAR_BOOL(MAP_STENCIL) - VAR_INT(INDEX_SHIFT) - VAR_INT(INDEX_OFFSET) - VAR_FLOAT(RED_SCALE) - VAR_FLOAT(GREEN_SCALE) - VAR_FLOAT(BLUE_SCALE) - VAR_FLOAT(ALPHA_SCALE) - VAR_FLOAT(DEPTH_SCALE) - VAR_FLOAT(RED_BIAS) - VAR_FLOAT(GREEN_BIAS) - VAR_FLOAT(BLUE_BIAS) - VAR_FLOAT(ALPHA_BIAS) - VAR_FLOAT(DEPTH_BIAS) - - VAR_FLOAT(ZOOM_X) - VAR_FLOAT(ZOOM_Y) - - VAR_ENUM(READ_BUFFER) - - VAR_BOOL(AUTO_NORMAL) - - VAR_ENUM(PERSPECTIVE_CORRECTION_HINT) - VAR_ENUM(POINT_SMOOTH_HINT) - VAR_ENUM(LINE_SMOOTH_HINT) - VAR_ENUM(POLYGON_SMOOTH_HINT) - VAR_ENUM(FOG_HINT) - - VAR_INT(MAX_LIGHTS) - VAR_INT(MAX_CLIP_PLANES) - VAR_INT(MAX_MODELVIEW_STACK_DEPTH) - VAR_INT(MAX_PROJECTION_STACK_DEPTH) - VAR_INT(MAX_TEXTURE_STACK_DEPTH) - VAR_INT(SUBPIXEL_BITS) -#ifdef GL_MAX_3D_TEXTURE_SIZE - VAR_INT(MAX_3D_TEXTURE_SIZE) -#endif - VAR_INT(MAX_TEXTURE_SIZE) - VAR_INT(MAX_PIXEL_MAP_TABLE) - VAR_INT(MAX_NAME_STACK_DEPTH) - VAR_INT(MAX_LIST_NESTING) - VAR_INT(MAX_EVAL_ORDER) - VAR_INT(MAX_VIEWPORT_DIMS) - VAR_INT(MAX_ATTRIB_STACK_DEPTH) - VAR_INT(MAX_CLIENT_ATTRIB_STACK_DEPTH) - VAR_INT(AUX_BUFFERS) - VAR_BOOL(RGBA_MODE) - VAR_BOOL(INDEX_MODE) - VAR_BOOL(DOUBLEBUFFER) - VAR_BOOL(STEREO) -#ifdef GL_ALIASED_POINT_SIZE_RANGE - VAR_FLOAT2(ALIASED_POINT_SIZE_RANGE) -#endif -#ifdef GL_POINT_SIZE_RANGE - VAR_FLOAT2(POINT_SIZE_RANGE) /* SMOOTH_POINT_SIZE_RANGE */ -#endif - VAR_FLOAT(POINT_SIZE_GRANULARITY) /* SMOOTH_POINT_SIZE_GRANULARITY */ -#ifdef GL_ALIASED_LINE_WIDTH_RANGE - VAR_FLOAT2(ALIASED_LINE_WIDTH_RANGE) -#endif - VAR_FLOAT2(LINE_WIDTH_RANGE) /* SMOOTH_LINE_WIDTH_RANGE */ - VAR_FLOAT(LINE_WIDTH_GRANULARITY) /* SMOOTH_LINE_WIDTH_GRANULARITY */ - -#ifdef GL_MAX_ELEMENTS_INDICES - VAR_INT(MAX_ELEMENTS_INDICES) -#endif -#ifdef GL_MAX_ELEMENTS_VERTICES - VAR_INT(MAX_ELEMENTS_VERTICES) -#endif - VAR_INT(RED_BITS) - VAR_INT(GREEN_BITS) - VAR_INT(BLUE_BITS) - VAR_INT(ALPHA_BITS) - VAR_INT(INDEX_BITS) - VAR_INT(DEPTH_BITS) - VAR_INT(STENCIL_BITS) - VAR_INT(ACCUM_RED_BITS) - VAR_INT(ACCUM_GREEN_BITS) - VAR_INT(ACCUM_BLUE_BITS) - VAR_INT(ACCUM_ALPHA_BITS) - - VAR_INT(LIST_BASE) - VAR_INT(LIST_INDEX) - VAR_ENUM(LIST_MODE) - VAR_INT(ATTRIB_STACK_DEPTH) - VAR_INT(CLIENT_ATTRIB_STACK_DEPTH) - VAR_INT(NAME_STACK_DEPTH) - VAR_ENUM(RENDER_MODE) - VAR_PTR(SELECTION_BUFFER_POINTER) - VAR_INT(SELECTION_BUFFER_SIZE) - VAR_PTR(FEEDBACK_BUFFER_POINTER) - VAR_INT(FEEDBACK_BUFFER_SIZE) - VAR_ENUM(FEEDBACK_BUFFER_TYPE) - - /* glGetError() */ -} - -/***************************************************************************/ - -/*#define TEST*/ -#ifdef TEST - -#include <GL/glut.h> - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 300); - glutInitDisplayMode(GLUT_RGB); - glutCreateWindow(argv[0]); - dump_opengl_state(stdout); - return 0; -} - -#endif - diff --git a/progs/util/errcheck.c b/progs/util/errcheck.c deleted file mode 100644 index fe9c2973c3..0000000000 --- a/progs/util/errcheck.c +++ /dev/null @@ -1,27 +0,0 @@ -/* errcheck.c */ - - -/* - * Call this function in your rendering loop to check for GL errors - * during development. Remove from release code. - * - * Written by Brian Paul and in the public domain. - */ - - -#include <GL/gl.h> -#include <GL/glu.h> -#incldue <stdio.h> - - - -GLboolean CheckError( const char *message ) -{ - GLenum error = glGetError(); - if (error) { - char *err = (char *) gluErrorString( error ); - fprintf( stderr, "GL Error: %s at %s\n", err, message ); - return GL_TRUE; - } - return GL_FALSE; -} diff --git a/progs/util/extfuncs.h b/progs/util/extfuncs.h deleted file mode 100644 index 2bb57030a8..0000000000 --- a/progs/util/extfuncs.h +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Utility for getting OpenGL extension function pointers - * Meant to be #included. - */ - -/* OpenGL 2.0 */ -static PFNGLATTACHSHADERPROC glAttachShader_func = NULL; -static PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation_func = NULL; -static PFNGLCOMPILESHADERPROC glCompileShader_func = NULL; -static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL; -static PFNGLCREATESHADERPROC glCreateShader_func = NULL; -static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL; -static PFNGLDELETESHADERPROC glDeleteShader_func = NULL; -static PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib_func = NULL; -static PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform_func = NULL; -static PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders_func = NULL; -static PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation_func = NULL; -static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog_func = NULL; -static PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog_func = NULL; -static PFNGLGETSHADERIVPROC glGetShaderiv_func = NULL; -static PFNGLGETPROGRAMIVPROC glGetProgramiv_func = NULL; -static PFNGLGETSHADERSOURCEPROC glGetShaderSource_func = NULL; -static PFNGLGETUNIFORMFVPROC glGetUniformfv_func = NULL; -static PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation_func = NULL; -static PFNGLISPROGRAMPROC glIsProgram_func = NULL; -static PFNGLISSHADERPROC glIsShader_func = NULL; -static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL; -static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL; -static PFNGLUNIFORM1IPROC glUniform1i_func = NULL; -static PFNGLUNIFORM2IPROC glUniform2i_func = NULL; -static PFNGLUNIFORM3IPROC glUniform3i_func = NULL; -static PFNGLUNIFORM4IPROC glUniform4i_func = NULL; -static PFNGLUNIFORM1FPROC glUniform1f_func = NULL; -static PFNGLUNIFORM2FPROC glUniform2f_func = NULL; -static PFNGLUNIFORM3FPROC glUniform3f_func = NULL; -static PFNGLUNIFORM4FPROC glUniform4f_func = NULL; -static PFNGLUNIFORM1FVPROC glUniform1fv_func = NULL; -static PFNGLUNIFORM2FVPROC glUniform2fv_func = NULL; -static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL; -static PFNGLUNIFORM4FVPROC glUniform4fv_func = NULL; -static PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv_func = NULL; -static PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv_func = NULL; -static PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv_func = NULL; -static PFNGLUSEPROGRAMPROC glUseProgram_func = NULL; -static PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f_func = NULL; -static PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f_func = NULL; -static PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f_func = NULL; -static PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f_func = NULL; -static PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv_func = NULL; -static PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv_func = NULL; -static PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv_func = NULL; -static PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv_func = NULL; -static PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer_func = NULL; -static PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray_func = NULL; -static PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray_func = NULL; - -/* OpenGL 2.1 */ -static PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv_func = NULL; -static PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv_func = NULL; -static PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv_func = NULL; -static PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv_func = NULL; -static PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv_func = NULL; -static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL; - -/* OpenGL 1.4 */ -static PFNGLPOINTPARAMETERFVPROC glPointParameterfv_func = NULL; -static PFNGLSECONDARYCOLOR3FVPROC glSecondaryColor3fv_func = NULL; - -/* GL_ARB_vertex/fragment_program */ -static PFNGLBINDPROGRAMARBPROC glBindProgramARB_func = NULL; -static PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB_func = NULL; -static PFNGLGENPROGRAMSARBPROC glGenProgramsARB_func = NULL; -static PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB_func = NULL; -static PFNGLISPROGRAMARBPROC glIsProgramARB_func = NULL; -static PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB_func = NULL; -static PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB_func = NULL; -static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB_func = NULL; -static PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB_func = NULL; - -/* GL_APPLE_vertex_array_object */ -static PFNGLBINDVERTEXARRAYAPPLEPROC glBindVertexArrayAPPLE_func = NULL; -static PFNGLDELETEVERTEXARRAYSAPPLEPROC glDeleteVertexArraysAPPLE_func = NULL; -static PFNGLGENVERTEXARRAYSAPPLEPROC glGenVertexArraysAPPLE_func = NULL; -static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL; - -/* GL_EXT_stencil_two_side */ -static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL; - -/* GL_ARB_buffer_object */ -static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL; -static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL; -static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL; -static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL; -static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL; -static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL; -static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL; - -/* GL_EXT_framebuffer_object */ -static PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT_func = NULL; -static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT_func = NULL; -static PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT_func = NULL; -static PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT_func = NULL; -static PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT_func = NULL; -static PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT_func = NULL; -static PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT_func = NULL; -static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT_func = NULL; -static PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT_func = NULL; -static PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT_func = NULL; -static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT_func = NULL; -static PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT_func = NULL; -static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT_func = NULL; -static PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT_func = NULL; -static PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT_func = NULL; -static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT_func = NULL; -static PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT_func = NULL; - -/* GL_ARB_framebuffer_object */ -static PFNGLISRENDERBUFFERPROC glIsRenderbuffer_func = NULL; -static PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer_func = NULL; -static PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers_func = NULL; -static PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers_func = NULL; -static PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage_func = NULL; -static PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv_func = NULL; -static PFNGLISFRAMEBUFFERPROC glIsFramebuffer_func = NULL; -static PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer_func = NULL; -static PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers_func = NULL; -static PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers_func = NULL; -static PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus_func = NULL; -static PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D_func = NULL; -static PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D_func = NULL; -static PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D_func = NULL; -static PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer_func = NULL; -static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv_func = NULL; -static PFNGLGENERATEMIPMAPPROC glGenerateMipmap_func = NULL; -static PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer_func = NULL; -static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample_func = NULL; -static PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer_func = NULL; - - -static void -GetExtensionFuncs(void) -{ - /* OpenGL 2.0 */ - glAttachShader_func = (PFNGLATTACHSHADERPROC) glutGetProcAddress("glAttachShader"); - glBindAttribLocation_func = (PFNGLBINDATTRIBLOCATIONPROC) glutGetProcAddress("glBindAttribLocation"); - glCompileShader_func = (PFNGLCOMPILESHADERPROC) glutGetProcAddress("glCompileShader"); - glCreateProgram_func = (PFNGLCREATEPROGRAMPROC) glutGetProcAddress("glCreateProgram"); - glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader"); - glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram"); - glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader"); - glGetActiveAttrib_func = (PFNGLGETACTIVEATTRIBPROC) glutGetProcAddress("glGetActiveAttrib"); - glGetActiveUniform_func = (PFNGLGETACTIVEUNIFORMPROC) glutGetProcAddress("glGetActiveUniform"); - glGetAttachedShaders_func = (PFNGLGETATTACHEDSHADERSPROC) glutGetProcAddress("glGetAttachedShaders"); - glGetAttribLocation_func = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress("glGetAttribLocation"); - glGetProgramInfoLog_func = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress("glGetProgramInfoLog"); - glGetShaderInfoLog_func = (PFNGLGETSHADERINFOLOGPROC) glutGetProcAddress("glGetShaderInfoLog"); - glGetProgramiv_func = (PFNGLGETPROGRAMIVPROC) glutGetProcAddress("glGetProgramiv"); - glGetShaderiv_func = (PFNGLGETSHADERIVPROC) glutGetProcAddress("glGetShaderiv"); - glGetShaderSource_func = (PFNGLGETSHADERSOURCEPROC) glutGetProcAddress("glGetShaderSource"); - glGetUniformLocation_func = (PFNGLGETUNIFORMLOCATIONPROC) glutGetProcAddress("glGetUniformLocation"); - glGetUniformfv_func = (PFNGLGETUNIFORMFVPROC) glutGetProcAddress("glGetUniformfv"); - glIsProgram_func = (PFNGLISPROGRAMPROC) glutGetProcAddress("glIsProgram"); - glIsShader_func = (PFNGLISSHADERPROC) glutGetProcAddress("glIsShader"); - glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram"); - glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource"); - glUniform1i_func = (PFNGLUNIFORM1IPROC) glutGetProcAddress("glUniform1i"); - glUniform2i_func = (PFNGLUNIFORM2IPROC) glutGetProcAddress("glUniform2i"); - glUniform3i_func = (PFNGLUNIFORM3IPROC) glutGetProcAddress("glUniform3i"); - glUniform4i_func = (PFNGLUNIFORM4IPROC) glutGetProcAddress("glUniform3i"); - glUniform1f_func = (PFNGLUNIFORM1FPROC) glutGetProcAddress("glUniform1f"); - glUniform2f_func = (PFNGLUNIFORM2FPROC) glutGetProcAddress("glUniform2f"); - glUniform3f_func = (PFNGLUNIFORM3FPROC) glutGetProcAddress("glUniform3f"); - glUniform4f_func = (PFNGLUNIFORM4FPROC) glutGetProcAddress("glUniform4f"); - glUniform1fv_func = (PFNGLUNIFORM1FVPROC) glutGetProcAddress("glUniform1fv"); - glUniform2fv_func = (PFNGLUNIFORM2FVPROC) glutGetProcAddress("glUniform2fv"); - glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv"); - glUniform4fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform4fv"); - glUniformMatrix2fv_func = (PFNGLUNIFORMMATRIX2FVPROC) glutGetProcAddress("glUniformMatrix2fv"); - glUniformMatrix3fv_func = (PFNGLUNIFORMMATRIX3FVPROC) glutGetProcAddress("glUniformMatrix3fv"); - glUniformMatrix4fv_func = (PFNGLUNIFORMMATRIX4FVPROC) glutGetProcAddress("glUniformMatrix4fv"); - glUseProgram_func = (PFNGLUSEPROGRAMPROC) glutGetProcAddress("glUseProgram"); - glVertexAttrib1f_func = (PFNGLVERTEXATTRIB1FPROC) glutGetProcAddress("glVertexAttrib1f"); - glVertexAttrib2f_func = (PFNGLVERTEXATTRIB2FPROC) glutGetProcAddress("glVertexAttrib2f"); - glVertexAttrib3f_func = (PFNGLVERTEXATTRIB3FPROC) glutGetProcAddress("glVertexAttrib3f"); - glVertexAttrib4f_func = (PFNGLVERTEXATTRIB4FPROC) glutGetProcAddress("glVertexAttrib4f"); - glVertexAttrib1fv_func = (PFNGLVERTEXATTRIB1FVPROC) glutGetProcAddress("glVertexAttrib1fv"); - glVertexAttrib2fv_func = (PFNGLVERTEXATTRIB2FVPROC) glutGetProcAddress("glVertexAttrib2fv"); - glVertexAttrib3fv_func = (PFNGLVERTEXATTRIB3FVPROC) glutGetProcAddress("glVertexAttrib3fv"); - glVertexAttrib4fv_func = (PFNGLVERTEXATTRIB4FVPROC) glutGetProcAddress("glVertexAttrib4fv"); - - glVertexAttribPointer_func = (PFNGLVERTEXATTRIBPOINTERPROC) glutGetProcAddress("glVertexAttribPointer"); - glEnableVertexAttribArray_func = (PFNGLENABLEVERTEXATTRIBARRAYPROC) glutGetProcAddress("glEnableVertexAttribArray"); - glDisableVertexAttribArray_func = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) glutGetProcAddress("glDisableVertexAttribArray"); - - /* OpenGL 2.1 */ - glUniformMatrix2x3fv_func = (PFNGLUNIFORMMATRIX2X3FVPROC) glutGetProcAddress("glUniformMatrix2x3fv"); - glUniformMatrix3x2fv_func = (PFNGLUNIFORMMATRIX3X2FVPROC) glutGetProcAddress("glUniformMatrix3x2fv"); - glUniformMatrix2x4fv_func = (PFNGLUNIFORMMATRIX2X4FVPROC) glutGetProcAddress("glUniformMatrix2x4fv"); - glUniformMatrix4x2fv_func = (PFNGLUNIFORMMATRIX4X2FVPROC) glutGetProcAddress("glUniformMatrix4x2fv"); - glUniformMatrix3x4fv_func = (PFNGLUNIFORMMATRIX3X4FVPROC) glutGetProcAddress("glUniformMatrix3x4fv"); - glUniformMatrix4x3fv_func = (PFNGLUNIFORMMATRIX4X3FVPROC) glutGetProcAddress("glUniformMatrix4x3fv"); - - /* OpenGL 1.4 */ - glPointParameterfv_func = (PFNGLPOINTPARAMETERFVPROC) glutGetProcAddress("glPointParameterfv"); - glSecondaryColor3fv_func = (PFNGLSECONDARYCOLOR3FVPROC) glutGetProcAddress("glSecondaryColor3fv"); - - /* GL_ARB_vertex/fragment_program */ - glBindProgramARB_func = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress("glBindProgramARB"); - glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB"); - glGenProgramsARB_func = (PFNGLGENPROGRAMSARBPROC) glutGetProcAddress("glGenProgramsARB"); - glGetProgramLocalParameterdvARB_func = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) glutGetProcAddress("glGetProgramLocalParameterdvARB"); - glIsProgramARB_func = (PFNGLISPROGRAMARBPROC) glutGetProcAddress("glIsProgramARB"); - glProgramLocalParameter4dARB_func = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC) glutGetProcAddress("glProgramLocalParameter4dARB"); - glProgramLocalParameter4fvARB_func = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress("glProgramLocalParameter4fvARB"); - glProgramStringARB_func = (PFNGLPROGRAMSTRINGARBPROC) glutGetProcAddress("glProgramStringARB"); - glVertexAttrib1fARB_func = (PFNGLVERTEXATTRIB1FARBPROC) glutGetProcAddress("glVertexAttrib1fARB"); - - /* GL_APPLE_vertex_array_object */ - glBindVertexArrayAPPLE_func = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress("glBindVertexArrayAPPLE"); - glDeleteVertexArraysAPPLE_func = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress("glDeleteVertexArraysAPPLE"); - glGenVertexArraysAPPLE_func = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress("glGenVertexArraysAPPLE"); - glIsVertexArrayAPPLE_func = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress("glIsVertexArrayAPPLE"); - - /* GL_EXT_stencil_two_side */ - glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT"); - - /* GL_ARB_vertex_buffer_object */ - glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB"); - glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB"); - glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB"); - glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB"); - glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB"); - glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB"); - glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB"); - - /* GL_EXT_framebuffer_object */ - glIsRenderbufferEXT_func = (PFNGLISRENDERBUFFEREXTPROC) glutGetProcAddress("glIsRenderbufferEXT"); - glBindRenderbufferEXT_func = (PFNGLBINDRENDERBUFFEREXTPROC) glutGetProcAddress("glBindRenderbufferEXT"); - glDeleteRenderbuffersEXT_func = (PFNGLDELETERENDERBUFFERSEXTPROC) glutGetProcAddress("glDeleteRenderbuffersEXT"); - glGenRenderbuffersEXT_func = (PFNGLGENRENDERBUFFERSEXTPROC) glutGetProcAddress("glGenRenderbuffersEXT"); - glRenderbufferStorageEXT_func = (PFNGLRENDERBUFFERSTORAGEEXTPROC) glutGetProcAddress("glRenderbufferStorageEXT"); - glGetRenderbufferParameterivEXT_func = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) glutGetProcAddress("glGetRenderbufferParameterivEXT"); - glIsFramebufferEXT_func = (PFNGLISFRAMEBUFFEREXTPROC) glutGetProcAddress("glIsFramebufferEXT"); - glBindFramebufferEXT_func = (PFNGLBINDFRAMEBUFFEREXTPROC) glutGetProcAddress("glBindFramebufferEXT"); - glDeleteFramebuffersEXT_func = (PFNGLDELETEFRAMEBUFFERSEXTPROC) glutGetProcAddress("glDeleteFramebuffersEXT"); - glGenFramebuffersEXT_func = (PFNGLGENFRAMEBUFFERSEXTPROC) glutGetProcAddress("glGenFramebuffersEXT"); - glCheckFramebufferStatusEXT_func = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) glutGetProcAddress("glCheckFramebufferStatusEXT"); - glFramebufferTexture1DEXT_func = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) glutGetProcAddress("glFramebufferTexture1DEXT"); - glFramebufferTexture2DEXT_func = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) glutGetProcAddress("glFramebufferTexture2DEXT"); - glFramebufferTexture3DEXT_func = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) glutGetProcAddress("glFramebufferTexture3DEXT"); - glFramebufferRenderbufferEXT_func = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) glutGetProcAddress("glFramebufferRenderbufferEXT"); - glGetFramebufferAttachmentParameterivEXT_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) glutGetProcAddress("glGetFramebufferAttachmentParameterivEXT"); - glGenerateMipmapEXT_func = (PFNGLGENERATEMIPMAPEXTPROC) glutGetProcAddress("glGenerateMipmapEXT"); - - /* GL_ARB_framebuffer_object */ - glIsRenderbuffer_func = (PFNGLISRENDERBUFFERPROC) glutGetProcAddress("glIsRenderbuffer"); - glBindRenderbuffer_func = (PFNGLBINDRENDERBUFFERPROC) glutGetProcAddress("glBindRenderbuffer"); - glDeleteRenderbuffers_func = (PFNGLDELETERENDERBUFFERSPROC) glutGetProcAddress("glDeleteRenderbuffers"); - glGenRenderbuffers_func = (PFNGLGENRENDERBUFFERSPROC) glutGetProcAddress("glGenRenderbuffers"); - glRenderbufferStorage_func = (PFNGLRENDERBUFFERSTORAGEPROC) glutGetProcAddress("glRenderbufferStorage"); - glGetRenderbufferParameteriv_func = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) glutGetProcAddress("glGetRenderbufferParameteriv"); - glIsFramebuffer_func = (PFNGLISFRAMEBUFFERPROC) glutGetProcAddress("glIsFramebuffer"); - glBindFramebuffer_func = (PFNGLBINDFRAMEBUFFERPROC) glutGetProcAddress("glBindFramebuffer"); - glDeleteFramebuffers_func = (PFNGLDELETEFRAMEBUFFERSPROC) glutGetProcAddress("glDeleteFramebuffers"); - glGenFramebuffers_func = (PFNGLGENFRAMEBUFFERSPROC) glutGetProcAddress("glGenFramebuffers"); - glCheckFramebufferStatus_func = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) glutGetProcAddress("glCheckFramebufferStatus"); - glFramebufferTexture1D_func = (PFNGLFRAMEBUFFERTEXTURE1DPROC) glutGetProcAddress("glFramebufferTexture1D"); - glFramebufferTexture2D_func = (PFNGLFRAMEBUFFERTEXTURE2DPROC) glutGetProcAddress("glFramebufferTexture2D"); - glFramebufferTexture3D_func = (PFNGLFRAMEBUFFERTEXTURE3DPROC) glutGetProcAddress("glFramebufferTexture3D"); - glFramebufferRenderbuffer_func = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) glutGetProcAddress("glFramebufferRenderbuffer"); - glGetFramebufferAttachmentParameteriv_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) glutGetProcAddress("glGetFramebufferAttachmentParameteriv"); - glGenerateMipmap_func = (PFNGLGENERATEMIPMAPPROC) glutGetProcAddress("glGenerateMipmap"); - glBlitFramebuffer_func = (PFNGLBLITFRAMEBUFFERPROC) glutGetProcAddress("glBlitFramebuffer"); - glRenderbufferStorageMultisample_func = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) glutGetProcAddress("glRenderbufferStorageMultisample"); - glFramebufferTextureLayer_func = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) glutGetProcAddress("glFramebufferTextureLayer"); -} - diff --git a/progs/util/glstate.c b/progs/util/glstate.c deleted file mode 100644 index 21d7e4552d..0000000000 --- a/progs/util/glstate.c +++ /dev/null @@ -1,502 +0,0 @@ - -/* - * Print GL state information (for debugging) - * Copyright (C) 1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * Revision 1.1 1999/08/19 00:55:42 jtg - * Initial revision - * - * Revision 1.4 1999/06/19 01:36:43 brianp - * more features added - * - * Revision 1.3 1999/02/24 05:16:20 brianp - * added still more records to EnumTable - * - * Revision 1.2 1998/11/24 03:47:54 brianp - * added more records to EnumTable - * - * Revision 1.1 1998/11/24 03:41:16 brianp - * Initial revision - * - */ - - - -#include <assert.h> -#include <GL/gl.h> -#include <stdio.h> -#include <stdlib.h> -#include "glstate.h" - - -#define FLOAT 1 -#define INT 2 -#define DOUBLE 3 -#define BOOLEAN 4 -#define ENUM 5 -#define VOID 6 -#define LAST_TOKEN ~0 - - -struct EnumRecord { - GLenum enumerator; /* GLenum constant */ - const char *string; /* string name */ - int getType; /* INT, FLOAT, DOUBLE, BOOLEAN, ENUM, or VOID */ - int getCount; /* number of values returned by the glGet*v() call */ -}; - - -/* XXX Lots more records to add here! Help, anyone? */ - -static struct EnumRecord EnumTable[] = { - { GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", INT, 1 }, - { GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", INT, 1 }, - { GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", INT, 1 }, - { GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", INT, 1 }, - { GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", FLOAT, 4 }, - { GL_ALPHA_BIAS, "GL_ALPHA_BIAS", FLOAT, 1 }, - { GL_ALPHA_BITS, "GL_ALPHA_BITS", INT, 1 }, - { GL_ALPHA_SCALE, "GL_ALPHA_SCALE", FLOAT, 1 }, - { GL_ALPHA_TEST, "GL_ALPHA_TEST", BOOLEAN, 1 }, - { GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", ENUM, 1 }, - { GL_ALWAYS, "GL_ALWAYS", ENUM, 0 }, - { GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", FLOAT, 1 }, - { GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", INT, 1 }, - { GL_AUTO_NORMAL, "GL_AUTO_NORMAL", BOOLEAN, 1 }, - { GL_AUX_BUFFERS, "GL_AUX_BUFFERS", INT, 1 }, - { GL_BLEND, "GL_BLEND", BOOLEAN, 1 }, - { GL_BLEND_DST, "GL_BLEND_DST", ENUM, 1 }, - { GL_BLEND_SRC, "GL_BLEND_SRC", ENUM, 1 }, - { GL_BLUE_BIAS, "GL_BLUE_BIAS", FLOAT, 1 }, - { GL_BLUE_BITS, "GL_BLUE_BITS", INT, 1 }, - { GL_BLUE_SCALE, "GL_BLUE_SCALE", FLOAT, 1 }, - - { GL_CLAMP_TO_EDGE, "GL_CLAMP_TO_EDGE", ENUM, 0 }, - { GL_CLEAR, "GL_CLEAR", ENUM, 0 }, - { GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", INT, 1 }, - { GL_CLIP_PLANE0, "GL_CLIP_PLANE0", BOOLEAN, 1 }, - { GL_CLIP_PLANE1, "GL_CLIP_PLANE1", BOOLEAN, 1 }, - { GL_CLIP_PLANE2, "GL_CLIP_PLANE2", BOOLEAN, 1 }, - { GL_CLIP_PLANE3, "GL_CLIP_PLANE3", BOOLEAN, 1 }, - { GL_CLIP_PLANE4, "GL_CLIP_PLANE4", BOOLEAN, 1 }, - { GL_CLIP_PLANE5, "GL_CLIP_PLANE5", BOOLEAN, 1 }, - { GL_COEFF, "GL_COEEF", ENUM, 0 }, - { GL_COLOR, "GL_COLOR", ENUM, 0 }, - { GL_COLOR_BUFFER_BIT, "GL_COLOR_BUFFER_BIT", ENUM, 0 }, - { GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", FLOAT, 4 }, - { GL_COLOR_INDEX, "GL_COLOR_INDEX", ENUM, 0 }, - { GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", BOOLEAN, 1 }, - { GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", ENUM, 1 }, - { GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", ENUM, 1 }, - { GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", BOOLEAN, 4 }, - { GL_COMPILE, "GL_COMPILE", ENUM, 0 }, - { GL_COMPILE_AND_EXECUTE, "GL_COMPILE_AND_EXECUTE", ENUM, 0 }, - { GL_COPY, "GL_COPY", ENUM, 0 }, - { GL_COPY_INVERTED, "GL_COPY_INVERTED", ENUM, 0 }, - { GL_COPY_PIXEL_TOKEN, "GL_COPY_PIXEL_TOKEN", ENUM, 0 }, - { GL_CULL_FACE, "GL_CULL_FACE", BOOLEAN, 1 }, - { GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", ENUM, 1 }, - { GL_CURRENT_BIT, "GL_CURRENT_BIT", ENUM, 0 }, - { GL_CURRENT_COLOR, "GL_CURRENT_COLOR", FLOAT, 4 }, - { GL_CURRENT_INDEX, "GL_CURRENT_INDEX", INT, 1 }, - { GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", FLOAT, 3 }, - { GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", FLOAT, 4 }, - { GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", FLOAT, 1 }, - { GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", INT, 1 }, - { GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", FLOAT, 4 }, - { GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", FLOAT, 4 }, - { GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", BOOLEAN, 1 }, - { GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", FLOAT, 4 }, - { GL_CW, "GL_CW", ENUM, 0 }, - { GL_CCW, "GL_CCW", ENUM, 0 }, - - { GL_DECAL, "GL_DECAL", ENUM, 0 }, - { GL_DECR, "GL_DECR", ENUM, 0 }, - { GL_DEPTH, "GL_DEPTH", ENUM, 0 }, - { GL_DEPTH_BIAS, "GL_DEPTH_BIAS", FLOAT, 1 }, - { GL_DEPTH_BITS, "GL_DEPTH_BITS", INT, 1 }, - { GL_DEPTH_BUFFER_BIT, "GL_DEPTH_BUFFER_BIT", ENUM, 0 }, - { GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", FLOAT, 1 }, - { GL_DEPTH_COMPONENT, "GL_DEPTH_COMPONENT", ENUM, 0 }, - { GL_DEPTH_FUNC, "GL_DEPTH_FUNC", ENUM, 1 }, - { GL_DEPTH_RANGE, "GL_DEPTH_RANGE", FLOAT, 2 }, - { GL_DEPTH_SCALE, "GL_DEPTH_SCALE", FLOAT, 1 }, - { GL_DEPTH_TEST, "GL_DEPTH_TEST", ENUM, 1 }, - { GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", BOOLEAN, 1 }, - { GL_DIFFUSE, "GL_DIFFUSE", ENUM, 0 }, /*XXX*/ - { GL_DITHER, "GL_DITHER", BOOLEAN, 1 }, - { GL_DOMAIN, "GL_DOMAIN", ENUM, 0 }, - { GL_DONT_CARE, "GL_DONT_CARE", ENUM, 0 }, - { GL_DOUBLE, "GL_DOUBLE", ENUM, 0 }, - { GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", BOOLEAN, 1}, - { GL_DRAW_BUFFER, "GL_DRAW_BUFFER", ENUM, 1 }, - { GL_DRAW_PIXEL_TOKEN, "GL_DRAW_PIXEL_TOKEN", ENUM, 0 }, - { GL_DST_ALPHA, "GL_DST_ALPHA", ENUM, 0 }, - { GL_DST_COLOR, "GL_DST_COLOR", ENUM, 0 }, - - { GL_EDGE_FLAG, "GL_EDGE_FLAG", BOOLEAN, 1 }, - /* XXX GL_EDGE_FLAG_ARRAY_* */ - { GL_EMISSION, "GL_EMISSION", ENUM, 0 }, /* XXX */ - { GL_ENABLE_BIT, "GL_ENABLE_BIT", ENUM, 0 }, - { GL_EQUAL, "GL_EQUAL", ENUM, 0 }, - { GL_EQUIV, "GL_EQUIV", ENUM, 0 }, - { GL_EVAL_BIT, "GL_EVAL_BIT", ENUM, 0 }, - { GL_EXP, "GL_EXP", ENUM, 0 }, - { GL_EXP2, "GL_EXP2", ENUM, 0 }, - { GL_EXTENSIONS, "GL_EXTENSIONS", ENUM, 0 }, - { GL_EYE_LINEAR, "GL_EYE_LINEAR", ENUM, 0 }, - { GL_EYE_PLANE, "GL_EYE_PLANE", ENUM, 0 }, - - { GL_FALSE, "GL_FALSE", ENUM, 0 }, - { GL_FASTEST, "GL_FASTEST", ENUM, 0 }, - { GL_FEEDBACK, "GL_FEEDBACK", ENUM, 0 }, - { GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", VOID, 0 }, - { GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", INT, 1 }, - { GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", INT, 1 }, - { GL_FILL, "GL_FILL", ENUM, 0 }, - { GL_FLAT, "GL_FLAT", ENUM, 0 }, - { GL_FLOAT, "GL_FLOAT", ENUM, 0 }, - { GL_FOG, "GL_FOG", BOOLEAN, 1 }, - { GL_FOG_BIT, "GL_FOG_BIT", ENUM, 0 }, - { GL_FOG_COLOR, "GL_FOG_COLOR", FLOAT, 4 }, - { GL_FOG_DENSITY, "GL_FOG_DENSITY", FLOAT, 1 }, - { GL_FOG_END, "GL_FOG_END", FLOAT, 1 }, - { GL_FOG_HINT, "GL_FOG_HINT", ENUM, 1 }, - { GL_FOG_INDEX, "GL_FOG_INDEX", INT, 1 }, - { GL_FOG_MODE, "GL_FOG_MODE", ENUM, 1 }, - { GL_FOG_START, "GL_FOG_START", FLOAT, 1 }, - { GL_FRONT, "GL_FRONT", ENUM, 0 }, - { GL_FRONT_AND_BACK, "GL_FRONT_AND_BACK", ENUM, 0 }, - { GL_FRONT_FACE, "GL_FRONT_FACE", ENUM, 1 }, - { GL_FRONT_LEFT, "GL_FRONT_LEFT", ENUM, 0 }, - { GL_FRONT_RIGHT, "GL_FRONT_RIGHT", ENUM, 0 }, - - { GL_GEQUAL, "GL_GEQUAL", ENUM, 0 }, - { GL_GREATER, "GL_GREATER", ENUM, 0 }, - { GL_GREEN, "GL_GREEN", ENUM, 0 }, - { GL_GREEN_BIAS, "GL_GREEN_BIAS", FLOAT, 1 }, - { GL_GREEN_BITS, "GL_GREEN_BITS", INT, 1 }, - { GL_GREEN_SCALE, "GL_GREEN_SCALE", FLOAT, 1 }, - - - - { GL_LESS, "GL_LESS", ENUM, 0 }, - { GL_LEQUAL, "GL_LEQUAL", ENUM, 0 }, - { GL_LIGHTING, "GL_LIGHTING", BOOLEAN, 1 }, - { GL_LINE_SMOOTH, "GL_LINE_SMOOTH", BOOLEAN, 1 }, - { GL_LINE_STIPPLE, "GL_LINE_STIPPLE", BOOLEAN, 1 }, - { GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", INT, 1 }, - { GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", INT, 1 }, - { GL_LINE_WIDTH, "GL_LINE_WIDTH", FLOAT, 1 }, - - { GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", DOUBLE, 16 }, - - { GL_NEVER, "GL_NEVER", ENUM, 0 }, - { GL_NOTEQUAL, "GL_NOTEQUAL", ENUM, 0 }, - - { GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", FLOAT, 16 }, - - { GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", INT, 1 }, - { GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", INT, 1 }, - { GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", INT, 1 }, - { GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", INT, 1 }, - { GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", INT, 1 }, - { GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", INT, 1 }, - - { GL_TRUE, "GL_TRUE", ENUM, 0 }, - - { GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", INT, 1 }, - { GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", INT, 1 }, - { GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", INT, 1 }, - { GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", INT, 1 }, - { GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", INT, 1 }, - { GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", INT, 1 }, - - { GL_VIEWPORT, "GL_VIEWPORT", INT, 4 }, - - - /* - * Extensions - */ - -#if defined(GL_EXT_blend_minmax) - { GL_BLEND_EQUATION_EXT, "GL_BLEND_EQUATION_EXT", ENUM, 1 }, -#endif -#if defined(GL_EXT_blend_color) - { GL_BLEND_COLOR_EXT, "GL_BLEND_COLOR_EXT", FLOAT, 4 }, -#endif -#if defined(GL_EXT_point_parameters) - { GL_DISTANCE_ATTENUATION_EXT, "GL_DISTANCE_ATTENUATION_EXT", FLOAT, 1 }, -#endif -#if defined(GL_INGR_blend_func_separate) - { GL_BLEND_SRC_RGB_INGR, "GL_BLEND_SRC_RGB_INGR", ENUM, 1 }, - { GL_BLEND_DST_RGB_INGR, "GL_BLEND_DST_RGB_INGR", ENUM, 1 }, - { GL_BLEND_SRC_ALPHA_INGR, "GL_BLEND_SRC_ALPHA_INGR", ENUM, 1 }, - { GL_BLEND_DST_ALPHA_INGR, "GL_BLEND_DST_ALPHA_INGR", ENUM, 1 }, -#endif - - - { LAST_TOKEN, "", 0, 0 } -}; - - -static const struct EnumRecord *FindRecord( GLenum var ) -{ - int i; - for (i = 0; EnumTable[i].enumerator != LAST_TOKEN; i++) { - if (EnumTable[i].enumerator == var) { - return &EnumTable[i]; - } - } - return NULL; -} - - - -/* - * Return the string label for the given enum. - */ -const char *GetEnumString( GLenum var ) -{ - const struct EnumRecord *rec = FindRecord(var); - if (rec) - return rec->string; - else - return NULL; -} - - - -/* - * Print current value of the given state variable. - */ -void PrintState( int indent, GLenum var ) -{ - const struct EnumRecord *rec = FindRecord(var); - - while (indent-- > 0) - putchar(' '); - - if (rec) { - if (rec->getCount <= 0) { - assert(rec->getType == ENUM); - printf("%s is not a state variable\n", rec->string); - } - else { - switch (rec->getType) { - case INT: - { - GLint values[100]; - int i; - glGetIntegerv(rec->enumerator, values); - printf("%s = ", rec->string); - for (i = 0; i < rec->getCount; i++) - printf("%d ", values[i]); - printf("\n"); - } - break; - case FLOAT: - { - GLfloat values[100]; - int i; - glGetFloatv(rec->enumerator, values); - printf("%s = ", rec->string); - for (i = 0; i < rec->getCount; i++) - printf("%f ", values[i]); - printf("\n"); - } - break; - case DOUBLE: - { - GLdouble values[100]; - int i; - glGetDoublev(rec->enumerator, values); - printf("%s = ", rec->string); - for (i = 0; i < rec->getCount; i++) - printf("%f ", (float) values[i]); - printf("\n"); - } - break; - case BOOLEAN: - { - GLboolean values[100]; - int i; - glGetBooleanv(rec->enumerator, values); - printf("%s = ", rec->string); - for (i = 0; i < rec->getCount; i++) - printf("%s ", values[i] ? "GL_TRUE" : "GL_FALSE"); - printf("\n"); - } - break; - case ENUM: - { - GLint values[100]; - int i; - glGetIntegerv(rec->enumerator, values); - printf("%s = ", rec->string); - for (i = 0; i < rec->getCount; i++) { - const char *str = GetEnumString((GLenum) values[i]); - if (str) - printf("%s ", str); - else - printf("??? "); - } - printf("\n"); - } - break; - case VOID: - { - GLvoid *values[100]; - int i; - glGetPointerv(rec->enumerator, values); - printf("%s = ", rec->string); - for (i = 0; i < rec->getCount; i++) { - printf("%p ", values[i]); - } - printf("\n"); - } - break; - default: - printf("fatal error in PrintState()\n"); - abort(); - } - } - } - else { - printf("Unknown GLenum passed to PrintState()\n"); - } -} - - - -/* - * Print all glPixelStore-related state. - * NOTE: Should write similar functions for lighting, texturing, etc. - */ -void PrintPixelStoreState( void ) -{ - const GLenum enums[] = { - GL_PACK_SWAP_BYTES, - GL_PACK_LSB_FIRST, - GL_PACK_ROW_LENGTH, - GL_PACK_SKIP_PIXELS, - GL_PACK_SKIP_ROWS, - GL_PACK_ALIGNMENT, - GL_UNPACK_SWAP_BYTES, - GL_UNPACK_LSB_FIRST, - GL_UNPACK_ROW_LENGTH, - GL_UNPACK_SKIP_PIXELS, - GL_UNPACK_SKIP_ROWS, - GL_UNPACK_ALIGNMENT, - 0 - }; - int i; - printf("Pixel pack/unpack state:\n"); - for (i = 0; enums[i]; i++) { - PrintState(3, enums[i]); - } -} - - - - -/* - * Print all state for the given attribute group. - */ -void PrintAttribState( GLbitfield attrib ) -{ - static const GLenum depth_buffer_enums[] = { - GL_DEPTH_FUNC, - GL_DEPTH_CLEAR_VALUE, - GL_DEPTH_TEST, - GL_DEPTH_WRITEMASK, - 0 - }; - static const GLenum fog_enums[] = { - GL_FOG, - GL_FOG_COLOR, - GL_FOG_DENSITY, - GL_FOG_START, - GL_FOG_END, - GL_FOG_INDEX, - GL_FOG_MODE, - 0 - }; - static const GLenum line_enums[] = { - GL_LINE_SMOOTH, - GL_LINE_STIPPLE, - GL_LINE_STIPPLE_PATTERN, - GL_LINE_STIPPLE_REPEAT, - GL_LINE_WIDTH, - 0 - }; - - const GLenum *enumList = NULL; - - switch (attrib) { - case GL_DEPTH_BUFFER_BIT: - enumList = depth_buffer_enums; - printf("GL_DEPTH_BUFFER_BIT state:\n"); - break; - case GL_FOG_BIT: - enumList = fog_enums; - printf("GL_FOG_BIT state:\n"); - break; - case GL_LINE_BIT: - enumList = line_enums; - printf("GL_LINE_BIT state:\n"); - break; - default: - printf("Bad value in PrintAttribState()\n"); - } - - if (enumList) { - int i; - for (i = 0; enumList[i]; i++) - PrintState(3, enumList[i]); - } -} - - -/*#define TEST*/ -#ifdef TEST - -#include <GL/glut.h> - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 300); - glutInitDisplayMode(GLUT_RGB); - glutCreateWindow(argv[0]); - PrintAttribState(GL_DEPTH_BUFFER_BIT); - PrintAttribState(GL_FOG_BIT); - PrintAttribState(GL_LINE_BIT); - PrintState(0, GL_ALPHA_BITS); - PrintState(0, GL_VIEWPORT); - PrintState(0, GL_ALPHA_TEST_FUNC); - PrintState(0, GL_MODELVIEW_MATRIX); - PrintState(0, GL_ALWAYS); - PrintPixelStoreState(); - return 0; -} - -#endif diff --git a/progs/util/glstate.h b/progs/util/glstate.h deleted file mode 100644 index 9216382b7b..0000000000 --- a/progs/util/glstate.h +++ /dev/null @@ -1,51 +0,0 @@ - -/* - * Print GL state information (for debugging) - * Copyright (C) 1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * Revision 1.1 1999/08/19 00:55:42 jtg - * Initial revision - * - * Revision 1.2 1999/06/19 01:36:43 brianp - * more features added - * - * Revision 1.1 1998/11/24 03:41:16 brianp - * Initial revision - * - */ - - -#ifndef GLSTATE_H -#define GLSTATE_H - - -#include <GL/gl.h> - - -extern const char *GetNameString( GLenum var ); - -extern void PrintState( int indent, GLenum var ); - -extern void PrintAttribState( GLbitfield attrib ); - -extern void PrintPixelStoreState( void ); - - -#endif diff --git a/progs/util/glutskel.c b/progs/util/glutskel.c deleted file mode 100644 index 8499e12a9d..0000000000 --- a/progs/util/glutskel.c +++ /dev/null @@ -1,141 +0,0 @@ -/** - * A skeleton/template GLUT program - * - * Written by Brian Paul and in the public domain. - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glut.h> - -static int Win; -static int WinWidth = 400, WinHeight = 400; -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLboolean Anim = GL_FALSE; - - -static void -Idle(void) -{ - Xrot += 3.0; - Yrot += 4.0; - Zrot += 2.0; - glutPostRedisplay(); -} - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glutSolidCube(2.0); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - WinWidth = width; - WinHeight = height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - /* setup lighting, etc */ - glEnable(GL_DEPTH_TEST); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowSize(WinWidth, WinHeight); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/util/idproj.c b/progs/util/idproj.c deleted file mode 100644 index d5ee3409f3..0000000000 --- a/progs/util/idproj.c +++ /dev/null @@ -1,26 +0,0 @@ -/* idproj.c */ - - -/* - * Setup an identity projection such that glVertex(x,y) maps to - * window coordinate (x,y). - * - * Written by Brian Paul and in the public domain. - */ - - - - - -void IdentityProjection( GLint x, GLint y, GLsizei width, GLsizei height ) -{ - glViewport( x, y, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho( (GLdouble) x, (GLdouble) y, - (GLdouble) width, (GLdouble) height, - -1.0, 1.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - diff --git a/progs/util/imagesgi.cpp b/progs/util/imagesgi.cpp deleted file mode 100644 index f5128aabec..0000000000 --- a/progs/util/imagesgi.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/****************************************************************************** -** Filename : imageSgi.cpp -** UNCLASSIFIED -** -** Description : Utility to read SGI image format files. This code was -** originally a SGI image loading utility provided with the -** Mesa 3D library @ http://www.mesa3d.org by Brain Paul. -** This has been extended to read all SGI image formats -** (e.g. INT, INTA, RGB, RGBA). -** -** Revision History: -** Date Name Description -** 06/07/99 BRC Initial Release -** -** Note: -** -** The SGI Image Data (if not RLE) -** -** If the image is stored verbatim (without RLE), then image data directly -** follows the 512 byte header. The data for each scanline of the first -** channel is written first. If the image has more than 1 channel, all -** the data for the first channel is written, followed by the remaining -** channels. If the BPC value is 1, then each scanline is written as XSIZE -** bytes. If the BPC value is 2, then each scanline is written as XSIZE -** shorts. These shorts are stored in the byte order described above. -** -******************************************************************************/ -#define __IMAGESGI_CPP - -#include "imagesgi.h" - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <math.h> -#include <assert.h> - -struct sImageSgiRaw -{ - struct sImageSgiHeader header; - unsigned char *chan0; - unsigned char *chan1; - unsigned char *chan2; - unsigned char *chan3; - unsigned int *rowStart; - int *rowSize; -}; - -// Static routines -static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName); -static void ImageSgiRawClose(struct sImageSgiRaw *raw); -static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf, - int y, int z); -static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi -*final); -static void *SwitchEndian16(void *value); -static void *SwitchEndian32(void *value); - -// Static variables -FILE *mFp = NULL; -unsigned char *mChanTmp = NULL; - - -/*****************************************************************************/ -struct sImageSgi *ImageSgiOpen(char const * const fileName) -{ - struct sImageSgiRaw *raw = NULL; - struct sImageSgi *final = NULL; - - raw = ImageSgiRawOpen(fileName); - final = new struct sImageSgi; - - assert(final); - if(final) - { - final->header = raw->header; - final->data = NULL; - ImageSgiRawGetData(raw, final); - ImageSgiRawClose(raw); - } - - return final; -} // ImageSgiRawOpen - - -/*****************************************************************************/ -void ImageSgiClose(struct sImageSgi *image) -{ - - if(image) - { - if(image->data) - delete[] image->data; - image->data = NULL; - delete image; - } - image = NULL; - - return; -} // ImageSgiClose - - -/*****************************************************************************/ -static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName) -{ - struct sImageSgiRaw *raw = NULL; - int x; - int i; - bool swapFlag = false; - union - { - int testWord; - char testByte[4]; - } endianTest; - endianTest.testWord = 1; - - // Determine endianess of platform. - if(endianTest.testByte[0] == 1) - swapFlag = true; - else - swapFlag = false; - - raw = new struct sImageSgiRaw; - - assert(raw); - if(raw) - { - raw->chan0 = NULL; - raw->chan1 = NULL; - raw->chan2 = NULL; - raw->chan3 = NULL; - raw->rowStart = NULL; - raw->rowSize = NULL; - mFp = fopen(fileName, "rb"); - assert(mFp); - - fread(&raw->header, sizeof(struct sImageSgiHeader), 1, mFp); - if(swapFlag == true) - { - SwitchEndian16(&raw->header.magic); - SwitchEndian16(&raw->header.type); - SwitchEndian16(&raw->header.dim); - SwitchEndian16(&raw->header.xsize); - SwitchEndian16(&raw->header.ysize); - SwitchEndian16(&raw->header.zsize); - } - - mChanTmp = new unsigned char[raw->header.xsize * raw->header.ysize]; - assert(mChanTmp); - switch(raw->header.zsize) - { - case 4: - raw->chan3 = new unsigned char[raw->header.xsize * -raw->header.ysize]; - assert(raw->chan3); - case 3: - raw->chan2 = new unsigned char[raw->header.xsize * -raw->header.ysize]; - assert(raw->chan2); - case 2: - raw->chan1 = new unsigned char[raw->header.xsize * -raw->header.ysize]; - assert(raw->chan1); - case 1: - raw->chan0 = new unsigned char[raw->header.xsize * -raw->header.ysize]; - assert(raw->chan0); - } - - if(raw->header.type == IMAGE_SGI_TYPE_RLE) - { - x = raw->header.ysize * raw->header.zsize * sizeof(unsigned int); - raw->rowStart = new unsigned int[x]; - raw->rowSize = new int[x]; - - fseek(mFp, sizeof(struct sImageSgiHeader), SEEK_SET); - fread(raw->rowStart, 1, x, mFp); - fread(raw->rowSize, 1, x, mFp); - - if(swapFlag == true) - { - for(i=0; i<x/sizeof(unsigned int); i++) - SwitchEndian32(&raw->rowStart[i]); - for(i=0; i<x/sizeof(int); i++) - SwitchEndian32(&raw->rowSize[i]); - } - - } - - } - - return raw; -} // ImageSgiRawOpen - - -/*****************************************************************************/ -static void ImageSgiRawClose(struct sImageSgiRaw *raw) -{ - - fclose(mFp); - mFp = NULL; - - if(mChanTmp) - delete[] mChanTmp; - mChanTmp = NULL; - - if(raw->chan0) - delete[] raw->chan0; - raw->chan0 = NULL; - - if(raw->chan1) - delete[] raw->chan1; - raw->chan1 = NULL; - - if(raw->chan2) - delete[] raw->chan2; - raw->chan2 = NULL; - - if(raw->chan3) - delete[] raw->chan3; - raw->chan3 = NULL; - - if(raw) - delete raw; - raw = NULL; - - return; -} // ImageSgiRawClose - - -/*****************************************************************************/ -static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf, - int y, int z) -{ - unsigned char *iPtr = NULL; - unsigned char *oPtr = NULL; - unsigned char pixel; - int count; - - if((raw->header.type & 0xFF00) == 0x0100) - { - fseek(mFp, raw->rowStart[y+z*raw->header.ysize], SEEK_SET); - fread(mChanTmp, 1, (unsigned int)raw->rowSize[y+z*raw->header.ysize], -mFp); - iPtr = mChanTmp; - oPtr = buf; - while(1) - { - pixel = *iPtr++; - count = (int)(pixel & 0x7F); - if(!count) - { - return; - } - if (pixel & 0x80) - { - while (count--) - { - *oPtr++ = *iPtr++; - } - } - else - { - pixel = *iPtr++; - while (count--) - { - *oPtr++ = pixel; - } - } - } - } - else - { - fseek(mFp, - sizeof(struct sImageSgiHeader)+(y*raw->header.xsize) + - (z*raw->header.xsize*raw->header.ysize), - SEEK_SET); - fread(buf, 1, raw->header.xsize, mFp); - } - - return; -} // ImageSgiRawGetRow - - -/*****************************************************************************/ -static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi -*final) -{ - unsigned char *ptr = NULL; - int i, j; - - final->data = - new unsigned -char[raw->header.xsize*raw->header.ysize*raw->header.zsize]; - assert(final->data); - - ptr = final->data; - for(i=0; i<raw->header.ysize; i++) - { - switch(raw->header.zsize) - { - case 1: - ImageSgiRawGetRow(raw, raw->chan0, i, 0); - for(j=0; j<raw->header.xsize; j++) - *(ptr++) = raw->chan0[j]; - break; - case 2: - ImageSgiRawGetRow(raw, raw->chan0, i, 0); - ImageSgiRawGetRow(raw, raw->chan1, i, 1); - for(j=0; j<raw->header.xsize; j++) - { - *(ptr++) = raw->chan0[j]; - *(ptr++) = raw->chan1[j]; - } - break; - case 3: - ImageSgiRawGetRow(raw, raw->chan0, i, 0); - ImageSgiRawGetRow(raw, raw->chan1, i, 1); - ImageSgiRawGetRow(raw, raw->chan2, i, 2); - for(j=0; j<raw->header.xsize; j++) - { - *(ptr++) = raw->chan0[j]; - *(ptr++) = raw->chan1[j]; - *(ptr++) = raw->chan2[j]; - } - break; - case 4: - ImageSgiRawGetRow(raw, raw->chan0, i, 0); - ImageSgiRawGetRow(raw, raw->chan1, i, 1); - ImageSgiRawGetRow(raw, raw->chan2, i, 2); - ImageSgiRawGetRow(raw, raw->chan3, i, 3); - for(j=0; j<raw->header.xsize; j++) - { - *(ptr++) = raw->chan0[j]; - *(ptr++) = raw->chan1[j]; - *(ptr++) = raw->chan2[j]; - *(ptr++) = raw->chan3[j]; - } - break; - } - } - - return; -} // ImageSgiRawGetData - - -/*****************************************************************************/ -static void *SwitchEndian16(void *value) -{ - short value16 = *(short *) value; - value16 = ((value16 & 0xff00) >> 8L) + - ((value16 & 0x00ff) << 8L); - *(short *)value = value16; - return value; -} // SwitchEndian16 - - -/*****************************************************************************/ -static void *SwitchEndian32(void *value) -{ - int value32 = *(int *) value; - value32 = ((value32 & 0xff000000) >> 24L) + - ((value32 & 0x00ff0000) >> 8) + - ((value32 & 0x0000ff00) << 8) + - ((value32 & 0x000000ff) << 24L); - *(int *)value = value32; - return value; -} // SwitchEndian32 - diff --git a/progs/util/imagesgi.h b/progs/util/imagesgi.h deleted file mode 100644 index e5ecece49d..0000000000 --- a/progs/util/imagesgi.h +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************** -** Filename : imageSgi.h -** UNCLASSIFIED -** -** Description : Utility to read SGI image format files. This code was -** originally a SGI image loading utility provided with the -** Mesa 3D library @ http://www.mesa3d.org by Brain Paul. -** This has been extended to read all SGI image formats -** (e.g. INT, INTA, RGB, RGBA). -** -** Revision History: -** Date Name Description -** 06/08/99 BRC Initial Release -** -******************************************************************************/ - -#ifndef __IMAGESGI_H -#define __IMAGESGI_H - -#define IMAGE_SGI_TYPE_VERBATIM 0 -#define IMAGE_SGI_TYPE_RLE 1 - -struct sImageSgiHeader // 512 bytes -{ - short magic; // IRIS image file magic number (474) - char type; // Storage format (e.g. RLE or VERBATIM) - char numBytesPerPixelChannel; // Number of bytes per pixel channel - unsigned short dim; // Number of dimensions (1 to 3) - unsigned short xsize; // Width (in pixels) - unsigned short ysize; // Height (in pixels) - unsigned short zsize; // Number of channels (1 to 4) - int minimumPixelValue; // Minimum pixel value (0 to 255) - int maximumPixelValue; // Maximum pixel value (0 to 255) - char padding1[4]; // (ignored) - char imageName[80]; // Image name - int colormap; // colormap ID (0=normal, 0=dithered, - // 2=screen, 3=colormap) - char padding2[404]; // (ignored) -}; - -struct sImageSgi -{ - struct sImageSgiHeader header; - unsigned char *data; -}; - -#ifndef __IMAGESGI_CPP - -// RGB image load utility -extern struct sImageSgi *ImageSgiOpen(char const * const fileName); -extern void ImageSgiClose(struct sImageSgi *image); - -#endif - -#endif /* __IMAGESGI_H */ diff --git a/progs/util/matrix.c b/progs/util/matrix.c deleted file mode 100644 index 8be2c3111f..0000000000 --- a/progs/util/matrix.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * matrix.c - * - * Some useful matrix functions. - * - * Brian Paul - * 10 Feb 2004 - */ - - - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - - -/** - * Pretty-print the given matrix. - */ -void -PrintMatrix(const float p[16]) -{ - printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[0], p[4], p[8], p[12]); - printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[1], p[5], p[9], p[13]); - printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[2], p[6], p[10], p[14]); - printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[3], p[7], p[11], p[15]); -} - - -/** - * Build a glFrustum matrix. - */ -void -Frustum(float left, float right, float bottom, float top, float nearZ, float farZ, float *m) -{ - float x = (2.0F*nearZ) / (right-left); - float y = (2.0F*nearZ) / (top-bottom); - float a = (right+left) / (right-left); - float b = (top+bottom) / (top-bottom); - float c = -(farZ+nearZ) / ( farZ-nearZ); - float d = -(2.0F*farZ*nearZ) / (farZ-nearZ); - -#define M(row,col) m[col*4+row] - M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; - M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; - M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; - M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; -#undef M -} - - -/** - * Build a glOrtho marix. - */ -void -Ortho(float left, float right, float bottom, float top, float nearZ, float farZ, float *m) -{ -#define M(row,col) m[col*4+row] - M(0,0) = 2.0F / (right-left); - M(0,1) = 0.0F; - M(0,2) = 0.0F; - M(0,3) = -(right+left) / (right-left); - - M(1,0) = 0.0F; - M(1,1) = 2.0F / (top-bottom); - M(1,2) = 0.0F; - M(1,3) = -(top+bottom) / (top-bottom); - - M(2,0) = 0.0F; - M(2,1) = 0.0F; - M(2,2) = -2.0F / (farZ-nearZ); - M(2,3) = -(farZ+nearZ) / (farZ-nearZ); - - M(3,0) = 0.0F; - M(3,1) = 0.0F; - M(3,2) = 0.0F; - M(3,3) = 1.0F; -#undef M -} - - -/** - * Decompose a projection matrix to determine original glFrustum or - * glOrtho parameters. - */ -void -DecomposeProjection( const float *m, - int *isPerspective, - float *leftOut, float *rightOut, - float *botOut, float *topOut, - float *nearOut, float *farOut) -{ - if (m[15] == 0.0) { - /* perspective */ - float p[16]; - const float x = m[0]; /* 2N / (R-L) */ - const float y = m[5]; /* 2N / (T-B) */ - const float a = m[8]; /* (R+L) / (R-L) */ - const float b = m[9]; /* (T+B) / (T-B) */ - const float c = m[10]; /* -(F+N) / (F-N) */ - const float d = m[14]; /* -2FN / (F-N) */ - - /* These equations found with simple algebra, knowing the arithmetic - * use to set up a typical perspective projection matrix in OpenGL. - */ - const float nearZ = -d / (1.0 - c); - const float farZ = (c - 1.0) * nearZ / (c + 1.0); - const float left = nearZ * (a - 1.0) / x; - const float right = 2.0 * nearZ / x + left; - const float bottom = nearZ * (b - 1.0) / y; - const float top = 2.0 * nearZ / y + bottom; - - *isPerspective = 1; - *leftOut = left; - *rightOut = right; - *botOut = bottom; - *topOut = top; - *nearOut = nearZ; - *farOut = farZ; - } - else { - /* orthographic */ - const float x = m[0]; /* 2 / (R-L) */ - const float y = m[5]; /* 2 / (T-B) */ - const float z = m[10]; /* -2 / (F-N) */ - const float a = m[12]; /* -(R+L) / (R-L) */ - const float b = m[13]; /* -(T+B) / (T-B) */ - const float c = m[14]; /* -(F+N) / (F-N) */ - /* again, simple algebra */ - const float right = -(a - 1.0) / x; - const float left = right - 2.0 / x; - const float top = -(b - 1.0) / y; - const float bottom = top - 2.0 / y; - const float farZ = (c - 1.0) / z; - const float nearZ = farZ + 2.0 / z; - - *isPerspective = 0; - *leftOut = left; - *rightOut = right; - *botOut = bottom; - *topOut = top; - *nearOut = nearZ; - *farOut = farZ; - } -} - - -#if 0 -/* test harness */ -int -main(int argc, char *argv[]) -{ - float m[16], p[16]; - float l, r, b, t, n, f; - int persp; - int i; - -#if 0 - l = -.9; - r = 1.2; - b = -0.5; - t = 1.4; - n = 30; - f = 84; - printf(" Frustum(%f, %f, %f, %f, %f, %f\n",l+1, r+1.2, b+.5, t+.3, n, f); - Frustum(l+1, r+1.2, b+.5, t+.3, n, f, p); - DecomposeProjection(p, &persp, &l, &r, &b, &t, &n, &f); - printf("glFrustum(%f, %f, %f, %f, %f, %f)\n", - l, r, b, t, n, f); - PrintMatrix(p); -#else - printf("Ortho(-1, 1, -1, 1, 10, 84)\n"); - Ortho(-1, 1, -1, 1, 10, 84, m); - PrintMatrix(m); - DecomposeProjection(m, &persp, &l, &r, &b, &t, &n, &f); - printf("Ortho(%f, %f, %f, %f, %f, %f) %d\n", l, r, b, t, n, f, persp); -#endif - - return 0; -} -#endif diff --git a/progs/util/mwmborder.c b/progs/util/mwmborder.c deleted file mode 100644 index b61ffb50bc..0000000000 --- a/progs/util/mwmborder.c +++ /dev/null @@ -1,91 +0,0 @@ -/* mwmborder.c */ - - -/* - * This function shows how to remove the border, title bar, resize button, - * etc from a Motif window frame from inside an Xlib-based application. - * - * Brian Paul 19 Sep 1995 brianp@ssec.wisc.edu - * - * This code is in the public domain. - */ - - -#include <X11/Xlib.h> -#include <X11/Xatom.h> - -#define HAVE_MOTIF -#ifdef HAVE_MOTIF - -#include <X11/Xm/MwmUtil.h> - -#else - -/* bit definitions for MwmHints.flags */ -#define MWM_HINTS_FUNCTIONS (1L << 0) -#define MWM_HINTS_DECORATIONS (1L << 1) -#define MWM_HINTS_INPUT_MODE (1L << 2) -#define MWM_HINTS_STATUS (1L << 3) - -/* bit definitions for MwmHints.decorations */ -#define MWM_DECOR_ALL (1L << 0) -#define MWM_DECOR_BORDER (1L << 1) -#define MWM_DECOR_RESIZEH (1L << 2) -#define MWM_DECOR_TITLE (1L << 3) -#define MWM_DECOR_MENU (1L << 4) -#define MWM_DECOR_MINIMIZE (1L << 5) -#define MWM_DECOR_MAXIMIZE (1L << 6) - -typedef struct -{ - unsigned long flags; - unsigned long functions; - unsigned long decorations; - long inputMode; - unsigned long status; -} PropMotifWmHints; - -#define PROP_MOTIF_WM_HINTS_ELEMENTS 5 - -#endif - - - -/* - * Specify which Motif window manager border decorations to put on a - * top-level window. For example, you can specify that a window is not - * resizabe, or omit the titlebar, or completely remove all decorations. - * Input: dpy - the X display - * w - the X window - * flags - bitwise-OR of the MWM_DECOR_xxx symbols in X11/Xm/MwmUtil.h - * indicating what decoration elements to enable. Zero would - * be no decoration. - */ -void set_mwm_border( Display *dpy, Window w, unsigned long flags ) -{ - PropMotifWmHints motif_hints; - Atom prop, proptype; - - /* setup the property */ - motif_hints.flags = MWM_HINTS_DECORATIONS; - motif_hints.decorations = flags; - - /* get the atom for the property */ - prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True ); - if (!prop) { - /* something went wrong! */ - return; - } - - /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */ - proptype = prop; - - XChangeProperty( dpy, w, /* display, window */ - prop, proptype, /* property, type */ - 32, /* format: 32-bit datums */ - PropModeReplace, /* mode */ - (unsigned char *) &motif_hints, /* data */ - PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */ - ); -} - diff --git a/progs/util/readtex.c b/progs/util/readtex.c deleted file mode 100644 index f6f511481c..0000000000 --- a/progs/util/readtex.c +++ /dev/null @@ -1,495 +0,0 @@ -/* readtex.c */ - -/* - * Read an SGI .rgb image file and generate a mipmap texture set. - * Much of this code was borrowed from SGI's tk OpenGL toolkit. - */ - - - -#include <GL/gl.h> -#include <GL/glu.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "readtex.h" - - -#ifndef SEEK_SET -# define SEEK_SET 0 -#endif - - -/* -** RGB Image Structure -*/ - -typedef struct _TK_RGBImageRec { - GLint sizeX, sizeY; - GLint components; - unsigned char *data; -} TK_RGBImageRec; - - - -/******************************************************************************/ - -typedef struct _rawImageRec { - unsigned short imagic; - unsigned short type; - unsigned short dim; - unsigned short sizeX, sizeY, sizeZ; - unsigned long min, max; - unsigned long wasteBytes; - char name[80]; - unsigned long colorMap; - FILE *file; - unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA; - unsigned long rleEnd; - GLuint *rowStart; - GLint *rowSize; -} rawImageRec; - -/******************************************************************************/ - -static void ConvertShort(unsigned short *array, long length) -{ - unsigned long b1, b2; - unsigned char *ptr; - - ptr = (unsigned char *)array; - while (length--) { - b1 = *ptr++; - b2 = *ptr++; - *array++ = (unsigned short) ((b1 << 8) | (b2)); - } -} - -static void ConvertLong(GLuint *array, long length) -{ - unsigned long b1, b2, b3, b4; - unsigned char *ptr; - - ptr = (unsigned char *)array; - while (length--) { - b1 = *ptr++; - b2 = *ptr++; - b3 = *ptr++; - b4 = *ptr++; - *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); - } -} - -static rawImageRec *RawImageOpen(const char *fileName) -{ - union { - int testWord; - char testByte[4]; - } endianTest; - rawImageRec *raw; - GLenum swapFlag; - int x; - size_t result; - - endianTest.testWord = 1; - if (endianTest.testByte[0] == 1) { - swapFlag = GL_TRUE; - } else { - swapFlag = GL_FALSE; - } - - raw = (rawImageRec *)calloc(1, sizeof(rawImageRec)); - if (raw == NULL) { - fprintf(stderr, "Out of memory!\n"); - return NULL; - } - raw->file = fopen(fileName, "rb"); - if (raw->file == NULL) { - const char *baseName = strrchr(fileName, '/'); - if(baseName) - raw->file = fopen(baseName + 1, "rb"); - if(raw->file == NULL) { - perror(fileName); - free(raw); - return NULL; - } - } - - result = fread(raw, 1, 12, raw->file); - assert(result == 12); - - if (swapFlag) { - ConvertShort(&raw->imagic, 1); - ConvertShort(&raw->type, 1); - ConvertShort(&raw->dim, 1); - ConvertShort(&raw->sizeX, 1); - ConvertShort(&raw->sizeY, 1); - ConvertShort(&raw->sizeZ, 1); - } - - raw->tmp = (unsigned char *)malloc(raw->sizeX*256); - raw->tmpR = (unsigned char *)malloc(raw->sizeX*256); - raw->tmpG = (unsigned char *)malloc(raw->sizeX*256); - raw->tmpB = (unsigned char *)malloc(raw->sizeX*256); - if (raw->sizeZ==4) { - raw->tmpA = (unsigned char *)malloc(raw->sizeX*256); - } - if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || - raw->tmpB == NULL) { - fprintf(stderr, "Out of memory!\n"); - free(raw->tmp); - free(raw->tmpR); - free(raw->tmpG); - free(raw->tmpB); - free(raw->tmpA); - free(raw); - return NULL; - } - - if ((raw->type & 0xFF00) == 0x0100) { - x = raw->sizeY * raw->sizeZ * sizeof(GLuint); - raw->rowStart = (GLuint *)malloc(x); - raw->rowSize = (GLint *)malloc(x); - if (raw->rowStart == NULL || raw->rowSize == NULL) { - fprintf(stderr, "Out of memory!\n"); - free(raw->tmp); - free(raw->tmpR); - free(raw->tmpG); - free(raw->tmpB); - free(raw->tmpA); - free(raw->rowStart); - free(raw->rowSize); - free(raw); - return NULL; - } - raw->rleEnd = 512 + (2 * x); - fseek(raw->file, 512, SEEK_SET); - result = fread(raw->rowStart, 1, x, raw->file); - assert(result == x); - result = fread(raw->rowSize, 1, x, raw->file); - assert(result == x); - if (swapFlag) { - ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); - ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); - } - } - return raw; -} - -static void RawImageClose(rawImageRec *raw) -{ - fclose(raw->file); - free(raw->tmp); - free(raw->tmpR); - free(raw->tmpG); - free(raw->tmpB); - if (raw->rowStart) - free(raw->rowStart); - if (raw->rowSize) - free(raw->rowSize); - if (raw->sizeZ>3) { - free(raw->tmpA); - } - free(raw); -} - -static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) -{ - unsigned char *iPtr, *oPtr, pixel; - int count, done = 0; - size_t result; - - if ((raw->type & 0xFF00) == 0x0100) { - fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); - result = fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], - raw->file); - assert(result == (unsigned int)raw->rowSize[y+z*raw->sizeY]); - - iPtr = raw->tmp; - oPtr = buf; - while (!done) { - pixel = *iPtr++; - count = (int)(pixel & 0x7F); - if (!count) { - done = 1; - return; - } - if (pixel & 0x80) { - while (count--) { - *oPtr++ = *iPtr++; - } - } else { - pixel = *iPtr++; - while (count--) { - *oPtr++ = pixel; - } - } - } - } else { - fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), - SEEK_SET); - result = fread(buf, 1, raw->sizeX, raw->file); - assert(result == raw->sizeX); - } -} - - -static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) -{ - unsigned char *ptr; - int i, j; - - final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); - if (final->data == NULL) { - fprintf(stderr, "Out of memory!\n"); - return; - } - - ptr = final->data; - for (i = 0; i < (int)(raw->sizeY); i++) { - RawImageGetRow(raw, raw->tmpR, i, 0); - RawImageGetRow(raw, raw->tmpG, i, 1); - RawImageGetRow(raw, raw->tmpB, i, 2); - if (raw->sizeZ>3) { - RawImageGetRow(raw, raw->tmpA, i, 3); - } - for (j = 0; j < (int)(raw->sizeX); j++) { - *ptr++ = *(raw->tmpR + j); - *ptr++ = *(raw->tmpG + j); - *ptr++ = *(raw->tmpB + j); - if (raw->sizeZ>3) { - *ptr++ = *(raw->tmpA + j); - } - } - } -} - - -static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) -{ - rawImageRec *raw; - TK_RGBImageRec *final; - - raw = RawImageOpen(fileName); - if (!raw) { - fprintf(stderr, "File not found\n"); - return NULL; - } - final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); - if (final == NULL) { - fprintf(stderr, "Out of memory!\n"); - RawImageClose(raw); - return NULL; - } - final->sizeX = raw->sizeX; - final->sizeY = raw->sizeY; - final->components = raw->sizeZ; - RawImageGetData(raw, final); - RawImageClose(raw); - return final; -} - - -static void FreeImage( TK_RGBImageRec *image ) -{ - free(image->data); - free(image); -} - - -/* - * Load an SGI .rgb file and generate a set of 2-D mipmaps from it. - * Input: imageFile - name of .rgb to read - * intFormat - internal texture format to use, or number of components - * Return: GL_TRUE if success, GL_FALSE if error. - */ -GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) -{ - GLint w, h; - return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h ); -} - - - -GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, - GLint intFormat, GLint *width, GLint *height ) -{ - GLint error; - GLenum format; - TK_RGBImageRec *image; - - image = tkRGBImageLoad( imageFile ); - if (!image) { - return GL_FALSE; - } - - if (image->components==3) { - format = GL_RGB; - } - else if (image->components==4) { - format = GL_RGBA; - } - else { - /* not implemented */ - fprintf(stderr, - "Error in LoadRGBMipmaps %d-component images not implemented\n", - image->components ); - FreeImage(image); - return GL_FALSE; - } - - error = gluBuild2DMipmaps( target, - intFormat, - image->sizeX, image->sizeY, - format, - GL_UNSIGNED_BYTE, - image->data ); - - *width = image->sizeX; - *height = image->sizeY; - - FreeImage(image); - - return error ? GL_FALSE : GL_TRUE; -} - - - -/* - * Load an SGI .rgb file and return a pointer to the image data. - * Input: imageFile - name of .rgb to read - * Output: width - width of image - * height - height of image - * format - format of image (GL_RGB or GL_RGBA) - * Return: pointer to image data or NULL if error - */ -GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, - GLenum *format ) -{ - TK_RGBImageRec *image; - GLint bytes; - GLubyte *buffer; - - image = tkRGBImageLoad( imageFile ); - if (!image) { - return NULL; - } - - if (image->components==3) { - *format = GL_RGB; - } - else if (image->components==4) { - *format = GL_RGBA; - } - else { - /* not implemented */ - fprintf(stderr, - "Error in LoadRGBImage %d-component images not implemented\n", - image->components ); - FreeImage(image); - return NULL; - } - - *width = image->sizeX; - *height = image->sizeY; - - bytes = image->sizeX * image->sizeY * image->components; - buffer = (GLubyte *) malloc(bytes); - if (!buffer) { - FreeImage(image); - return NULL; - } - - memcpy( (void *) buffer, (void *) image->data, bytes ); - - FreeImage(image); - - return buffer; -} - -#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) - - -static void ConvertRGBtoYUV(GLint w, GLint h, GLint texel_bytes, - const GLubyte *src, - GLushort *dest) -{ - GLint i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const GLfloat r = (src[0]) / 255.0; - const GLfloat g = (src[1]) / 255.0; - const GLfloat b = (src[2]) / 255.0; - GLfloat y, cr, cb; - GLint iy, icr, icb; - - y = r * 65.481 + g * 128.553 + b * 24.966 + 16; - cb = r * -37.797 + g * -74.203 + b * 112.0 + 128; - cr = r * 112.0 + g * -93.786 + b * -18.214 + 128; - /*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/ - iy = (GLint) CLAMP(y, 0, 254); - icb = (GLint) CLAMP(cb, 0, 254); - icr = (GLint) CLAMP(cr, 0, 254); - - if (j & 1) { - /* odd */ - *dest = (iy << 8) | icr; - } - else { - /* even */ - *dest = (iy << 8) | icb; - } - dest++; - src += texel_bytes; - } - } -} - - -/* - * Load an SGI .rgb file and return a pointer to the image data, converted - * to 422 yuv. - * - * Input: imageFile - name of .rgb to read - * Output: width - width of image - * height - height of image - * Return: pointer to image data or NULL if error - */ -GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) -{ - TK_RGBImageRec *image; - GLushort *buffer; - - image = tkRGBImageLoad( imageFile ); - if (!image) { - return NULL; - } - - if (image->components != 3 && image->components !=4 ) { - /* not implemented */ - fprintf(stderr, - "Error in LoadYUVImage %d-component images not implemented\n", - image->components ); - FreeImage(image); - return NULL; - } - - *width = image->sizeX; - *height = image->sizeY; - - buffer = (GLushort *) malloc( image->sizeX * image->sizeY * 2 ); - - if (buffer) - ConvertRGBtoYUV( image->sizeX, - image->sizeY, - image->components, - image->data, - buffer ); - - - FreeImage(image); - return buffer; -} - diff --git a/progs/util/readtex.h b/progs/util/readtex.h deleted file mode 100644 index 6c9a3828d3..0000000000 --- a/progs/util/readtex.h +++ /dev/null @@ -1,26 +0,0 @@ -/* readtex.h */ - -#ifndef READTEX_H -#define READTEX_H - - -#include <GL/gl.h> - - -extern GLboolean -LoadRGBMipmaps( const char *imageFile, GLint intFormat ); - - -extern GLboolean -LoadRGBMipmaps2( const char *imageFile, GLenum target, - GLint intFormat, GLint *width, GLint *height ); - - -extern GLubyte * -LoadRGBImage( const char *imageFile, - GLint *width, GLint *height, GLenum *format ); - -extern GLushort * -LoadYUVImage( const char *imageFile, GLint *width, GLint *height ); - -#endif diff --git a/progs/util/sampleMakefile b/progs/util/sampleMakefile deleted file mode 100644 index 71ec150b88..0000000000 --- a/progs/util/sampleMakefile +++ /dev/null @@ -1,47 +0,0 @@ - -# Sample makefile for compiling OpenGL/Mesa applications on Unix. -# This example assumes Linux with gcc. - -# This makefile is in the public domain - -# Revision 1.1 1999/08/19 00:55:42 jtg -# Initial revision -# -# Revision 1.1 1999/02/24 05:20:45 brianp -# Initial revision -# - - -CC = gcc - -CFLAGS = -c -g -ansi -pedantic -Wall - -INCDIRS = -I. -I../include - -LIBDIRS = -L../lib -L/usr/X11/lib - -LIBS = -lglut -lMesaGLU -lMesaGL -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm - -OBJECTS = main.o \ - file1.o \ - file2.o \ - file3.o - - -PROGRAMS = myprogram - - -.c.o: - $(CC) $(CFLAGS) $(INCDIRS) $< -o $@ - - - -default: $(PROGRAMS) - - -dtenvmap: $(OBJECTS) - $(CC) $(OBJECTS) $(LIBDIRS) $(LIBS) -o $@ - - -clean: - rm -f *.o diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c deleted file mode 100644 index 2f44c388d8..0000000000 --- a/progs/util/shaderutil.c +++ /dev/null @@ -1,323 +0,0 @@ -/** - * Utilities for OpenGL shading language - * - * Brian Paul - * 9 April 2008 - */ - - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <GL/glew.h> -#include <GL/glut.h> -#include "shaderutil.h" - -/** time to compile previous shader */ -static GLdouble CompileTime = 0.0; - -/** time to linke previous program */ -static GLdouble LinkTime = 0.0; - - -GLboolean -ShadersSupported(void) -{ - const char *version = (const char *) glGetString(GL_VERSION); - - /* NVIDIA binary drivers will return "3.0.0", and they clearly support - * shaders. - */ - if (version[0] >= '2' && version[1] == '.') { - return GL_TRUE; - } - else if (glutExtensionSupported("GL_ARB_vertex_shader") - && glutExtensionSupported("GL_ARB_fragment_shader") - && glutExtensionSupported("GL_ARB_shader_objects")) { - fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n"); - return GL_TRUE; - } - fprintf(stderr, "Sorry, GLSL not supported with this OpenGL.\n"); - return GL_FALSE; -} - - -GLuint -CompileShaderText(GLenum shaderType, const char *text) -{ - GLuint shader; - GLint stat; - GLdouble t0, t1; - - shader = glCreateShader(shaderType); - glShaderSource(shader, 1, (const GLchar **) &text, NULL); - - t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - glCompileShader(shader); - t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - - CompileTime = t1 - t0; - - glGetShaderiv(shader, GL_COMPILE_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetShaderInfoLog(shader, 1000, &len, log); - fprintf(stderr, "Error: problem compiling shader: %s\n", log); - exit(1); - } - else { - /*printf("Shader compiled OK\n");*/ - } - return shader; -} - - -/** - * Read a shader from a file. - */ -GLuint -CompileShaderFile(GLenum shaderType, const char *filename) -{ - const int max = 100*1000; - int n; - char *buffer = (char*) malloc(max); - GLuint shader; - FILE *f; - - f = fopen(filename, "r"); - if (!f) { - fprintf(stderr, "Unable to open shader file %s\n", filename); - free(buffer); - return 0; - } - - n = fread(buffer, 1, max, f); - /*printf("read %d bytes from shader file %s\n", n, filename);*/ - if (n > 0) { - buffer[n] = 0; - shader = CompileShaderText(shaderType, buffer); - } - else { - fclose(f); - free(buffer); - return 0; - } - - fclose(f); - free(buffer); - - return shader; -} - - -GLuint -LinkShaders(GLuint vertShader, GLuint fragShader) -{ - GLuint program = glCreateProgram(); - GLdouble t0, t1; - - assert(vertShader || fragShader); - - if (fragShader) - glAttachShader(program, fragShader); - if (vertShader) - glAttachShader(program, vertShader); - - t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - glLinkProgram(program); - t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; - - LinkTime = t1 - t0; - - /* check link */ - { - GLint stat; - glGetProgramiv(program, GL_LINK_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetProgramInfoLog(program, 1000, &len, log); - fprintf(stderr, "Shader link error:\n%s\n", log); - return 0; - } - } - - return program; -} - - -GLboolean -ValidateShaderProgram(GLuint program) -{ - GLint stat; - glValidateProgramARB(program); - glGetProgramiv(program, GL_VALIDATE_STATUS, &stat); - - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetProgramInfoLog(program, 1000, &len, log); - fprintf(stderr, "Program validation error:\n%s\n", log); - return 0; - } - - return (GLboolean) stat; -} - - -GLdouble -GetShaderCompileTime(void) -{ - return CompileTime; -} - - -GLdouble -GetShaderLinkTime(void) -{ - return LinkTime; -} - - -void -SetUniformValues(GLuint program, struct uniform_info uniforms[]) -{ - GLuint i; - - for (i = 0; uniforms[i].name; i++) { - uniforms[i].location - = glGetUniformLocation(program, uniforms[i].name); - - switch (uniforms[i].type) { - case GL_INT: - case GL_SAMPLER_1D: - case GL_SAMPLER_2D: - case GL_SAMPLER_3D: - case GL_SAMPLER_CUBE: - case GL_SAMPLER_2D_RECT_ARB: - assert(uniforms[i].value[0] >= 0.0F); - glUniform1i(uniforms[i].location, - (GLint) uniforms[i].value[0]); - break; - case GL_FLOAT: - glUniform1fv(uniforms[i].location, 1, uniforms[i].value); - break; - case GL_FLOAT_VEC2: - glUniform2fv(uniforms[i].location, 1, uniforms[i].value); - break; - case GL_FLOAT_VEC3: - glUniform3fv(uniforms[i].location, 1, uniforms[i].value); - break; - case GL_FLOAT_VEC4: - glUniform4fv(uniforms[i].location, 1, uniforms[i].value); - break; - default: - if (strncmp(uniforms[i].name, "gl_", 3) == 0) { - /* built-in uniform: ignore */ - } - else { - fprintf(stderr, - "Unexpected uniform data type in SetUniformValues\n"); - abort(); - } - } - } -} - - -/** Get list of uniforms used in the program */ -GLuint -GetUniforms(GLuint program, struct uniform_info uniforms[]) -{ - GLint n, max, i; - - glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &n); - glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max); - - for (i = 0; i < n; i++) { - GLint size, len; - GLenum type; - char name[100]; - - glGetActiveUniform(program, i, 100, &len, &size, &type, name); - - uniforms[i].name = strdup(name); - uniforms[i].size = size; - uniforms[i].type = type; - uniforms[i].location = glGetUniformLocation(program, name); - } - - uniforms[i].name = NULL; /* end of list */ - - return n; -} - - -void -PrintUniforms(const struct uniform_info uniforms[]) -{ - GLint i; - - printf("Uniforms:\n"); - - for (i = 0; uniforms[i].name; i++) { - printf(" %d: %s size=%d type=0x%x loc=%d value=%g, %g, %g, %g\n", - i, - uniforms[i].name, - uniforms[i].size, - uniforms[i].type, - uniforms[i].location, - uniforms[i].value[0], - uniforms[i].value[1], - uniforms[i].value[2], - uniforms[i].value[3]); - } -} - - -/** Get list of attribs used in the program */ -GLuint -GetAttribs(GLuint program, struct attrib_info attribs[]) -{ - GLint n, max, i; - - glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &n); - glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max); - - for (i = 0; i < n; i++) { - GLint size, len; - GLenum type; - char name[100]; - - glGetActiveAttrib(program, i, 100, &len, &size, &type, name); - - attribs[i].name = strdup(name); - attribs[i].size = size; - attribs[i].type = type; - attribs[i].location = glGetAttribLocation(program, name); - } - - attribs[i].name = NULL; /* end of list */ - - return n; -} - - -void -PrintAttribs(const struct attrib_info attribs[]) -{ - GLint i; - - printf("Attribs:\n"); - - for (i = 0; attribs[i].name; i++) { - printf(" %d: %s size=%d type=0x%x loc=%d\n", - i, - attribs[i].name, - attribs[i].size, - attribs[i].type, - attribs[i].location); - } -} diff --git a/progs/util/shaderutil.h b/progs/util/shaderutil.h deleted file mode 100644 index 98c7181156..0000000000 --- a/progs/util/shaderutil.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef SHADER_UTIL_H -#define SHADER_UTIL_H - - - -struct uniform_info -{ - const char *name; - GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ - GLenum type; /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */ - GLfloat value[4]; - GLint location; /**< filled in by InitUniforms() */ -}; - -#define END_OF_UNIFORMS { NULL, 0, GL_NONE, { 0, 0, 0, 0 }, -1 } - - -struct attrib_info -{ - const char *name; - GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ - GLenum type; /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */ - GLint location; -}; - - -extern GLboolean -ShadersSupported(void); - -extern GLuint -CompileShaderText(GLenum shaderType, const char *text); - -extern GLuint -CompileShaderFile(GLenum shaderType, const char *filename); - -extern GLuint -LinkShaders(GLuint vertShader, GLuint fragShader); - -extern GLboolean -ValidateShaderProgram(GLuint program); - -extern GLdouble -GetShaderCompileTime(void); - -extern GLdouble -GetShaderLinkTime(void); - -extern void -SetUniformValues(GLuint program, struct uniform_info uniforms[]); - -extern GLuint -GetUniforms(GLuint program, struct uniform_info uniforms[]); - -extern void -PrintUniforms(const struct uniform_info uniforms[]); - -extern GLuint -GetAttribs(GLuint program, struct attrib_info attribs[]); - -extern void -PrintAttribs(const struct attrib_info attribs[]); - -#endif /* SHADER_UTIL_H */ diff --git a/progs/util/showbuffer.c b/progs/util/showbuffer.c deleted file mode 100644 index b0cedea217..0000000000 --- a/progs/util/showbuffer.c +++ /dev/null @@ -1,198 +0,0 @@ -/* showbuffer.c */ - - -/* - * Copy the depth buffer to the color buffer as a grayscale image. - * Useful for inspecting the depth buffer values. - * - * This program is in the public domain. - * - * Brian Paul November 4, 1998 - */ - - -#include <assert.h> -#include <stdlib.h> -#include <GL/gl.h> -#include "showbuffer.h" - - - -/* - * Copy the depth buffer values into the current color buffer as a - * grayscale image. - * Input: winWidth, winHeight - size of the window - * zBlack - the Z value which should map to black (usually 1) - * zWhite - the Z value which should map to white (usually 0) - */ -void -ShowDepthBuffer( GLsizei winWidth, GLsizei winHeight, - GLfloat zBlack, GLfloat zWhite ) -{ - GLfloat *depthValues; - - assert(zBlack >= 0.0); - assert(zBlack <= 1.0); - assert(zWhite >= 0.0); - assert(zWhite <= 1.0); - assert(zBlack != zWhite); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - /* Read depth values */ - depthValues = (GLfloat *) malloc(winWidth * winHeight * sizeof(GLfloat)); - assert(depthValues); - glReadPixels(0, 0, winWidth, winHeight, GL_DEPTH_COMPONENT, - GL_FLOAT, depthValues); - - /* Map Z values from [zBlack, zWhite] to gray levels in [0, 1] */ - /* Not using glPixelTransfer() because it's broke on some systems! */ - if (zBlack != 0.0 || zWhite != 1.0) { - GLfloat scale = 1.0 / (zWhite - zBlack); - GLfloat bias = -zBlack * scale; - int n = winWidth * winHeight; - int i; - for (i = 0; i < n; i++) - depthValues[i] = depthValues[i] * scale + bias; - } - - /* save GL state */ - glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | - GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); - - /* setup raster pos for glDrawPixels */ - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - - glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glViewport(0, 0, winWidth, winHeight); - - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glRasterPos2f(0, 0); - - glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_FLOAT, depthValues); - - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - free(depthValues); - - glPopAttrib(); -} - - - - -/* - * Copy the alpha channel values into the current color buffer as a - * grayscale image. - * Input: winWidth, winHeight - size of the window - */ -void -ShowAlphaBuffer( GLsizei winWidth, GLsizei winHeight ) -{ - GLubyte *alphaValues; - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - /* Read alpha values */ - alphaValues = (GLubyte *) malloc(winWidth * winHeight * sizeof(GLubyte)); - assert(alphaValues); - glReadPixels(0, 0, winWidth, winHeight, GL_ALPHA, GL_UNSIGNED_BYTE, alphaValues); - - /* save GL state */ - glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL | - GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); - - /* setup raster pos for glDrawPixels */ - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - - glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glViewport(0, 0, winWidth, winHeight); - - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glRasterPos2f(0, 0); - - glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, alphaValues); - - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - free(alphaValues); - - glPopAttrib(); -} - - - -/* - * Copy the stencil buffer values into the current color buffer as a - * grayscale image. - * Input: winWidth, winHeight - size of the window - * scale, bias - scale and bias to apply to stencil values for display - */ -void -ShowStencilBuffer( GLsizei winWidth, GLsizei winHeight, - GLfloat scale, GLfloat bias ) -{ - GLubyte *stencilValues; - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - - /* Read stencil values */ - stencilValues = (GLubyte *) malloc(winWidth * winHeight * sizeof(GLubyte)); - assert(stencilValues); - glReadPixels(0, 0, winWidth, winHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencilValues); - - /* save GL state */ - glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | - GL_PIXEL_MODE_BIT | GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); - - /* setup raster pos for glDrawPixels */ - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - - glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - glViewport(0, 0, winWidth, winHeight); - - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glRasterPos2f(0, 0); - - glPixelTransferf(GL_RED_SCALE, scale); - glPixelTransferf(GL_RED_BIAS, bias); - glPixelTransferf(GL_GREEN_SCALE, scale); - glPixelTransferf(GL_GREEN_BIAS, bias); - glPixelTransferf(GL_BLUE_SCALE, scale); - glPixelTransferf(GL_BLUE_BIAS, bias); - - glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, stencilValues); - - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - free(stencilValues); - - glPopAttrib(); -} diff --git a/progs/util/showbuffer.h b/progs/util/showbuffer.h deleted file mode 100644 index 63533d8e9b..0000000000 --- a/progs/util/showbuffer.h +++ /dev/null @@ -1,36 +0,0 @@ -/* showbuffer. h*/ - -/* - * Copy the depth buffer to the color buffer as a grayscale image. - * Useful for inspecting the depth buffer values. - * - * This program is in the public domain. - * - * Brian Paul November 4, 1998 - */ - - -#ifndef SHOWBUFFER_H -#define SHOWBUFFER_H - - -#include <GL/gl.h> - - - -extern void -ShowDepthBuffer( GLsizei winWidth, GLsizei winHeight, - GLfloat zBlack, GLfloat zWhite ); - - -extern void -ShowAlphaBuffer( GLsizei winWidth, GLsizei winHeight ); - - -extern void -ShowStencilBuffer( GLsizei winWidth, GLsizei winHeight, - GLfloat scale, GLfloat bias ); - - - -#endif diff --git a/progs/util/trackball.c b/progs/util/trackball.c deleted file mode 100644 index a6c4c60d06..0000000000 --- a/progs/util/trackball.c +++ /dev/null @@ -1,338 +0,0 @@ -#include <stdio.h> -/* - * (c) Copyright 1993, 1994, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* - * Trackball code: - * - * Implementation of a virtual trackball. - * Implemented by Gavin Bell, lots of ideas from Thant Tessman and - * the August '88 issue of Siggraph's "Computer Graphics," pp. 121-129. - * - * Vector manip code: - * - * Original code from: - * David M. Ciemiewicz, Mark Grossman, Henry Moreton, and Paul Haeberli - * - * Much mucking with by: - * Gavin Bell - */ -#if defined(_WIN32) -#pragma warning (disable:4244) /* disable bogus conversion warnings */ -#endif -#include <math.h> -#include "trackball.h" - -/* - * This size should really be based on the distance from the center of - * rotation to the point on the object underneath the mouse. That - * point would then track the mouse as closely as possible. This is a - * simple example, though, so that is left as an Exercise for the - * Programmer. - */ -#define TRACKBALLSIZE (0.8f) - -/* - * Local function prototypes (not defined in trackball.h) - */ -static float tb_project_to_sphere(float, float, float); -static void normalize_quat(float [4]); - -static void -vzero(float v[3]) -{ - v[0] = 0.0; - v[1] = 0.0; - v[2] = 0.0; -} - -static void -vset(float v[3], float x, float y, float z) -{ - v[0] = x; - v[1] = y; - v[2] = z; -} - -static void -vsub(const float src1[3], const float src2[3], float dst[3]) -{ - dst[0] = src1[0] - src2[0]; - dst[1] = src1[1] - src2[1]; - dst[2] = src1[2] - src2[2]; -} - -static void -vcopy(const float v1[3], float v2[3]) -{ - register int i; - for (i = 0 ; i < 3 ; i++) - v2[i] = v1[i]; -} - -static void -vcross(const float v1[3], const float v2[3], float cross[3]) -{ - float temp[3]; - - temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]); - temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]); - temp[2] = (v1[0] * v2[1]) - (v1[1] * v2[0]); - vcopy(temp, cross); -} - -static float -vlength(const float v[3]) -{ - return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); -} - -static void -vscale(float v[3], float div) -{ - v[0] *= div; - v[1] *= div; - v[2] *= div; -} - -static void -vnormal(float v[3]) -{ - vscale(v,1.0/vlength(v)); -} - -static float -vdot(const float v1[3], const float v2[3]) -{ - return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; -} - -static void -vadd(const float src1[3], const float src2[3], float dst[3]) -{ - dst[0] = src1[0] + src2[0]; - dst[1] = src1[1] + src2[1]; - dst[2] = src1[2] + src2[2]; -} - -/* - * Ok, simulate a track-ball. Project the points onto the virtual - * trackball, then figure out the axis of rotation, which is the cross - * product of P1 P2 and O P1 (O is the center of the ball, 0,0,0) - * Note: This is a deformed trackball-- is a trackball in the center, - * but is deformed into a hyperbolic sheet of rotation away from the - * center. This particular function was chosen after trying out - * several variations. - * - * It is assumed that the arguments to this routine are in the range - * (-1.0 ... 1.0) - */ -void -trackball(float q[4], float p1x, float p1y, float p2x, float p2y) -{ - float a[3]; /* Axis of rotation */ - float phi; /* how much to rotate about axis */ - float p1[3], p2[3], d[3]; - float t; - - if (p1x == p2x && p1y == p2y) { - /* Zero rotation */ - vzero(q); - q[3] = 1.0; - return; - } - - /* - * First, figure out z-coordinates for projection of P1 and P2 to - * deformed sphere - */ - vset(p1,p1x,p1y,tb_project_to_sphere(TRACKBALLSIZE,p1x,p1y)); - vset(p2,p2x,p2y,tb_project_to_sphere(TRACKBALLSIZE,p2x,p2y)); - - /* - * Now, we want the cross product of P1 and P2 - */ - vcross(p2,p1,a); - - /* - * Figure out how much to rotate around that axis. - */ - vsub(p1,p2,d); - t = vlength(d) / (2.0*TRACKBALLSIZE); - - /* - * Avoid problems with out-of-control values... - */ - if (t > 1.0) t = 1.0; - if (t < -1.0) t = -1.0; - phi = 2.0 * asin(t); - - axis_to_quat(a,phi,q); -} - -/* - * Given an axis and angle, compute quaternion. - */ -void -axis_to_quat(const float a[3], float phi, float q[4]) -{ - vcopy(a,q); - vnormal(q); - vscale(q, sin(phi/2.0)); - q[3] = cos(phi/2.0); -} - -/* - * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet - * if we are away from the center of the sphere. - */ -static float -tb_project_to_sphere(float r, float x, float y) -{ - float d, t, z; - - d = sqrt(x*x + y*y); - if (d < r * 0.70710678118654752440) { /* Inside sphere */ - z = sqrt(r*r - d*d); - } else { /* On hyperbola */ - t = r / 1.41421356237309504880; - z = t*t / d; - } - return z; -} - -/* - * Given two rotations, e1 and e2, expressed as quaternion rotations, - * figure out the equivalent single rotation and stuff it into dest. - * - * This routine also normalizes the result every RENORMCOUNT times it is - * called, to keep error from creeping in. - * - * NOTE: This routine is written so that q1 or q2 may be the same - * as dest (or each other). - */ - -#define RENORMCOUNT 97 - -void -add_quats(const float q1[4], const float q2[4], float dest[4]) -{ - static int count=0; - float t1[4], t2[4], t3[4]; - float tf[4]; - -#if 0 -printf("q1 = %f %f %f %f\n", q1[0], q1[1], q1[2], q1[3]); -printf("q2 = %f %f %f %f\n", q2[0], q2[1], q2[2], q2[3]); -#endif - - vcopy(q1,t1); - vscale(t1,q2[3]); - - vcopy(q2,t2); - vscale(t2,q1[3]); - - vcross(q2,q1,t3); - vadd(t1,t2,tf); - vadd(t3,tf,tf); - tf[3] = q1[3] * q2[3] - vdot(q1,q2); - -#if 0 -printf("tf = %f %f %f %f\n", tf[0], tf[1], tf[2], tf[3]); -#endif - - dest[0] = tf[0]; - dest[1] = tf[1]; - dest[2] = tf[2]; - dest[3] = tf[3]; - - if (++count > RENORMCOUNT) { - count = 0; - normalize_quat(dest); - } -} - -/* - * Quaternions always obey: a^2 + b^2 + c^2 + d^2 = 1.0 - * If they don't add up to 1.0, dividing by their magnitued will - * renormalize them. - * - * Note: See the following for more information on quaternions: - * - * - Shoemake, K., Animating rotation with quaternion curves, Computer - * Graphics 19, No 3 (Proc. SIGGRAPH'85), 245-254, 1985. - * - Pletinckx, D., Quaternion calculus as a basic tool in computer - * graphics, The Visual Computer 5, 2-13, 1989. - */ -static void -normalize_quat(float q[4]) -{ - int i; - float mag; - - mag = sqrt(q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]); - for (i = 0; i < 4; i++) - q[i] /= mag; -} - -/* - * Build a rotation matrix, given a quaternion rotation. - * - */ -void -build_rotmatrix(float m[4][4], const float q[4]) -{ - m[0][0] = 1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]); - m[0][1] = 2.0 * (q[0] * q[1] - q[2] * q[3]); - m[0][2] = 2.0 * (q[2] * q[0] + q[1] * q[3]); - m[0][3] = 0.0; - - m[1][0] = 2.0 * (q[0] * q[1] + q[2] * q[3]); - m[1][1]= 1.0 - 2.0 * (q[2] * q[2] + q[0] * q[0]); - m[1][2] = 2.0 * (q[1] * q[2] - q[0] * q[3]); - m[1][3] = 0.0; - - m[2][0] = 2.0 * (q[2] * q[0] - q[1] * q[3]); - m[2][1] = 2.0 * (q[1] * q[2] + q[0] * q[3]); - m[2][2] = 1.0 - 2.0 * (q[1] * q[1] + q[0] * q[0]); - m[2][3] = 0.0; - - m[3][0] = 0.0; - m[3][1] = 0.0; - m[3][2] = 0.0; - m[3][3] = 1.0; -} - diff --git a/progs/util/trackball.h b/progs/util/trackball.h deleted file mode 100644 index 9b278640e1..0000000000 --- a/progs/util/trackball.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (c) Copyright 1993, 1994, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* - * trackball.h - * A virtual trackball implementation - * Written by Gavin Bell for Silicon Graphics, November 1988. - */ - -#ifndef TRACKBALL_H -#define TRACKBALL_H - - -/* - * Pass the x and y coordinates of the last and current positions of - * the mouse, scaled so they are from (-1.0 ... 1.0). - * - * The resulting rotation is returned as a quaternion rotation in the - * first paramater. - */ -void -trackball(float q[4], float p1x, float p1y, float p2x, float p2y); - -/* - * Given two quaternions, add them together to get a third quaternion. - * Adding quaternions to get a compound rotation is analagous to adding - * translations to get a compound translation. When incrementally - * adding rotations, the first argument here should be the new - * rotation, the second and third the total rotation (which will be - * over-written with the resulting new total rotation). - */ -void -add_quats(const float q1[4], const float q2[4], float dest[4]); - -/* - * A useful function, builds a rotation matrix in Matrix based on - * given quaternion. - */ -void -build_rotmatrix(float m[4][4], const float q[4]); - -/* - * This function computes a quaternion based on an axis (defined by - * the given vector) and an angle about which to rotate. The angle is - * expressed in radians. The result is put into the third argument. - */ -void -axis_to_quat(const float a[3], float phi, float q[4]); - - -#endif /* TRACKBALL_H */ diff --git a/progs/util/winpos.c b/progs/util/winpos.c deleted file mode 100644 index 5ad98fd270..0000000000 --- a/progs/util/winpos.c +++ /dev/null @@ -1,42 +0,0 @@ -/* winpos.c */ - - -/* - * Set the current raster position to a specific window - * coordinate. Also see the GL_MESA_window_pos extension. - * - * Written by Brian Paul and in the public domain. - */ - - -void WindowPos( GLfloat x, GLfloat y, GLfloat z ) -{ - GLfloat fx, fy; - - /* Push current matrix mode and viewport attributes */ - glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); - - /* Setup projection parameters */ - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - - glDepthRange( z, z ); - glViewport( (int) x - 1, (int) y - 1, 2, 2 ); - - /* set the raster (window) position */ - fx = x - (int) x; - fy = y - (int) y; - glRasterPos3f( fx, fy, 0.0 ); - - /* restore matrices, viewport and matrix mode */ - glPopMatrix(); - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - - glPopAttrib(); -} - |