From 70c69075463acdc7b22ed22ed7aebf76fc78b100 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Fri, 24 Dec 2021 14:38:29 +0100 Subject: [PATCH] LibGL: Add glext.h and lots of new defines in gl.h These constants are used by GLU and Tux Racer. --- Userland/Libraries/LibGL/GL/gl.h | 100 +++++++++++++++++++++++ Userland/Libraries/LibGL/GL/glext.h | 14 ++++ Userland/Libraries/LibGL/GL/glplatform.h | 1 + Userland/Libraries/LibGL/GLContext.h | 1 + 4 files changed, 116 insertions(+) create mode 100644 Userland/Libraries/LibGL/GL/glext.h diff --git a/Userland/Libraries/LibGL/GL/gl.h b/Userland/Libraries/LibGL/GL/gl.h index 058391964c..43cc404295 100644 --- a/Userland/Libraries/LibGL/GL/gl.h +++ b/Userland/Libraries/LibGL/GL/gl.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Jesse Buhagiar * Copyright (c) 2021, Stephan Unverwerth + * Copyright (c) 2021, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ @@ -32,10 +33,15 @@ extern "C" { #define GL_TEXTURE 0x1702 // glBegin/glEnd primitive types +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 #define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 #define GL_POLYGON 0x0009 // Depth buffer and alpha test compare functions @@ -54,6 +60,10 @@ extern "C" { #define GL_COLOR_BUFFER_BIT 0x04000 // Enable capabilities +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 #define GL_CULL_FACE 0x0B44 #define GL_FOG 0x0B60 #define GL_DEPTH_TEST 0x0B71 @@ -71,6 +81,10 @@ extern "C" { #define GL_BLEND_SRC_ALPHA 0x0302 #define GL_BLEND_DST_ALPHA 0x0304 +// Attribute enum +#define GL_EVAL_BIT 0x00010000 +#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF + // Utility #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 @@ -79,7 +93,17 @@ extern "C" { #define GL_SHADING_LANGUAGE_VERSION 0x8B8C // Get parameters +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_NORMALIZE 0x0BA1 +#define GL_VIEWPORT 0x0BA2 #define GL_DOUBLEBUFFER 0x0C32 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 #define GL_MAX_TEXTURE_SIZE 0x0D33 #define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 #define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 @@ -91,6 +115,27 @@ extern "C" { #define GL_DEPTH_BITS 0x0D56 #define GL_STENCIL_BITS 0x0D57 #define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_NORMAL_ARRAY 0x8075 // Blend factors #define GL_ZERO 0 @@ -144,9 +189,23 @@ extern "C" { #define GL_TEXTURE_COMPRESSION_HINT 0x84EF // Reading pixels & unpacking texture patterns +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNPACK_LSB_FIRST 0x0CF1 #define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 #define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E + +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_PIXELS 0x0D04 #define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C // Listing enums #define GL_COMPILE 0x1300 @@ -192,11 +251,27 @@ extern "C" { #define GL_AMBIENT 0x1200 #define GL_DIFFUSE 0x1201 #define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 #define GL_EMISSION 0x1600 #define GL_SHININESS 0x1601 #define GL_AMBIENT_AND_DIFFUSE 0x1602 #define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + // More blend factors #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 @@ -235,9 +310,16 @@ extern "C" { // Texture targets #define GL_TEXTURE_1D 0x0DE0 #define GL_TEXTURE_2D 0x0DE1 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 #define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 #define GL_TEXTURE_CUBE_MAP 0x8513 +// Texture parameters +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 + // Texture Unit indices #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 @@ -305,6 +387,12 @@ extern "C" { #define GL_TEXTURE30_ARB GL_TEXTURE30 #define GL_TEXTURE31_ARB GL_TEXTURE31 +// Texture coord names +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 + // Texture Environment and Parameters #define GL_MODULATE 0x2100 #define GL_TEXTURE_ENV_MODE 0x2200 @@ -326,6 +414,18 @@ extern "C" { #define GL_CLAMP_TO_BORDER 0x812D #define GL_CLAMP_TO_EDGE 0x812F +// Texture gen modes +#define GL_EYE_LINEAR 0x2400 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_SPHERE_MAP 0x2402 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 + +// Texture gen parameters +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_PLANE 0x2502 + // Client state capabilities #define GL_VERTEX_ARRAY 0x8074 #define GL_COLOR_ARRAY 0x8076 diff --git a/Userland/Libraries/LibGL/GL/glext.h b/Userland/Libraries/LibGL/GL/glext.h new file mode 100644 index 0000000000..ce6698ee38 --- /dev/null +++ b/Userland/Libraries/LibGL/GL/glext.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2021, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +#define GL_GLEXT_VERSION 20211115 + +typedef void(APIENTRYP PFNGLLOCKARRAYSEXTPROC)(GLint first, GLsizei count); +typedef void(APIENTRYP PFNGLUNLOCKARRAYSEXTPROC)(void); diff --git a/Userland/Libraries/LibGL/GL/glplatform.h b/Userland/Libraries/LibGL/GL/glplatform.h index 80df593ef8..60bc1d2735 100644 --- a/Userland/Libraries/LibGL/GL/glplatform.h +++ b/Userland/Libraries/LibGL/GL/glplatform.h @@ -35,6 +35,7 @@ typedef unsigned long long GLuint64; typedef int GLsizei; typedef void GLvoid; typedef float GLfloat; +typedef double GLclampd; typedef float GLclampf; typedef double GLdouble; typedef unsigned int GLenum; diff --git a/Userland/Libraries/LibGL/GLContext.h b/Userland/Libraries/LibGL/GLContext.h index 3faf9f5c93..386aa9421f 100644 --- a/Userland/Libraries/LibGL/GLContext.h +++ b/Userland/Libraries/LibGL/GLContext.h @@ -8,6 +8,7 @@ #pragma once #include "GL/gl.h" +#include "GL/glext.h" #include #include #include