├── README.md ├── ReadMe.txt ├── bin ├── Data │ ├── Compressed.tga │ ├── NeHe.bmp │ └── Uncompressed.tga ├── box.exe ├── demo2.exe ├── demo6.exe ├── lines.exe ├── stroke.exe └── texture.exe ├── demo ├── TGALoader.c ├── Texture.h ├── Tga.h ├── box.c ├── demo6.c ├── glm.c ├── glm.h ├── light.c ├── stroke.c ├── test.c └── texture.c ├── doc ├── gl.bmp ├── lighting.jpg ├── lines.jpg ├── myOpenGL Architecture.bmp ├── texsampler.bmp ├── texture.jpg ├── triangles.jpg └── 纹理坐标.bmp ├── include └── GL │ ├── gl.h │ ├── glu.h │ ├── mygl.h │ └── util.h ├── lib ├── myOpenGL.lib └── myOpenGLd.lib ├── src ├── glapi.c ├── glcontext.c ├── glcontext.h ├── glfragment.c ├── glfragment.h ├── gllistcmd.c ├── gllistcmd.h ├── glmath.c ├── glmath.h ├── glrasterlize.c ├── glrasterlize.h ├── gltexture.c ├── gltexture.h ├── glu.c ├── glvertexmachine.c ├── glvertexmachine.h └── util.c └── vs2005 ├── demo ├── demo.vcproj └── demo.vcproj.GATEWAY-C3B43C3.Gateway.user ├── demo2 ├── demo2.vcproj └── demo2.vcproj.GATEWAY-C3B43C3.Gateway.user ├── demo3 ├── demo3.vcproj └── demo3.vcproj.GATEWAY-C3B43C3.Gateway.user ├── demo4 ├── demo4.vcproj └── demo4.vcproj.GATEWAY-C3B43C3.Gateway.user ├── demo5 ├── demo5.vcproj └── demo5.vcproj.GATEWAY-C3B43C3.Gateway.user ├── demo6 ├── demo6.vcproj └── demo6.vcproj.GATEWAY-C3B43C3.Gateway.user ├── vs2005.sln ├── vs2005.suo └── vs2005 ├── vs2005.vcproj └── vs2005.vcproj.GATEWAY-C3B43C3.Gateway.user /README.md: -------------------------------------------------------------------------------- 1 | # MinOpenGL 2 | Software implement OpenGL 1.1 version. 3 | It is a practice when I was learning 3D Graphic in year 2010. 4 | -------------------------------------------------------------------------------- /ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/ReadMe.txt -------------------------------------------------------------------------------- /bin/Data/Compressed.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/Data/Compressed.tga -------------------------------------------------------------------------------- /bin/Data/NeHe.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/Data/NeHe.bmp -------------------------------------------------------------------------------- /bin/Data/Uncompressed.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/Data/Uncompressed.tga -------------------------------------------------------------------------------- /bin/box.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/box.exe -------------------------------------------------------------------------------- /bin/demo2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/demo2.exe -------------------------------------------------------------------------------- /bin/demo6.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/demo6.exe -------------------------------------------------------------------------------- /bin/lines.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/lines.exe -------------------------------------------------------------------------------- /bin/stroke.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/stroke.exe -------------------------------------------------------------------------------- /bin/texture.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/bin/texture.exe -------------------------------------------------------------------------------- /demo/TGALoader.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | /Name: TGA.cpp * 3 | /Header: tga.h * 4 | /Purpose: Load Compressed and Uncompressed TGA files * 5 | /Functions: LoadTGA(Texture * texture, char * filename) * 6 | / LoadCompressedTGA(Texture * texture, char * filename, FILE * fTGA) * 7 | / LoadUncompressedTGA(Texture * texture, char * filename, FILE * fTGA)* 8 | /*******************************************************************************/ 9 | #include "tga.h" 10 | 11 | static GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0}; // Uncompressed TGA Headers 12 | static GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header 13 | 14 | /******************************************************************************** 15 | /name : LoadTGA(Texture * texture, char * filename) * 16 | /function: Open and test the file to make sure it is a valid TGA file * 17 | /parems: texture, pointer to a Texture structure * 18 | / filename, string pointing to file to open * 19 | /********************************************************************************/ 20 | 21 | GLboolean LoadTGA(Texture * texture, char * filename) // Load a TGA file 22 | { 23 | FILE * fTGA; // File pointer to texture file 24 | fTGA = fopen(filename, "rb"); // Open file for reading 25 | 26 | if(fTGA == NULL) // If it didn't open.... 27 | { 28 | return GL_FALSE; // Exit function 29 | } 30 | 31 | if(fread(&tgaheader, sizeof(TGAHeader), 1, fTGA) == 0) // Attempt to read 12 byte header from file 32 | { 33 | if(fTGA != NULL) // Check to seeiffile is still open 34 | { 35 | fclose(fTGA); // If it is, close it 36 | } 37 | return GL_FALSE; // Exit function 38 | } 39 | 40 | if(memcmp(uTGAcompare, &tgaheader, sizeof(tgaheader)) == 0) // See if header matches the predefined header of 41 | { // an Uncompressed TGA image 42 | LoadUncompressedTGA(texture, filename, fTGA); // If so, jump to Uncompressed TGA loading code 43 | } 44 | else if(memcmp(cTGAcompare, &tgaheader, sizeof(tgaheader)) == 0) // See if header matches the predefined header of 45 | { // an RLE compressed TGA image 46 | LoadCompressedTGA(texture, filename, fTGA); // If so, jump to Compressed TGA loading code 47 | } 48 | else // If header matches neither type 49 | { 50 | fclose(fTGA); 51 | return GL_FALSE; // Exit function 52 | } 53 | return GL_TRUE; // All went well, continue on 54 | } 55 | 56 | GLboolean LoadUncompressedTGA(Texture * texture, char * filename, FILE * fTGA) // Load an uncompressed TGA (note, much of this code is based on NeHe's 57 | { 58 | GLuint cswap; 59 | 60 | if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0) // Read TGA header 61 | { 62 | if(fTGA != NULL) // if file is still open 63 | { 64 | fclose(fTGA); // Close it 65 | } 66 | return GL_FALSE; // Return failular 67 | } 68 | 69 | texture->width = tga.header[1] * 256 + tga.header[0]; // Determine The TGA Width (highbyte*256+lowbyte) 70 | texture->height = tga.header[3] * 256 + tga.header[2]; // Determine The TGA Height (highbyte*256+lowbyte) 71 | texture->bpp = tga.header[4]; // Determine the bits per pixel 72 | tga.Width = texture->width; // Copy width into local structure 73 | tga.Height = texture->height; // Copy height into local structure 74 | tga.Bpp = texture->bpp; // Copy BPP into local structure 75 | 76 | if((texture->width <= 0) || (texture->height <= 0) || ((texture->bpp != 24) && (texture->bpp !=32))) // Make sure all information is valid 77 | { 78 | if(fTGA != NULL) // Check if file is still open 79 | { 80 | fclose(fTGA); // If so, close it 81 | } 82 | return GL_FALSE; // Return failed 83 | } 84 | 85 | if(texture->bpp == 24) // If the BPP of the image is 24... 86 | texture->type = GL_RGB; // Set Image type to GL_RGB 87 | else // Else if its 32 BPP 88 | texture->type = GL_RGBA; // Set image type to GL_RGBA 89 | 90 | tga.bytesPerPixel = (tga.Bpp / 8); // Compute the number of BYTES per pixel 91 | tga.imageSize = (tga.bytesPerPixel * tga.Width * tga.Height); // Compute the total amout ofmemory needed to store data 92 | texture->imageData = (GLubyte *)malloc(tga.imageSize); // Allocate that much memory 93 | 94 | if(texture->imageData == NULL) // If no space was allocated 95 | { 96 | fclose(fTGA); // Close the file 97 | return GL_FALSE; // Return failed 98 | } 99 | 100 | if(fread(texture->imageData, 1, tga.imageSize, fTGA) != tga.imageSize) // Attempt to read image data 101 | { 102 | if(texture->imageData != NULL) // If imagedata has data in it 103 | { 104 | free(texture->imageData); // Delete data from memory 105 | } 106 | fclose(fTGA); // Close file 107 | return GL_FALSE; // Return failed 108 | } 109 | 110 | // Byte Swapping Optimized By Steve Thomas 111 | for( cswap = 0; cswap < (int)tga.imageSize; cswap += tga.bytesPerPixel) 112 | { 113 | texture->imageData[cswap] ^= texture->imageData[cswap+2] ^= 114 | texture->imageData[cswap] ^= texture->imageData[cswap+2]; 115 | } 116 | 117 | fclose(fTGA); // Close file 118 | return GL_TRUE; // Return success 119 | } 120 | 121 | GLboolean LoadCompressedTGA(Texture * texture, char * filename, FILE * fTGA) // Load COMPRESSED TGAs 122 | { 123 | GLuint pixelcount; // Nuber of pixels in the image 124 | GLuint currentpixel; // Current pixel being read 125 | GLuint currentbyte; // Current byte 126 | GLubyte * colorbuffer; // Storage for 1 pixel 127 | 128 | if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0) // Attempt to read header 129 | { 130 | if(fTGA != NULL) // If file is open 131 | { 132 | fclose(fTGA); // Close it 133 | } 134 | return GL_FALSE; // Return failed 135 | } 136 | 137 | texture->width = tga.header[1] * 256 + tga.header[0]; // Determine The TGA Width (highbyte*256+lowbyte) 138 | texture->height = tga.header[3] * 256 + tga.header[2]; // Determine The TGA Height (highbyte*256+lowbyte) 139 | texture->bpp = tga.header[4]; // Determine Bits Per Pixel 140 | tga.Width = texture->width; // Copy width to local structure 141 | tga.Height = texture->height; // Copy width to local structure 142 | tga.Bpp = texture->bpp; // Copy width to local structure 143 | 144 | if((texture->width <= 0) || (texture->height <= 0) || ((texture->bpp != 24) && (texture->bpp !=32))) //Make sure all texture info is ok 145 | { 146 | if(fTGA != NULL) // Check if file is open 147 | { 148 | fclose(fTGA); // Ifit is, close it 149 | } 150 | return GL_FALSE; // Return failed 151 | } 152 | 153 | if(texture->bpp == 24) // If the BPP of the image is 24... 154 | texture->type = GL_RGB; // Set Image type to GL_RGB 155 | else // Else if its 32 BPP 156 | texture->type = GL_RGBA; // Set image type to GL_RGBA 157 | 158 | tga.bytesPerPixel = (tga.Bpp / 8); // Compute BYTES per pixel 159 | tga.imageSize = (tga.bytesPerPixel * tga.Width * tga.Height); // Compute amout of memory needed to store image 160 | texture->imageData = (GLubyte *)malloc(tga.imageSize); // Allocate that much memory 161 | 162 | if(texture->imageData == NULL) // If it wasnt allocated correctly.. 163 | { 164 | fclose(fTGA); // Close file 165 | return GL_FALSE; // Return failed 166 | } 167 | 168 | pixelcount = tga.Height * tga.Width; // Nuber of pixels in the image 169 | currentpixel = 0; // Current pixel being read 170 | currentbyte = 0; // Current byte 171 | colorbuffer = (GLubyte *)malloc(tga.bytesPerPixel); // Storage for 1 pixel 172 | 173 | do 174 | { 175 | GLubyte chunkheader = 0; // Storage for "chunk" header 176 | short counter; 177 | 178 | if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0) // Read in the 1 byte header 179 | { 180 | if(fTGA != NULL) // If file is open 181 | { 182 | fclose(fTGA); // Close file 183 | } 184 | if(texture->imageData != NULL) // If there is stored image data 185 | { 186 | free(texture->imageData); // Delete image data 187 | } 188 | return GL_FALSE; // Return failed 189 | } 190 | 191 | if(chunkheader < 128) // If the ehader is < 128, it means the that is the number of RAW color packets minus 1 192 | { // that follow the header 193 | chunkheader++; // add 1 to get number of following color values 194 | for(counter = 0; counter < chunkheader; counter++) // Read RAW color values 195 | { 196 | if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel) // Try to read 1 pixel 197 | { 198 | 199 | if(fTGA != NULL) // See if file is open 200 | { 201 | fclose(fTGA); // If so, close file 202 | } 203 | 204 | if(colorbuffer != NULL) // See if colorbuffer has data in it 205 | { 206 | free(colorbuffer); // If so, delete it 207 | } 208 | 209 | if(texture->imageData != NULL) // See if there is stored Image data 210 | { 211 | free(texture->imageData); // If so, delete it too 212 | } 213 | 214 | return GL_FALSE; // Return failed 215 | } 216 | // write to memory 217 | texture->imageData[currentbyte ] = colorbuffer[2]; // Flip R and B vcolor values around in the process 218 | texture->imageData[currentbyte + 1 ] = colorbuffer[1]; 219 | texture->imageData[currentbyte + 2 ] = colorbuffer[0]; 220 | 221 | if(tga.bytesPerPixel == 4) // if its a 32 bpp image 222 | { 223 | texture->imageData[currentbyte + 3] = colorbuffer[3]; // copy the 4th byte 224 | } 225 | 226 | currentbyte += tga.bytesPerPixel; // Increase thecurrent byte by the number of bytes per pixel 227 | currentpixel++; // Increase current pixel by 1 228 | 229 | if(currentpixel > pixelcount) // Make sure we havent read too many pixels 230 | { 231 | 232 | if(fTGA != NULL) // If there is a file open 233 | { 234 | fclose(fTGA); // Close file 235 | } 236 | 237 | if(colorbuffer != NULL) // If there is data in colorbuffer 238 | { 239 | free(colorbuffer); // Delete it 240 | } 241 | 242 | if(texture->imageData != NULL) // If there is Image data 243 | { 244 | free(texture->imageData); // delete it 245 | } 246 | 247 | return GL_FALSE; // Return failed 248 | } 249 | } 250 | } 251 | else // chunkheader > 128 RLE data, next color reapeated chunkheader - 127 times 252 | { 253 | chunkheader -= 127; // Subteact 127 to get rid of the ID bit 254 | if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel) // Attempt to read following color values 255 | { 256 | 257 | if(fTGA != NULL) // If thereis a file open 258 | { 259 | fclose(fTGA); // Close it 260 | } 261 | 262 | if(colorbuffer != NULL) // If there is data in the colorbuffer 263 | { 264 | free(colorbuffer); // delete it 265 | } 266 | 267 | if(texture->imageData != NULL) // If thereis image data 268 | { 269 | free(texture->imageData); // delete it 270 | } 271 | 272 | return GL_FALSE; // return failed 273 | } 274 | 275 | for(counter = 0; counter < chunkheader; counter++) // copy the color into the image data as many times as dictated 276 | { // by the header 277 | texture->imageData[currentbyte ] = colorbuffer[2]; // switch R and B bytes areound while copying 278 | texture->imageData[currentbyte + 1 ] = colorbuffer[1]; 279 | texture->imageData[currentbyte + 2 ] = colorbuffer[0]; 280 | 281 | if(tga.bytesPerPixel == 4) // If TGA images is 32 bpp 282 | { 283 | texture->imageData[currentbyte + 3] = colorbuffer[3]; // Copy 4th byte 284 | } 285 | 286 | currentbyte += tga.bytesPerPixel; // Increase current byte by the number of bytes per pixel 287 | currentpixel++; // Increase pixel count by 1 288 | 289 | if(currentpixel > pixelcount) // Make sure we havent written too many pixels 290 | { 291 | 292 | if(fTGA != NULL) // If there is a file open 293 | { 294 | fclose(fTGA); // Close file 295 | } 296 | 297 | if(colorbuffer != NULL) // If there is data in colorbuffer 298 | { 299 | free(colorbuffer); // Delete it 300 | } 301 | 302 | if(texture->imageData != NULL) // If there is Image data 303 | { 304 | free(texture->imageData); // delete it 305 | } 306 | 307 | return GL_FALSE; // Return failed 308 | } 309 | } 310 | } 311 | } 312 | 313 | while(currentpixel < pixelcount); // Loop while there are still pixels left 314 | fclose(fTGA); // Close the file 315 | return GL_TRUE; // return success 316 | } 317 | -------------------------------------------------------------------------------- /demo/Texture.h: -------------------------------------------------------------------------------- 1 | #ifndef __TEXTURE_H__ 2 | #define __TEXTURE_H__ 3 | 4 | #include "../include/GL/gl.h" // Header for OpenGL32 library 5 | 6 | 7 | typedef struct 8 | { 9 | GLubyte * imageData; // Image Data (Up To 32 Bits) 10 | GLuint bpp; // Image Color Depth In Bits Per Pixel 11 | GLuint width; // Image Width 12 | GLuint height; // Image Height 13 | GLuint texID; // Texture ID Used To Select A Texture 14 | GLuint type; // Image Type (GL_RGB, GL_RGBA) 15 | } Texture; 16 | 17 | #endif -------------------------------------------------------------------------------- /demo/Tga.h: -------------------------------------------------------------------------------- 1 | #ifndef __TGA_H__ 2 | #define __TGA_H__ 3 | 4 | #include // Standard I/O header 5 | #include "../include/GL/gl.h" 6 | #include "texture.h" 7 | 8 | 9 | 10 | typedef struct 11 | { 12 | GLubyte Header[12]; // TGA File Header 13 | } TGAHeader; 14 | 15 | 16 | typedef struct 17 | { 18 | GLubyte header[6]; // First 6 Useful Bytes From The Header 19 | GLuint bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File 20 | GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram 21 | GLuint temp; // Temporary Variable 22 | GLuint type; 23 | GLuint Height; //Height of Image 24 | GLuint Width; //Width ofImage 25 | GLuint Bpp; // Bits Per Pixel 26 | } TGA; 27 | 28 | 29 | TGAHeader tgaheader; // TGA header 30 | TGA tga; // TGA image data 31 | 32 | GLboolean LoadTGA(Texture * texture, char * filename); 33 | GLboolean LoadUncompressedTGA(Texture *, char *, FILE *); // Load an Uncompressed file 34 | GLboolean LoadCompressedTGA(Texture *, char *, FILE *); // Load a Compressed file 35 | 36 | #endif 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /demo/box.c: -------------------------------------------------------------------------------- 1 | // texture 2 | 3 | #include 4 | #include 5 | 6 | #include "../include/GL/gl.h" 7 | #include "../include/GL/glu.h" 8 | #include "../include/GL/mygl.h" 9 | #include "../include/GL/util.h" 10 | #include "Texture.h" 11 | #include "Tga.h" 12 | 13 | GLfloat xrot; // X Rotation ( NEW ) 14 | GLfloat yrot; // Y Rotation ( NEW ) 15 | GLfloat zrot; // Z Rotation ( NEW ) 16 | Texture texture[2]; // Storage For 2 Textures ( NEW ) 17 | 18 | int LoadGLTextures() // Load Bitmaps And Convert To Textures 19 | { 20 | int Status=FALSE; // Status Indicator 21 | int loop; 22 | 23 | // Load The Bitmap, Check For Errors. 24 | if (LoadTGA(&texture[0], "Data/Uncompressed.tga") && 25 | LoadTGA(&texture[1], "Data/Compressed.tga")) 26 | { 27 | Status=TRUE; // Set The Status To TRUE 28 | 29 | for (loop=0; loop<2; loop++) // Loop Through Both Textures 30 | { 31 | // Typical Texture Generation Using Data From The TGA ( CHANGE ) 32 | glGenTextures(1, &texture[loop].texID); // Create The Texture ( CHANGE ) 33 | glBindTexture(GL_TEXTURE_2D, texture[loop].texID); 34 | glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].type, 35 | texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData); 36 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 37 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 38 | 39 | if (texture[loop].imageData) // If Texture Image Exists ( CHANGE ) 40 | { 41 | free(texture[loop].imageData); // Free The Texture Image Memory ( CHANGE ) 42 | } 43 | } 44 | } 45 | return Status; // Return The Status 46 | } 47 | 48 | 49 | void init(void) 50 | { 51 | if (!LoadGLTextures()) exit(0); 52 | 53 | glEnable(GL_TEXTURE_2D); // Enable Texture Mapping ( NEW ) 54 | glShadeModel(GL_SMOOTH); // Enable Smooth Shading 55 | glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background 56 | glEnable(GL_DEPTH_TEST); // Enables Depth Testing 57 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 58 | } 59 | 60 | void display(void) 61 | { 62 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer 63 | glLoadIdentity(); // Reset The View 64 | glTranslatef(0.0f,0.0f,-5.0f); 65 | 66 | glRotatef(xrot,1.0f,0.0f,0.0f); 67 | glRotatef(yrot,0.0f,1.0f,0.0f); 68 | glRotatef(zrot,0.0f,0.0f,1.0f); 69 | 70 | glBindTexture(GL_TEXTURE_2D, texture[1].texID); 71 | 72 | glBegin(GL_QUADS); 73 | // Front Face 74 | glColor3f(1.f, 0.f, 0.f); 75 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); 76 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); 77 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); 78 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); 79 | // Back Face 80 | glColor3f(0.3f, 0.8f, 0.f); 81 | glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); 82 | glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); 83 | glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); 84 | glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); 85 | // Top Face 86 | glColor3f(0.4f, 0.4f, 1.0f); 87 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); 88 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); 89 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); 90 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); 91 | // Bottom Face 92 | glColor3f(0.5f, 1.f, 0.f); 93 | glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); 94 | glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); 95 | glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); 96 | glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); 97 | // Right face 98 | glColor3f(0.3f, 0.7f, 0.2f); 99 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); 100 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); 101 | glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); 102 | glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); 103 | // Left Face 104 | glColor3f(0.f, 0.5f, 1.f); 105 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); 106 | glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); 107 | glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); 108 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); 109 | glEnd(); 110 | 111 | glFlush(); 112 | myGLswapbuffer(); 113 | 114 | xrot+=0.3f; 115 | yrot+=0.2f; 116 | zrot+=0.4f; 117 | } 118 | 119 | void reshape(int w, int h) 120 | { 121 | glViewport(0, 0, (GLsizei)w, (GLsizei)h); 122 | glMatrixMode(GL_PROJECTION); 123 | glLoadIdentity(); 124 | gluPerspective(60.f, (GLfloat)w/(GLfloat)h, 1.f, 100.f); 125 | glMatrixMode(GL_MODELVIEW); 126 | } 127 | 128 | void keyboard(unsigned char key, int x, int y) 129 | { 130 | switch (key) { 131 | case 27: 132 | exit(0); 133 | break; 134 | } 135 | } 136 | 137 | void idle(void) 138 | { 139 | GLbyte szbuf[64]; 140 | 141 | begin_performance(); 142 | display(); 143 | sprintf(szbuf, "FPS: %f", end_performance(NULL)); 144 | myGLsetWindowCaption(szbuf); 145 | } 146 | 147 | int main(int argc, char** argv) 148 | { 149 | myGLinit(); 150 | init(); 151 | myGLinitWindowSize (400, 400); 152 | myGLinitWindowPosition (100, 100); 153 | myGLdisplayFunc(display); 154 | myGLreshapeFunc(reshape); 155 | myGLkeyboardFunc(keyboard); 156 | myGLidleFunc(idle); 157 | myGLcreateWindow (argv[0]); 158 | myGLmainLoop(); 159 | myGLexit(); 160 | return 0; 161 | } -------------------------------------------------------------------------------- /demo/demo6.c: -------------------------------------------------------------------------------- 1 | // texture 2 | 3 | #include 4 | #include 5 | 6 | #include "../include/GL/gl.h" 7 | #include "../include/GL/glu.h" 8 | #include "../include/GL/mygl.h" 9 | #include "../include/GL/util.h" 10 | 11 | #include "Texture.h" 12 | #include "Tga.h" 13 | 14 | 15 | float spin; // Spin Variable 16 | Texture texture[2]; // Storage For 2 Textures ( NEW ) 17 | 18 | int LoadGLTextures() // Load Bitmaps And Convert To Textures 19 | { 20 | int Status=FALSE; // Status Indicator 21 | int loop; 22 | 23 | // Load The Bitmap, Check For Errors. 24 | if (LoadTGA(&texture[0], "Data/Uncompressed.tga") && 25 | LoadTGA(&texture[1], "Data/Compressed.tga")) 26 | { 27 | Status=TRUE; // Set The Status To TRUE 28 | 29 | for (loop=0; loop<2; loop++) // Loop Through Both Textures 30 | { 31 | // Typical Texture Generation Using Data From The TGA ( CHANGE ) 32 | glGenTextures(1, &texture[loop].texID); // Create The Texture ( CHANGE ) 33 | glBindTexture(GL_TEXTURE_2D, texture[loop].texID); 34 | glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].type, 35 | texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData); 36 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 37 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 38 | 39 | if (texture[loop].imageData) // If Texture Image Exists ( CHANGE ) 40 | { 41 | free(texture[loop].imageData); // Free The Texture Image Memory ( CHANGE ) 42 | } 43 | } 44 | } 45 | return Status; // Return The Status 46 | } 47 | 48 | void init(void) 49 | { if (!LoadGLTextures()) // Jump To Texture Loading Routine ( NEW ) 50 | { 51 | exit(0); // If Texture Didn't Load Return FALSE 52 | } 53 | 54 | glEnable(GL_TEXTURE_2D); // Enable Texture Mapping ( NEW ) 55 | glShadeModel(GL_SMOOTH); // Enable Smooth Shading 56 | glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background 57 | glEnable(GL_DEPTH_TEST); // Enables Depth Testing 58 | } 59 | 60 | void display(void) 61 | { 62 | int loop; 63 | 64 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer 65 | glLoadIdentity(); // Reset The View 66 | glTranslatef(0.0f,0.0f,-10.0f); // Translate 20 Units Into The Screen 67 | 68 | spin+=0.05f; // Increase Spin 69 | 70 | for (loop=0; loop<2; loop++) // Loop Of 20 71 | { 72 | glPushMatrix(); // Push The Matrix 73 | glRotatef(spin+loop*18.0f,1.0f,0.0f,0.0f); // Rotate On The X-Axis (Up - Down) 74 | glTranslatef(-2.0f,2.0f,0.0f); // Translate 2 Units Left And 2 Up 75 | 76 | glBindTexture(GL_TEXTURE_2D, texture[0].texID); // ( CHANGE ) 77 | glBegin(GL_QUADS); // Draw Our Quad 78 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f); 79 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f); 80 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 0.0f); 81 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f); 82 | glEnd(); // Done Drawing The Quad 83 | glPopMatrix(); // Pop The Matrix 84 | 85 | glPushMatrix(); // Push The Matrix 86 | glTranslatef(2.0f,0.0f,0.0f); // Translate 2 Units To The Right 87 | glRotatef(spin+loop*36.0f,0.0f,1.0f,0.0f); // Rotate On The Y-Axis (Left - Right) 88 | glTranslatef(1.0f,0.0f,0.0f); // Move One Unit Right 89 | 90 | glBindTexture(GL_TEXTURE_2D, texture[1].texID); // ( CHANGE ) 91 | glBegin(GL_QUADS); // Draw Our Quad 92 | glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 0.0f); 93 | glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 0.0f); 94 | glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 0.0f); 95 | glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 0.0f); 96 | glEnd(); // Done Drawing The Quad 97 | glPopMatrix(); // Pop The Matrix 98 | } 99 | glFlush(); 100 | myGLswapbuffer(); 101 | } 102 | 103 | void reshape(int w, int h) 104 | { 105 | glViewport(0, 0, (GLsizei)w, (GLsizei)h); 106 | glMatrixMode(GL_PROJECTION); 107 | glLoadIdentity(); 108 | gluPerspective(60.f, (GLfloat)w/(GLfloat)h, 1.f, 100.f); 109 | glMatrixMode(GL_MODELVIEW); 110 | } 111 | 112 | void keyboard(unsigned char key, int x, int y) 113 | { 114 | switch (key) { 115 | case 27: 116 | exit(0); 117 | break; 118 | } 119 | } 120 | 121 | void idle(void) 122 | { 123 | GLbyte szbuf[64]; 124 | 125 | begin_performance(); 126 | display(); 127 | sprintf(szbuf, "FPS: %f", end_performance(NULL)); 128 | myGLsetWindowCaption(szbuf); 129 | } 130 | 131 | int main(int argc, char** argv) 132 | { 133 | myGLinit(); 134 | init(); 135 | myGLinitWindowSize (400, 400); 136 | myGLinitWindowPosition (100, 100); 137 | myGLdisplayFunc(display); 138 | myGLreshapeFunc(reshape); 139 | myGLkeyboardFunc(keyboard); 140 | myGLidleFunc(idle); 141 | myGLcreateWindow (argv[0]); 142 | myGLmainLoop(); 143 | myGLexit(); 144 | return 0; 145 | } -------------------------------------------------------------------------------- /demo/glm.h: -------------------------------------------------------------------------------- 1 | /* 2 | glm.h 3 | Nate Robins, 1997, 2000 4 | nate@pobox.com, http://www.pobox.com/~nate 5 | 6 | Wavefront OBJ model file format reader/writer/manipulator. 7 | 8 | Includes routines for generating smooth normals with 9 | preservation of edges, welding redundant vertices & texture 10 | coordinate generation (spheremap and planar projections) + more. 11 | 12 | */ 13 | 14 | 15 | #if defined(__APPLE__) || defined(MACOSX) 16 | #include 17 | #else 18 | #include 19 | #endif 20 | 21 | 22 | #ifndef M_PI 23 | #define M_PI 3.14159265f 24 | #endif 25 | 26 | #define GLM_NONE (0) /* render with only vertices */ 27 | #define GLM_FLAT (1 << 0) /* render with facet normals */ 28 | #define GLM_SMOOTH (1 << 1) /* render with vertex normals */ 29 | #define GLM_TEXTURE (1 << 2) /* render with texture coords */ 30 | #define GLM_COLOR (1 << 3) /* render with colors */ 31 | #define GLM_MATERIAL (1 << 4) /* render with materials */ 32 | 33 | 34 | /* GLMmaterial: Structure that defines a material in a model. 35 | */ 36 | typedef struct _GLMmaterial 37 | { 38 | char* name; /* name of material */ 39 | GLfloat diffuse[4]; /* diffuse component */ 40 | GLfloat ambient[4]; /* ambient component */ 41 | GLfloat specular[4]; /* specular component */ 42 | GLfloat emmissive[4]; /* emmissive component */ 43 | GLfloat shininess; /* specular exponent */ 44 | } GLMmaterial; 45 | 46 | /* GLMtriangle: Structure that defines a triangle in a model. 47 | */ 48 | typedef struct _GLMtriangle { 49 | GLuint vindices[3]; /* array of triangle vertex indices */ 50 | GLuint nindices[3]; /* array of triangle normal indices */ 51 | GLuint tindices[3]; /* array of triangle texcoord indices*/ 52 | GLuint findex; /* index of triangle facet normal */ 53 | } GLMtriangle; 54 | 55 | /* GLMgroup: Structure that defines a group in a model. 56 | */ 57 | typedef struct _GLMgroup { 58 | char* name; /* name of this group */ 59 | GLuint numtriangles; /* number of triangles in this group */ 60 | GLuint* triangles; /* array of triangle indices */ 61 | GLuint material; /* index to material for group */ 62 | struct _GLMgroup* next; /* pointer to next group in model */ 63 | } GLMgroup; 64 | 65 | /* GLMmodel: Structure that defines a model. 66 | */ 67 | typedef struct _GLMmodel { 68 | char* pathname; /* path to this model */ 69 | char* mtllibname; /* name of the material library */ 70 | 71 | GLuint numvertices; /* number of vertices in model */ 72 | GLfloat* vertices; /* array of vertices */ 73 | 74 | GLuint numnormals; /* number of normals in model */ 75 | GLfloat* normals; /* array of normals */ 76 | 77 | GLuint numtexcoords; /* number of texcoords in model */ 78 | GLfloat* texcoords; /* array of texture coordinates */ 79 | 80 | GLuint numfacetnorms; /* number of facetnorms in model */ 81 | GLfloat* facetnorms; /* array of facetnorms */ 82 | 83 | GLuint numtriangles; /* number of triangles in model */ 84 | GLMtriangle* triangles; /* array of triangles */ 85 | 86 | GLuint nummaterials; /* number of materials in model */ 87 | GLMmaterial* materials; /* array of materials */ 88 | 89 | GLuint numgroups; /* number of groups in model */ 90 | GLMgroup* groups; /* linked list of groups */ 91 | 92 | GLfloat position[3]; /* position of the model */ 93 | 94 | } GLMmodel; 95 | 96 | 97 | /* glmUnitize: "unitize" a model by translating it to the origin and 98 | * scaling it to fit in a unit cube around the origin. Returns the 99 | * scalefactor used. 100 | * 101 | * model - properly initialized GLMmodel structure 102 | */ 103 | GLfloat 104 | glmUnitize(GLMmodel* model); 105 | 106 | /* glmDimensions: Calculates the dimensions (width, height, depth) of 107 | * a model. 108 | * 109 | * model - initialized GLMmodel structure 110 | * dimensions - array of 3 GLfloats (GLfloat dimensions[3]) 111 | */ 112 | GLvoid 113 | glmDimensions(GLMmodel* model, GLfloat* dimensions); 114 | 115 | /* glmScale: Scales a model by a given amount. 116 | * 117 | * model - properly initialized GLMmodel structure 118 | * scale - scalefactor (0.5 = half as large, 2.0 = twice as large) 119 | */ 120 | GLvoid 121 | glmScale(GLMmodel* model, GLfloat scale); 122 | 123 | /* glmReverseWinding: Reverse the polygon winding for all polygons in 124 | * this model. Default winding is counter-clockwise. Also changes 125 | * the direction of the normals. 126 | * 127 | * model - properly initialized GLMmodel structure 128 | */ 129 | GLvoid 130 | glmReverseWinding(GLMmodel* model); 131 | 132 | /* glmFacetNormals: Generates facet normals for a model (by taking the 133 | * cross product of the two vectors derived from the sides of each 134 | * triangle). Assumes a counter-clockwise winding. 135 | * 136 | * model - initialized GLMmodel structure 137 | */ 138 | GLvoid 139 | glmFacetNormals(GLMmodel* model); 140 | 141 | /* glmVertexNormals: Generates smooth vertex normals for a model. 142 | * First builds a list of all the triangles each vertex is in. Then 143 | * loops through each vertex in the the list averaging all the facet 144 | * normals of the triangles each vertex is in. Finally, sets the 145 | * normal index in the triangle for the vertex to the generated smooth 146 | * normal. If the dot product of a facet normal and the facet normal 147 | * associated with the first triangle in the list of triangles the 148 | * current vertex is in is greater than the cosine of the angle 149 | * parameter to the function, that facet normal is not added into the 150 | * average normal calculation and the corresponding vertex is given 151 | * the facet normal. This tends to preserve hard edges. The angle to 152 | * use depends on the model, but 90 degrees is usually a good start. 153 | * 154 | * model - initialized GLMmodel structure 155 | * angle - maximum angle (in degrees) to smooth across 156 | */ 157 | GLvoid 158 | glmVertexNormals(GLMmodel* model, GLfloat angle); 159 | 160 | /* glmLinearTexture: Generates texture coordinates according to a 161 | * linear projection of the texture map. It generates these by 162 | * linearly mapping the vertices onto a square. 163 | * 164 | * model - pointer to initialized GLMmodel structure 165 | */ 166 | GLvoid 167 | glmLinearTexture(GLMmodel* model); 168 | 169 | /* glmSpheremapTexture: Generates texture coordinates according to a 170 | * spherical projection of the texture map. Sometimes referred to as 171 | * spheremap, or reflection map texture coordinates. It generates 172 | * these by using the normal to calculate where that vertex would map 173 | * onto a sphere. Since it is impossible to map something flat 174 | * perfectly onto something spherical, there is distortion at the 175 | * poles. This particular implementation causes the poles along the X 176 | * axis to be distorted. 177 | * 178 | * model - pointer to initialized GLMmodel structure 179 | */ 180 | GLvoid 181 | glmSpheremapTexture(GLMmodel* model); 182 | 183 | /* glmDelete: Deletes a GLMmodel structure. 184 | * 185 | * model - initialized GLMmodel structure 186 | */ 187 | GLvoid 188 | glmDelete(GLMmodel* model); 189 | 190 | /* glmReadOBJ: Reads a model description from a Wavefront .OBJ file. 191 | * Returns a pointer to the created object which should be free'd with 192 | * glmDelete(). 193 | * 194 | * filename - name of the file containing the Wavefront .OBJ format data. 195 | */ 196 | GLMmodel* 197 | glmReadOBJ(char* filename); 198 | 199 | /* glmWriteOBJ: Writes a model description in Wavefront .OBJ format to 200 | * a file. 201 | * 202 | * model - initialized GLMmodel structure 203 | * filename - name of the file to write the Wavefront .OBJ format data to 204 | * mode - a bitwise or of values describing what is written to the file 205 | * GLM_NONE - write only vertices 206 | * GLM_FLAT - write facet normals 207 | * GLM_SMOOTH - write vertex normals 208 | * GLM_TEXTURE - write texture coords 209 | * GLM_FLAT and GLM_SMOOTH should not both be specified. 210 | */ 211 | GLvoid 212 | glmWriteOBJ(GLMmodel* model, char* filename, GLuint mode); 213 | 214 | /* glmDraw: Renders the model to the current OpenGL context using the 215 | * mode specified. 216 | * 217 | * model - initialized GLMmodel structure 218 | * mode - a bitwise OR of values describing what is to be rendered. 219 | * GLM_NONE - render with only vertices 220 | * GLM_FLAT - render with facet normals 221 | * GLM_SMOOTH - render with vertex normals 222 | * GLM_TEXTURE - render with texture coords 223 | * GLM_FLAT and GLM_SMOOTH should not both be specified. 224 | */ 225 | GLvoid 226 | glmDraw(GLMmodel* model, GLuint mode); 227 | 228 | /* glmList: Generates and returns a display list for the model using 229 | * the mode specified. 230 | * 231 | * model - initialized GLMmodel structure 232 | * mode - a bitwise OR of values describing what is to be rendered. 233 | * GLM_NONE - render with only vertices 234 | * GLM_FLAT - render with facet normals 235 | * GLM_SMOOTH - render with vertex normals 236 | * GLM_TEXTURE - render with texture coords 237 | * GLM_FLAT and GLM_SMOOTH should not both be specified. 238 | */ 239 | GLuint 240 | glmList(GLMmodel* model, GLuint mode); 241 | 242 | /* glmWeld: eliminate (weld) vectors that are within an epsilon of 243 | * each other. 244 | * 245 | * model - initialized GLMmodel structure 246 | * epsilon - maximum difference between vertices 247 | * ( 0.00001 is a good start for a unitized model) 248 | * 249 | */ 250 | GLvoid 251 | glmWeld(GLMmodel* model, GLfloat epsilon); 252 | 253 | /* glmReadPPM: read a PPM raw (type P6) file. The PPM file has a header 254 | * that should look something like: 255 | * 256 | * P6 257 | * # comment 258 | * width height max_value 259 | * rgbrgbrgb... 260 | * 261 | * where "P6" is the magic cookie which identifies the file type and 262 | * should be the only characters on the first line followed by a 263 | * carriage return. Any line starting with a # mark will be treated 264 | * as a comment and discarded. After the magic cookie, three integer 265 | * values are expected: width, height of the image and the maximum 266 | * value for a pixel (max_value must be < 256 for PPM raw files). The 267 | * data section consists of width*height rgb triplets (one byte each) 268 | * in binary format (i.e., such as that written with fwrite() or 269 | * equivalent). 270 | * 271 | * The rgb data is returned as an array of unsigned chars (packed 272 | * rgb). The malloc()'d memory should be free()'d by the caller. If 273 | * an error occurs, an error message is sent to stderr and NULL is 274 | * returned. 275 | * 276 | * filename - name of the .ppm file. 277 | * width - will contain the width of the image on return. 278 | * height - will contain the height of the image on return. 279 | * 280 | */ 281 | GLubyte* 282 | glmReadPPM(char* filename, int* width, int* height); 283 | -------------------------------------------------------------------------------- /demo/light.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/demo/light.c -------------------------------------------------------------------------------- /demo/stroke.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/demo/stroke.c -------------------------------------------------------------------------------- /demo/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1993-1999, Silicon Graphics, Inc. 3 | * ALL RIGHTS RESERVED 4 | * Permission to use, copy, modify, and distribute this software for 5 | * any purpose and without fee is hereby granted, provided that the above 6 | * copyright notice appear in all copies and that both the copyright notice 7 | * and this permission notice appear in supporting documentation, and that 8 | * the name of Silicon Graphics, Inc. not be used in advertising 9 | * or publicity pertaining to distribution of the software without specific, 10 | * written prior permission. 11 | * 12 | * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" 13 | * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, 14 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR 15 | * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON 16 | * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, 17 | * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY 18 | * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, 19 | * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF 20 | * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN 21 | * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON 22 | * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE 23 | * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. 24 | * 25 | * US Government Users Restricted Rights 26 | * Use, duplication, or disclosure by the Government is subject to 27 | * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph 28 | * (c)(1)(ii) of the Rights in Technical Data and Computer Software 29 | * clause at DFARS 252.227-7013 and/or in similar or successor 30 | * clauses in the FAR or the DOD or NASA FAR Supplement. 31 | * Unpublished-- rights reserved under the copyright laws of the 32 | * United States. Contractor/manufacturer is Silicon Graphics, 33 | * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. 34 | * 35 | * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. 36 | */ 37 | 38 | /* 39 | * lines.c 40 | * This program demonstrates geometric primitives and 41 | * their attributes. 42 | */ 43 | 44 | #include 45 | #include 46 | #include "../include/GL/gl.h" 47 | #include "../include/GL/mygl.h" 48 | 49 | 50 | void init(void) 51 | { 52 | glClearColor (0.0, 0.0, 0.0, 0.0); 53 | glEnable(GL_DEPTH_TEST); 54 | } 55 | 56 | void display(void) 57 | { 58 | glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 59 | 60 | #if 0 61 | glBegin(GL_POINT); 62 | glColor3f (1.0, 0.0, 0.0); glVertex2f (10.f, 10.f); 63 | glColor3f (1.0, 0.0, 0.0); glVertex2f (400.f, 10.f); 64 | glEnd(); 65 | #endif 66 | 67 | #if 0 68 | glBegin(GL_LINES); 69 | /* dely > delx */ 70 | glColor3f (1.0, 0.0, 0.0); glVertex2f (-10.f, 10.f); 71 | glColor3f (0.0, 1.0, 0.0); glVertex2f (50.f, 100.f); 72 | #if 0 73 | glColor3f (1.0, 0.0, 0.0); glVertex2f (30.f, 10.f); 74 | glColor3f (0.0, 1.0, 0.0); glVertex2f (10.f, 100.f); 75 | 76 | /* delx > dely */ 77 | glColor3f (1.0, 0.0, 0.0); glVertex2f (10.f, 10.f); 78 | glColor3f (0.0, 1.0, 0.0); glVertex2f (100.f, 30.f); 79 | 80 | glColor3f (1.0, 0.0, 0.0); glVertex2f (100.f, 10.f); 81 | glColor3f (0.0, 1.0, 0.0); glVertex2f (10.f, 30.f); 82 | 83 | /* delx = 0 */ 84 | glColor3f (1.0, 0.0, 0.0); glVertex2f (100.f, 100.f); 85 | glColor3f (0.0, 1.0, 0.0); glVertex2f (100.f, 30.f); 86 | 87 | /* dely = 0 */ 88 | glColor3f (1.0, 0.0, 0.0); glVertex2f (30.f, 100.f); 89 | glColor3f (0.0, 1.0, 0.0); glVertex2f (100.f, 100.f); 90 | 91 | /* v0 = v1 */ 92 | glColor3f (1.0, 0.0, 0.0); glVertex2f (100.f, 100.f); 93 | glColor3f (0.0, 1.0, 0.0); glVertex2f (100.f, 100.f); 94 | #endif 95 | glEnd(); 96 | #endif 97 | 98 | #if 0 99 | glBegin(GL_TRIANGLES); 100 | /* CW */ 101 | #if 0 102 | glColor3f (1.0, 0.0, 0.0); glVertex2f (10.f, 10.f); 103 | glColor3f (0.0, 1.0, 0.0); glVertex2f (30.f, 100.f); 104 | glColor3f (1.0, 0.0, 0.0); glVertex2f (30.f, 10.f); 105 | #endif 106 | 107 | /* CCW */ 108 | glColor3f (1.0, 0.0, 0.0); glVertex2f (-50.f, 50.f); 109 | glColor3f (0.0, 1.0, 0.0); glVertex2f (130.f, 50.f); 110 | glColor3f (0.0, 0.0, 1.0); glVertex2f (130.f, 400.f); 111 | 112 | glEnd(); 113 | #endif 114 | 115 | #if 0 116 | glBegin(GL_TRIANGLE_FAN); 117 | /* CCW */ 118 | glColor3f (1.0, 0.0, 0.0); glVertex2f (10.f, 10.f); 119 | glColor3f (0.0, 1.0, 0.0); glVertex2f (130.f, 10.f); 120 | glColor3f (0.0, 1.0, 0.0); glVertex2f (180.f, 110.f); 121 | glColor3f (0.0, 0.0, 1.0); glVertex2f (30.f, 100.f); 122 | glColor3f (0.0, 0.0, 1.0); glVertex2f (20.f, 150.f); 123 | glEnd(); 124 | glBegin(GL_TRIANGLES); 125 | /* CCW */ 126 | glColor3f (1.0, 0.0, 0.0); glVertex2f (100.1f, 100.f); 127 | glColor3f (0.0, 1.0, 0.0); glVertex2f (200.f, 168.2f); 128 | glColor3f (0.0, 1.0, 0.0); glVertex2f (-50.f, 299.9f); 129 | 130 | glColor3f (0.0, 1.0, 0.0); glVertex2f (10.f, 299.9f); 131 | glColor3f (0.0, 1.0, 0.0); glVertex2f (200.f, 168.2f); 132 | glColor3f (0.0, 1.0, 0.0); glVertex2f (300.f, 400.2f); 133 | glEnd(); 134 | #endif 135 | 136 | #if 0 137 | glBegin(GL_QUADS); 138 | glColor3f (1.0, 0.0, 0.0); glVertex2f (10.f, 10.f); 139 | glColor3f (0.0, 1.0, 0.0); glVertex2f (130.f, 10.f); 140 | glColor3f (0.0, 1.0, 0.0); glVertex2f (180.f, 110.f); 141 | glColor3f (0.0, 0.0, 1.0); glVertex2f (30.f, 100.f); 142 | 143 | glEnd(); 144 | #endif 145 | 146 | #if 1 147 | glBegin(GL_QUAD_STRIP); 148 | glColor3f (1.0, 0.0, 0.0); glVertex2f (10.f, 10.f); 149 | glColor3f (0.0, 1.0, 0.0); glVertex2f (130.f, 10.f); 150 | glColor3f (0.0, 0.0, 1.0); glVertex2f (30.f, 100.f); 151 | glColor3f (0.0, 1.0, 0.0); glVertex2f (180.f, 110.f); 152 | glColor3f (0.0, 0.0, 1.0); glVertex2f (50.f, 180.f); 153 | glColor3f (0.0, 0.0, 1.0); glVertex2f (180.f, 280.f); 154 | glEnd(); 155 | #endif 156 | 157 | glFlush (); 158 | myGLswapbuffer(); 159 | } 160 | 161 | void reshape (int w, int h) 162 | { 163 | glViewport (0, 0, (GLsizei) w, (GLsizei) h); 164 | glMatrixMode (GL_PROJECTION); 165 | glLoadIdentity (); 166 | glOrtho (0.0, (GLdouble) w, 0.0, (GLdouble) h, -1.0, 1.0); 167 | } 168 | 169 | void keyboard(unsigned char key, int x, int y) 170 | { 171 | switch (key) { 172 | case 27: 173 | exit(0); 174 | break; 175 | } 176 | } 177 | 178 | int main(int argc, char** argv) 179 | { 180 | myGLinit(); 181 | init(); 182 | myGLinitWindowSize (400, 400); 183 | myGLinitWindowPosition (100, 100); 184 | myGLdisplayFunc(display); 185 | myGLreshapeFunc(reshape); 186 | myGLkeyboardFunc(keyboard); 187 | myGLcreateWindow (argv[0]); 188 | myGLmainLoop(); 189 | myGLexit(); 190 | return 0; 191 | } 192 | -------------------------------------------------------------------------------- /demo/texture.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/demo/texture.c -------------------------------------------------------------------------------- /doc/gl.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/gl.bmp -------------------------------------------------------------------------------- /doc/lighting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/lighting.jpg -------------------------------------------------------------------------------- /doc/lines.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/lines.jpg -------------------------------------------------------------------------------- /doc/myOpenGL Architecture.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/myOpenGL Architecture.bmp -------------------------------------------------------------------------------- /doc/texsampler.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/texsampler.bmp -------------------------------------------------------------------------------- /doc/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/texture.jpg -------------------------------------------------------------------------------- /doc/triangles.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/triangles.jpg -------------------------------------------------------------------------------- /doc/纹理坐标.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/doc/纹理坐标.bmp -------------------------------------------------------------------------------- /include/GL/gl.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0004 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1985-96, Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | gl.h 8 | 9 | Abstract: 10 | 11 | Procedure declarations, constant definitions and macros for the OpenGL 12 | component. 13 | 14 | --*/ 15 | 16 | #ifndef __gl_h_ 17 | #ifndef __GL_H__ 18 | 19 | #define __gl_h_ 20 | #define __GL_H__ 21 | 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* 29 | ** Copyright 1996 Silicon Graphics, Inc. 30 | ** All Rights Reserved. 31 | ** 32 | ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 33 | ** the contents of this file may not be disclosed to third parties, copied or 34 | ** duplicated in any form, in whole or in part, without the prior written 35 | ** permission of Silicon Graphics, Inc. 36 | ** 37 | ** RESTRICTED RIGHTS LEGEND: 38 | ** Use, duplication or disclosure by the Government is subject to restrictions 39 | ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 40 | ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or 41 | ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 42 | ** rights reserved under the Copyright Laws of the United States. 43 | */ 44 | 45 | typedef unsigned int GLenum; 46 | typedef unsigned char GLboolean; 47 | typedef unsigned int GLbitfield; 48 | typedef signed char GLbyte; 49 | typedef short GLshort; 50 | typedef int GLint; 51 | typedef int GLsizei; 52 | typedef unsigned char GLubyte; 53 | typedef unsigned short GLushort; 54 | typedef unsigned int GLuint; 55 | typedef float GLfloat; 56 | typedef float GLclampf; 57 | typedef double GLdouble; 58 | typedef double GLclampd; 59 | typedef void GLvoid; 60 | 61 | /*************************************************************/ 62 | 63 | /* Version */ 64 | #define GL_VERSION_1_1 1 65 | 66 | /* AccumOp */ 67 | #define GL_ACCUM 0x0100 68 | #define GL_LOAD 0x0101 69 | #define GL_RETURN 0x0102 70 | #define GL_MULT 0x0103 71 | #define GL_ADD 0x0104 72 | 73 | /* AlphaFunction */ 74 | #define GL_NEVER 0x0200 75 | #define GL_LESS 0x0201 76 | #define GL_EQUAL 0x0202 77 | #define GL_LEQUAL 0x0203 78 | #define GL_GREATER 0x0204 79 | #define GL_NOTEQUAL 0x0205 80 | #define GL_GEQUAL 0x0206 81 | #define GL_ALWAYS 0x0207 82 | 83 | /* AttribMask */ 84 | #define GL_CURRENT_BIT 0x00000001 85 | #define GL_POINT_BIT 0x00000002 86 | #define GL_LINE_BIT 0x00000004 87 | #define GL_POLYGON_BIT 0x00000008 88 | #define GL_POLYGON_STIPPLE_BIT 0x00000010 89 | #define GL_PIXEL_MODE_BIT 0x00000020 90 | #define GL_LIGHTING_BIT 0x00000040 91 | #define GL_FOG_BIT 0x00000080 92 | #define GL_DEPTH_BUFFER_BIT 0x00000100 93 | #define GL_ACCUM_BUFFER_BIT 0x00000200 94 | #define GL_STENCIL_BUFFER_BIT 0x00000400 95 | #define GL_VIEWPORT_BIT 0x00000800 96 | #define GL_TRANSFORM_BIT 0x00001000 97 | #define GL_ENABLE_BIT 0x00002000 98 | #define GL_COLOR_BUFFER_BIT 0x00004000 99 | #define GL_HINT_BIT 0x00008000 100 | #define GL_EVAL_BIT 0x00010000 101 | #define GL_LIST_BIT 0x00020000 102 | #define GL_TEXTURE_BIT 0x00040000 103 | #define GL_SCISSOR_BIT 0x00080000 104 | #define GL_ALL_ATTRIB_BITS 0x000fffff 105 | 106 | /* BeginMode */ 107 | #define GL_POINTS 0x0000 108 | #define GL_LINES 0x0001 109 | #define GL_LINE_LOOP 0x0002 110 | #define GL_LINE_STRIP 0x0003 111 | #define GL_TRIANGLES 0x0004 112 | #define GL_TRIANGLE_STRIP 0x0005 113 | #define GL_TRIANGLE_FAN 0x0006 114 | #define GL_QUADS 0x0007 115 | #define GL_QUAD_STRIP 0x0008 116 | #define GL_POLYGON 0x0009 117 | 118 | /* BlendingFactorDest */ 119 | #define GL_ZERO 0 120 | #define GL_ONE 1 121 | #define GL_SRC_COLOR 0x0300 122 | #define GL_ONE_MINUS_SRC_COLOR 0x0301 123 | #define GL_SRC_ALPHA 0x0302 124 | #define GL_ONE_MINUS_SRC_ALPHA 0x0303 125 | #define GL_DST_ALPHA 0x0304 126 | #define GL_ONE_MINUS_DST_ALPHA 0x0305 127 | 128 | /* BlendingFactorSrc */ 129 | /* GL_ZERO */ 130 | /* GL_ONE */ 131 | #define GL_DST_COLOR 0x0306 132 | #define GL_ONE_MINUS_DST_COLOR 0x0307 133 | #define GL_SRC_ALPHA_SATURATE 0x0308 134 | /* GL_SRC_ALPHA */ 135 | /* GL_ONE_MINUS_SRC_ALPHA */ 136 | /* GL_DST_ALPHA */ 137 | /* GL_ONE_MINUS_DST_ALPHA */ 138 | 139 | /* Boolean */ 140 | #define GL_TRUE 1 141 | #define GL_FALSE 0 142 | 143 | /* ClearBufferMask */ 144 | /* GL_COLOR_BUFFER_BIT */ 145 | /* GL_ACCUM_BUFFER_BIT */ 146 | /* GL_STENCIL_BUFFER_BIT */ 147 | /* GL_DEPTH_BUFFER_BIT */ 148 | 149 | /* ClientArrayType */ 150 | /* GL_VERTEX_ARRAY */ 151 | /* GL_NORMAL_ARRAY */ 152 | /* GL_COLOR_ARRAY */ 153 | /* GL_INDEX_ARRAY */ 154 | /* GL_TEXTURE_COORD_ARRAY */ 155 | /* GL_EDGE_FLAG_ARRAY */ 156 | 157 | /* ClipPlaneName */ 158 | #define GL_CLIP_PLANE0 0x3000 159 | #define GL_CLIP_PLANE1 0x3001 160 | #define GL_CLIP_PLANE2 0x3002 161 | #define GL_CLIP_PLANE3 0x3003 162 | #define GL_CLIP_PLANE4 0x3004 163 | #define GL_CLIP_PLANE5 0x3005 164 | 165 | /* ColorMaterialFace */ 166 | /* GL_FRONT */ 167 | /* GL_BACK */ 168 | /* GL_FRONT_AND_BACK */ 169 | 170 | /* ColorMaterialParameter */ 171 | /* GL_AMBIENT */ 172 | /* GL_DIFFUSE */ 173 | /* GL_SPECULAR */ 174 | /* GL_EMISSION */ 175 | /* GL_AMBIENT_AND_DIFFUSE */ 176 | 177 | /* ColorPointerType */ 178 | /* GL_BYTE */ 179 | /* GL_UNSIGNED_BYTE */ 180 | /* GL_SHORT */ 181 | /* GL_UNSIGNED_SHORT */ 182 | /* GL_INT */ 183 | /* GL_UNSIGNED_INT */ 184 | /* GL_FLOAT */ 185 | /* GL_DOUBLE */ 186 | 187 | /* CullFaceMode */ 188 | /* GL_FRONT */ 189 | /* GL_BACK */ 190 | /* GL_FRONT_AND_BACK */ 191 | 192 | /* DataType */ 193 | #define GL_BYTE 0x1400 194 | #define GL_UNSIGNED_BYTE 0x1401 195 | #define GL_SHORT 0x1402 196 | #define GL_UNSIGNED_SHORT 0x1403 197 | #define GL_INT 0x1404 198 | #define GL_UNSIGNED_INT 0x1405 199 | #define GL_FLOAT 0x1406 200 | #define GL_2_BYTES 0x1407 201 | #define GL_3_BYTES 0x1408 202 | #define GL_4_BYTES 0x1409 203 | #define GL_DOUBLE 0x140A 204 | 205 | /* DepthFunction */ 206 | /* GL_NEVER */ 207 | /* GL_LESS */ 208 | /* GL_EQUAL */ 209 | /* GL_LEQUAL */ 210 | /* GL_GREATER */ 211 | /* GL_NOTEQUAL */ 212 | /* GL_GEQUAL */ 213 | /* GL_ALWAYS */ 214 | 215 | /* DrawBufferMode */ 216 | #define GL_NONE 0 217 | #define GL_FRONT_LEFT 0x0400 218 | #define GL_FRONT_RIGHT 0x0401 219 | #define GL_BACK_LEFT 0x0402 220 | #define GL_BACK_RIGHT 0x0403 221 | #define GL_FRONT 0x0404 222 | #define GL_BACK 0x0405 223 | #define GL_LEFT 0x0406 224 | #define GL_RIGHT 0x0407 225 | #define GL_FRONT_AND_BACK 0x0408 226 | #define GL_AUX0 0x0409 227 | #define GL_AUX1 0x040A 228 | #define GL_AUX2 0x040B 229 | #define GL_AUX3 0x040C 230 | 231 | /* Enable */ 232 | /* GL_FOG */ 233 | /* GL_LIGHTING */ 234 | /* GL_TEXTURE_1D */ 235 | /* GL_TEXTURE_2D */ 236 | /* GL_LINE_STIPPLE */ 237 | /* GL_POLYGON_STIPPLE */ 238 | /* GL_CULL_FACE */ 239 | /* GL_ALPHA_TEST */ 240 | /* GL_BLEND */ 241 | /* GL_INDEX_LOGIC_OP */ 242 | /* GL_COLOR_LOGIC_OP */ 243 | /* GL_DITHER */ 244 | /* GL_STENCIL_TEST */ 245 | /* GL_DEPTH_TEST */ 246 | /* GL_CLIP_PLANE0 */ 247 | /* GL_CLIP_PLANE1 */ 248 | /* GL_CLIP_PLANE2 */ 249 | /* GL_CLIP_PLANE3 */ 250 | /* GL_CLIP_PLANE4 */ 251 | /* GL_CLIP_PLANE5 */ 252 | /* GL_LIGHT0 */ 253 | /* GL_LIGHT1 */ 254 | /* GL_LIGHT2 */ 255 | /* GL_LIGHT3 */ 256 | /* GL_LIGHT4 */ 257 | /* GL_LIGHT5 */ 258 | /* GL_LIGHT6 */ 259 | /* GL_LIGHT7 */ 260 | /* GL_TEXTURE_GEN_S */ 261 | /* GL_TEXTURE_GEN_T */ 262 | /* GL_TEXTURE_GEN_R */ 263 | /* GL_TEXTURE_GEN_Q */ 264 | /* GL_MAP1_VERTEX_3 */ 265 | /* GL_MAP1_VERTEX_4 */ 266 | /* GL_MAP1_COLOR_4 */ 267 | /* GL_MAP1_INDEX */ 268 | /* GL_MAP1_NORMAL */ 269 | /* GL_MAP1_TEXTURE_COORD_1 */ 270 | /* GL_MAP1_TEXTURE_COORD_2 */ 271 | /* GL_MAP1_TEXTURE_COORD_3 */ 272 | /* GL_MAP1_TEXTURE_COORD_4 */ 273 | /* GL_MAP2_VERTEX_3 */ 274 | /* GL_MAP2_VERTEX_4 */ 275 | /* GL_MAP2_COLOR_4 */ 276 | /* GL_MAP2_INDEX */ 277 | /* GL_MAP2_NORMAL */ 278 | /* GL_MAP2_TEXTURE_COORD_1 */ 279 | /* GL_MAP2_TEXTURE_COORD_2 */ 280 | /* GL_MAP2_TEXTURE_COORD_3 */ 281 | /* GL_MAP2_TEXTURE_COORD_4 */ 282 | /* GL_POINT_SMOOTH */ 283 | /* GL_LINE_SMOOTH */ 284 | /* GL_POLYGON_SMOOTH */ 285 | /* GL_SCISSOR_TEST */ 286 | /* GL_COLOR_MATERIAL */ 287 | /* GL_NORMALIZE */ 288 | /* GL_AUTO_NORMAL */ 289 | /* GL_VERTEX_ARRAY */ 290 | /* GL_NORMAL_ARRAY */ 291 | /* GL_COLOR_ARRAY */ 292 | /* GL_INDEX_ARRAY */ 293 | /* GL_TEXTURE_COORD_ARRAY */ 294 | /* GL_EDGE_FLAG_ARRAY */ 295 | /* GL_POLYGON_OFFSET_POINT */ 296 | /* GL_POLYGON_OFFSET_LINE */ 297 | /* GL_POLYGON_OFFSET_FILL */ 298 | 299 | /* ErrorCode */ 300 | #define GL_NO_ERROR 0 301 | #define GL_INVALID_ENUM 0x0500 302 | #define GL_INVALID_VALUE 0x0501 303 | #define GL_INVALID_OPERATION 0x0502 304 | #define GL_STACK_OVERFLOW 0x0503 305 | #define GL_STACK_UNDERFLOW 0x0504 306 | #define GL_OUT_OF_MEMORY 0x0505 307 | 308 | /* FeedBackMode */ 309 | #define GL_2D 0x0600 310 | #define GL_3D 0x0601 311 | #define GL_3D_COLOR 0x0602 312 | #define GL_3D_COLOR_TEXTURE 0x0603 313 | #define GL_4D_COLOR_TEXTURE 0x0604 314 | 315 | /* FeedBackToken */ 316 | #define GL_PASS_THROUGH_TOKEN 0x0700 317 | #define GL_POINT_TOKEN 0x0701 318 | #define GL_LINE_TOKEN 0x0702 319 | #define GL_POLYGON_TOKEN 0x0703 320 | #define GL_BITMAP_TOKEN 0x0704 321 | #define GL_DRAW_PIXEL_TOKEN 0x0705 322 | #define GL_COPY_PIXEL_TOKEN 0x0706 323 | #define GL_LINE_RESET_TOKEN 0x0707 324 | 325 | /* FogMode */ 326 | /* GL_LINEAR */ 327 | #define GL_EXP 0x0800 328 | #define GL_EXP2 0x0801 329 | 330 | 331 | /* FogParameter */ 332 | /* GL_FOG_COLOR */ 333 | /* GL_FOG_DENSITY */ 334 | /* GL_FOG_END */ 335 | /* GL_FOG_INDEX */ 336 | /* GL_FOG_MODE */ 337 | /* GL_FOG_START */ 338 | 339 | /* FrontFaceDirection */ 340 | #define GL_CW 0x0900 341 | #define GL_CCW 0x0901 342 | 343 | /* GetMapTarget */ 344 | #define GL_COEFF 0x0A00 345 | #define GL_ORDER 0x0A01 346 | #define GL_DOMAIN 0x0A02 347 | 348 | /* GetPixelMap */ 349 | /* GL_PIXEL_MAP_I_TO_I */ 350 | /* GL_PIXEL_MAP_S_TO_S */ 351 | /* GL_PIXEL_MAP_I_TO_R */ 352 | /* GL_PIXEL_MAP_I_TO_G */ 353 | /* GL_PIXEL_MAP_I_TO_B */ 354 | /* GL_PIXEL_MAP_I_TO_A */ 355 | /* GL_PIXEL_MAP_R_TO_R */ 356 | /* GL_PIXEL_MAP_G_TO_G */ 357 | /* GL_PIXEL_MAP_B_TO_B */ 358 | /* GL_PIXEL_MAP_A_TO_A */ 359 | 360 | /* GetPointerTarget */ 361 | /* GL_VERTEX_ARRAY_POINTER */ 362 | /* GL_NORMAL_ARRAY_POINTER */ 363 | /* GL_COLOR_ARRAY_POINTER */ 364 | /* GL_INDEX_ARRAY_POINTER */ 365 | /* GL_TEXTURE_COORD_ARRAY_POINTER */ 366 | /* GL_EDGE_FLAG_ARRAY_POINTER */ 367 | 368 | /* GetTarget */ 369 | #define GL_CURRENT_COLOR 0x0B00 370 | #define GL_CURRENT_INDEX 0x0B01 371 | #define GL_CURRENT_NORMAL 0x0B02 372 | #define GL_CURRENT_TEXTURE_COORDS 0x0B03 373 | #define GL_CURRENT_RASTER_COLOR 0x0B04 374 | #define GL_CURRENT_RASTER_INDEX 0x0B05 375 | #define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 376 | #define GL_CURRENT_RASTER_POSITION 0x0B07 377 | #define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 378 | #define GL_CURRENT_RASTER_DISTANCE 0x0B09 379 | #define GL_POINT_SMOOTH 0x0B10 380 | #define GL_POINT_SIZE 0x0B11 381 | #define GL_POINT_SIZE_RANGE 0x0B12 382 | #define GL_POINT_SIZE_GRANULARITY 0x0B13 383 | #define GL_LINE_SMOOTH 0x0B20 384 | #define GL_LINE_WIDTH 0x0B21 385 | #define GL_LINE_WIDTH_RANGE 0x0B22 386 | #define GL_LINE_WIDTH_GRANULARITY 0x0B23 387 | #define GL_LINE_STIPPLE 0x0B24 388 | #define GL_LINE_STIPPLE_PATTERN 0x0B25 389 | #define GL_LINE_STIPPLE_REPEAT 0x0B26 390 | #define GL_LIST_MODE 0x0B30 391 | #define GL_MAX_LIST_NESTING 0x0B31 392 | #define GL_LIST_BASE 0x0B32 393 | #define GL_LIST_INDEX 0x0B33 394 | #define GL_POLYGON_MODE 0x0B40 395 | #define GL_POLYGON_SMOOTH 0x0B41 396 | #define GL_POLYGON_STIPPLE 0x0B42 397 | #define GL_EDGE_FLAG 0x0B43 398 | #define GL_CULL_FACE 0x0B44 399 | #define GL_CULL_FACE_MODE 0x0B45 400 | #define GL_FRONT_FACE 0x0B46 401 | #define GL_LIGHTING 0x0B50 402 | #define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 403 | #define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 404 | #define GL_LIGHT_MODEL_AMBIENT 0x0B53 405 | #define GL_SHADE_MODEL 0x0B54 406 | #define GL_COLOR_MATERIAL_FACE 0x0B55 407 | #define GL_COLOR_MATERIAL_PARAMETER 0x0B56 408 | #define GL_COLOR_MATERIAL 0x0B57 409 | #define GL_FOG 0x0B60 410 | #define GL_FOG_INDEX 0x0B61 411 | #define GL_FOG_DENSITY 0x0B62 412 | #define GL_FOG_START 0x0B63 413 | #define GL_FOG_END 0x0B64 414 | #define GL_FOG_MODE 0x0B65 415 | #define GL_FOG_COLOR 0x0B66 416 | #define GL_DEPTH_RANGE 0x0B70 417 | #define GL_DEPTH_TEST 0x0B71 418 | #define GL_DEPTH_WRITEMASK 0x0B72 419 | #define GL_DEPTH_CLEAR_VALUE 0x0B73 420 | #define GL_DEPTH_FUNC 0x0B74 421 | #define GL_ACCUM_CLEAR_VALUE 0x0B80 422 | #define GL_STENCIL_TEST 0x0B90 423 | #define GL_STENCIL_CLEAR_VALUE 0x0B91 424 | #define GL_STENCIL_FUNC 0x0B92 425 | #define GL_STENCIL_VALUE_MASK 0x0B93 426 | #define GL_STENCIL_FAIL 0x0B94 427 | #define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 428 | #define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 429 | #define GL_STENCIL_REF 0x0B97 430 | #define GL_STENCIL_WRITEMASK 0x0B98 431 | #define GL_MATRIX_MODE 0x0BA0 432 | #define GL_NORMALIZE 0x0BA1 433 | #define GL_VIEWPORT 0x0BA2 434 | #define GL_MODELVIEW_STACK_DEPTH 0x0BA3 435 | #define GL_PROJECTION_STACK_DEPTH 0x0BA4 436 | #define GL_TEXTURE_STACK_DEPTH 0x0BA5 437 | #define GL_MODELVIEW_MATRIX 0x0BA6 438 | #define GL_PROJECTION_MATRIX 0x0BA7 439 | #define GL_TEXTURE_MATRIX 0x0BA8 440 | #define GL_ATTRIB_STACK_DEPTH 0x0BB0 441 | #define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 442 | #define GL_ALPHA_TEST 0x0BC0 443 | #define GL_ALPHA_TEST_FUNC 0x0BC1 444 | #define GL_ALPHA_TEST_REF 0x0BC2 445 | #define GL_DITHER 0x0BD0 446 | #define GL_BLEND_DST 0x0BE0 447 | #define GL_BLEND_SRC 0x0BE1 448 | #define GL_BLEND 0x0BE2 449 | #define GL_LOGIC_OP_MODE 0x0BF0 450 | #define GL_INDEX_LOGIC_OP 0x0BF1 451 | #define GL_COLOR_LOGIC_OP 0x0BF2 452 | #define GL_AUX_BUFFERS 0x0C00 453 | #define GL_DRAW_BUFFER 0x0C01 454 | #define GL_READ_BUFFER 0x0C02 455 | #define GL_SCISSOR_BOX 0x0C10 456 | #define GL_SCISSOR_TEST 0x0C11 457 | #define GL_INDEX_CLEAR_VALUE 0x0C20 458 | #define GL_INDEX_WRITEMASK 0x0C21 459 | #define GL_COLOR_CLEAR_VALUE 0x0C22 460 | #define GL_COLOR_WRITEMASK 0x0C23 461 | #define GL_INDEX_MODE 0x0C30 462 | #define GL_RGBA_MODE 0x0C31 463 | #define GL_DOUBLEBUFFER 0x0C32 464 | #define GL_STEREO 0x0C33 465 | #define GL_RENDER_MODE 0x0C40 466 | #define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 467 | #define GL_POINT_SMOOTH_HINT 0x0C51 468 | #define GL_LINE_SMOOTH_HINT 0x0C52 469 | #define GL_POLYGON_SMOOTH_HINT 0x0C53 470 | #define GL_FOG_HINT 0x0C54 471 | #define GL_TEXTURE_GEN_S 0x0C60 472 | #define GL_TEXTURE_GEN_T 0x0C61 473 | #define GL_TEXTURE_GEN_R 0x0C62 474 | #define GL_TEXTURE_GEN_Q 0x0C63 475 | #define GL_PIXEL_MAP_I_TO_I 0x0C70 476 | #define GL_PIXEL_MAP_S_TO_S 0x0C71 477 | #define GL_PIXEL_MAP_I_TO_R 0x0C72 478 | #define GL_PIXEL_MAP_I_TO_G 0x0C73 479 | #define GL_PIXEL_MAP_I_TO_B 0x0C74 480 | #define GL_PIXEL_MAP_I_TO_A 0x0C75 481 | #define GL_PIXEL_MAP_R_TO_R 0x0C76 482 | #define GL_PIXEL_MAP_G_TO_G 0x0C77 483 | #define GL_PIXEL_MAP_B_TO_B 0x0C78 484 | #define GL_PIXEL_MAP_A_TO_A 0x0C79 485 | #define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 486 | #define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 487 | #define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 488 | #define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 489 | #define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 490 | #define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 491 | #define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 492 | #define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 493 | #define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 494 | #define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 495 | #define GL_UNPACK_SWAP_BYTES 0x0CF0 496 | #define GL_UNPACK_LSB_FIRST 0x0CF1 497 | #define GL_UNPACK_ROW_LENGTH 0x0CF2 498 | #define GL_UNPACK_SKIP_ROWS 0x0CF3 499 | #define GL_UNPACK_SKIP_PIXELS 0x0CF4 500 | #define GL_UNPACK_ALIGNMENT 0x0CF5 501 | #define GL_PACK_SWAP_BYTES 0x0D00 502 | #define GL_PACK_LSB_FIRST 0x0D01 503 | #define GL_PACK_ROW_LENGTH 0x0D02 504 | #define GL_PACK_SKIP_ROWS 0x0D03 505 | #define GL_PACK_SKIP_PIXELS 0x0D04 506 | #define GL_PACK_ALIGNMENT 0x0D05 507 | #define GL_MAP_COLOR 0x0D10 508 | #define GL_MAP_STENCIL 0x0D11 509 | #define GL_INDEX_SHIFT 0x0D12 510 | #define GL_INDEX_OFFSET 0x0D13 511 | #define GL_RED_SCALE 0x0D14 512 | #define GL_RED_BIAS 0x0D15 513 | #define GL_ZOOM_X 0x0D16 514 | #define GL_ZOOM_Y 0x0D17 515 | #define GL_GREEN_SCALE 0x0D18 516 | #define GL_GREEN_BIAS 0x0D19 517 | #define GL_BLUE_SCALE 0x0D1A 518 | #define GL_BLUE_BIAS 0x0D1B 519 | #define GL_ALPHA_SCALE 0x0D1C 520 | #define GL_ALPHA_BIAS 0x0D1D 521 | #define GL_DEPTH_SCALE 0x0D1E 522 | #define GL_DEPTH_BIAS 0x0D1F 523 | #define GL_MAX_EVAL_ORDER 0x0D30 524 | #define GL_MAX_LIGHTS 0x0D31 525 | #define GL_MAX_CLIP_PLANES 0x0D32 526 | #define GL_MAX_TEXTURE_SIZE 0x0D33 527 | #define GL_MAX_PIXEL_MAP_TABLE 0x0D34 528 | #define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 529 | #define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 530 | #define GL_MAX_NAME_STACK_DEPTH 0x0D37 531 | #define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 532 | #define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 533 | #define GL_MAX_VIEWPORT_DIMS 0x0D3A 534 | #define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B 535 | #define GL_SUBPIXEL_BITS 0x0D50 536 | #define GL_INDEX_BITS 0x0D51 537 | #define GL_RED_BITS 0x0D52 538 | #define GL_GREEN_BITS 0x0D53 539 | #define GL_BLUE_BITS 0x0D54 540 | #define GL_ALPHA_BITS 0x0D55 541 | #define GL_DEPTH_BITS 0x0D56 542 | #define GL_STENCIL_BITS 0x0D57 543 | #define GL_ACCUM_RED_BITS 0x0D58 544 | #define GL_ACCUM_GREEN_BITS 0x0D59 545 | #define GL_ACCUM_BLUE_BITS 0x0D5A 546 | #define GL_ACCUM_ALPHA_BITS 0x0D5B 547 | #define GL_NAME_STACK_DEPTH 0x0D70 548 | #define GL_AUTO_NORMAL 0x0D80 549 | #define GL_MAP1_COLOR_4 0x0D90 550 | #define GL_MAP1_INDEX 0x0D91 551 | #define GL_MAP1_NORMAL 0x0D92 552 | #define GL_MAP1_TEXTURE_COORD_1 0x0D93 553 | #define GL_MAP1_TEXTURE_COORD_2 0x0D94 554 | #define GL_MAP1_TEXTURE_COORD_3 0x0D95 555 | #define GL_MAP1_TEXTURE_COORD_4 0x0D96 556 | #define GL_MAP1_VERTEX_3 0x0D97 557 | #define GL_MAP1_VERTEX_4 0x0D98 558 | #define GL_MAP2_COLOR_4 0x0DB0 559 | #define GL_MAP2_INDEX 0x0DB1 560 | #define GL_MAP2_NORMAL 0x0DB2 561 | #define GL_MAP2_TEXTURE_COORD_1 0x0DB3 562 | #define GL_MAP2_TEXTURE_COORD_2 0x0DB4 563 | #define GL_MAP2_TEXTURE_COORD_3 0x0DB5 564 | #define GL_MAP2_TEXTURE_COORD_4 0x0DB6 565 | #define GL_MAP2_VERTEX_3 0x0DB7 566 | #define GL_MAP2_VERTEX_4 0x0DB8 567 | #define GL_MAP1_GRID_DOMAIN 0x0DD0 568 | #define GL_MAP1_GRID_SEGMENTS 0x0DD1 569 | #define GL_MAP2_GRID_DOMAIN 0x0DD2 570 | #define GL_MAP2_GRID_SEGMENTS 0x0DD3 571 | #define GL_TEXTURE_1D 0x0DE0 572 | #define GL_TEXTURE_2D 0x0DE1 573 | #define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 574 | #define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 575 | #define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 576 | #define GL_SELECTION_BUFFER_POINTER 0x0DF3 577 | #define GL_SELECTION_BUFFER_SIZE 0x0DF4 578 | /* GL_TEXTURE_BINDING_1D */ 579 | /* GL_TEXTURE_BINDING_2D */ 580 | /* GL_VERTEX_ARRAY */ 581 | /* GL_NORMAL_ARRAY */ 582 | /* GL_COLOR_ARRAY */ 583 | /* GL_INDEX_ARRAY */ 584 | /* GL_TEXTURE_COORD_ARRAY */ 585 | /* GL_EDGE_FLAG_ARRAY */ 586 | /* GL_VERTEX_ARRAY_SIZE */ 587 | /* GL_VERTEX_ARRAY_TYPE */ 588 | /* GL_VERTEX_ARRAY_STRIDE */ 589 | /* GL_NORMAL_ARRAY_TYPE */ 590 | /* GL_NORMAL_ARRAY_STRIDE */ 591 | /* GL_COLOR_ARRAY_SIZE */ 592 | /* GL_COLOR_ARRAY_TYPE */ 593 | /* GL_COLOR_ARRAY_STRIDE */ 594 | /* GL_INDEX_ARRAY_TYPE */ 595 | /* GL_INDEX_ARRAY_STRIDE */ 596 | /* GL_TEXTURE_COORD_ARRAY_SIZE */ 597 | /* GL_TEXTURE_COORD_ARRAY_TYPE */ 598 | /* GL_TEXTURE_COORD_ARRAY_STRIDE */ 599 | /* GL_EDGE_FLAG_ARRAY_STRIDE */ 600 | /* GL_POLYGON_OFFSET_FACTOR */ 601 | /* GL_POLYGON_OFFSET_UNITS */ 602 | 603 | /* GetTextureParameter */ 604 | /* GL_TEXTURE_MAG_FILTER */ 605 | /* GL_TEXTURE_MIN_FILTER */ 606 | /* GL_TEXTURE_WRAP_S */ 607 | /* GL_TEXTURE_WRAP_T */ 608 | #define GL_TEXTURE_WIDTH 0x1000 609 | #define GL_TEXTURE_HEIGHT 0x1001 610 | #define GL_TEXTURE_INTERNAL_FORMAT 0x1003 611 | #define GL_TEXTURE_BORDER_COLOR 0x1004 612 | #define GL_TEXTURE_BORDER 0x1005 613 | /* GL_TEXTURE_RED_SIZE */ 614 | /* GL_TEXTURE_GREEN_SIZE */ 615 | /* GL_TEXTURE_BLUE_SIZE */ 616 | /* GL_TEXTURE_ALPHA_SIZE */ 617 | /* GL_TEXTURE_LUMINANCE_SIZE */ 618 | /* GL_TEXTURE_INTENSITY_SIZE */ 619 | /* GL_TEXTURE_PRIORITY */ 620 | /* GL_TEXTURE_RESIDENT */ 621 | 622 | /* HintMode */ 623 | #define GL_DONT_CARE 0x1100 624 | #define GL_FASTEST 0x1101 625 | #define GL_NICEST 0x1102 626 | 627 | /* HintTarget */ 628 | /* GL_PERSPECTIVE_CORRECTION_HINT */ 629 | /* GL_POINT_SMOOTH_HINT */ 630 | /* GL_LINE_SMOOTH_HINT */ 631 | /* GL_POLYGON_SMOOTH_HINT */ 632 | /* GL_FOG_HINT */ 633 | /* GL_PHONG_HINT */ 634 | 635 | /* IndexPointerType */ 636 | /* GL_SHORT */ 637 | /* GL_INT */ 638 | /* GL_FLOAT */ 639 | /* GL_DOUBLE */ 640 | 641 | /* LightModelParameter */ 642 | /* GL_LIGHT_MODEL_AMBIENT */ 643 | /* GL_LIGHT_MODEL_LOCAL_VIEWER */ 644 | /* GL_LIGHT_MODEL_TWO_SIDE */ 645 | 646 | /* LightName */ 647 | #define GL_LIGHT0 0x4000 648 | #define GL_LIGHT1 0x4001 649 | #define GL_LIGHT2 0x4002 650 | #define GL_LIGHT3 0x4003 651 | #define GL_LIGHT4 0x4004 652 | #define GL_LIGHT5 0x4005 653 | #define GL_LIGHT6 0x4006 654 | #define GL_LIGHT7 0x4007 655 | 656 | /* LightParameter */ 657 | #define GL_AMBIENT 0x1200 658 | #define GL_DIFFUSE 0x1201 659 | #define GL_SPECULAR 0x1202 660 | #define GL_POSITION 0x1203 661 | #define GL_SPOT_DIRECTION 0x1204 662 | #define GL_SPOT_EXPONENT 0x1205 663 | #define GL_SPOT_CUTOFF 0x1206 664 | #define GL_CONSTANT_ATTENUATION 0x1207 665 | #define GL_LINEAR_ATTENUATION 0x1208 666 | #define GL_QUADRATIC_ATTENUATION 0x1209 667 | 668 | /* InterleavedArrays */ 669 | /* GL_V2F */ 670 | /* GL_V3F */ 671 | /* GL_C4UB_V2F */ 672 | /* GL_C4UB_V3F */ 673 | /* GL_C3F_V3F */ 674 | /* GL_N3F_V3F */ 675 | /* GL_C4F_N3F_V3F */ 676 | /* GL_T2F_V3F */ 677 | /* GL_T4F_V4F */ 678 | /* GL_T2F_C4UB_V3F */ 679 | /* GL_T2F_C3F_V3F */ 680 | /* GL_T2F_N3F_V3F */ 681 | /* GL_T2F_C4F_N3F_V3F */ 682 | /* GL_T4F_C4F_N3F_V4F */ 683 | 684 | /* ListMode */ 685 | #define GL_COMPILE 0x1300 686 | #define GL_COMPILE_AND_EXECUTE 0x1301 687 | 688 | /* ListNameType */ 689 | /* GL_BYTE */ 690 | /* GL_UNSIGNED_BYTE */ 691 | /* GL_SHORT */ 692 | /* GL_UNSIGNED_SHORT */ 693 | /* GL_INT */ 694 | /* GL_UNSIGNED_INT */ 695 | /* GL_FLOAT */ 696 | /* GL_2_BYTES */ 697 | /* GL_3_BYTES */ 698 | /* GL_4_BYTES */ 699 | 700 | /* LogicOp */ 701 | #define GL_CLEAR 0x1500 702 | #define GL_AND 0x1501 703 | #define GL_AND_REVERSE 0x1502 704 | #define GL_COPY 0x1503 705 | #define GL_AND_INVERTED 0x1504 706 | #define GL_NOOP 0x1505 707 | #define GL_XOR 0x1506 708 | #define GL_OR 0x1507 709 | #define GL_NOR 0x1508 710 | #define GL_EQUIV 0x1509 711 | #define GL_INVERT 0x150A 712 | #define GL_OR_REVERSE 0x150B 713 | #define GL_COPY_INVERTED 0x150C 714 | #define GL_OR_INVERTED 0x150D 715 | #define GL_NAND 0x150E 716 | #define GL_SET 0x150F 717 | 718 | /* MapTarget */ 719 | /* GL_MAP1_COLOR_4 */ 720 | /* GL_MAP1_INDEX */ 721 | /* GL_MAP1_NORMAL */ 722 | /* GL_MAP1_TEXTURE_COORD_1 */ 723 | /* GL_MAP1_TEXTURE_COORD_2 */ 724 | /* GL_MAP1_TEXTURE_COORD_3 */ 725 | /* GL_MAP1_TEXTURE_COORD_4 */ 726 | /* GL_MAP1_VERTEX_3 */ 727 | /* GL_MAP1_VERTEX_4 */ 728 | /* GL_MAP2_COLOR_4 */ 729 | /* GL_MAP2_INDEX */ 730 | /* GL_MAP2_NORMAL */ 731 | /* GL_MAP2_TEXTURE_COORD_1 */ 732 | /* GL_MAP2_TEXTURE_COORD_2 */ 733 | /* GL_MAP2_TEXTURE_COORD_3 */ 734 | /* GL_MAP2_TEXTURE_COORD_4 */ 735 | /* GL_MAP2_VERTEX_3 */ 736 | /* GL_MAP2_VERTEX_4 */ 737 | 738 | /* MaterialFace */ 739 | /* GL_FRONT */ 740 | /* GL_BACK */ 741 | /* GL_FRONT_AND_BACK */ 742 | 743 | /* MaterialParameter */ 744 | #define GL_EMISSION 0x1600 745 | #define GL_SHININESS 0x1601 746 | #define GL_AMBIENT_AND_DIFFUSE 0x1602 747 | #define GL_COLOR_INDEXES 0x1603 748 | /* GL_AMBIENT */ 749 | /* GL_DIFFUSE */ 750 | /* GL_SPECULAR */ 751 | 752 | /* MatrixMode */ 753 | #define GL_MODELVIEW 0x1700 754 | #define GL_PROJECTION 0x1701 755 | #define GL_TEXTURE 0x1702 756 | 757 | /* MeshMode1 */ 758 | /* GL_POINT */ 759 | /* GL_LINE */ 760 | 761 | /* MeshMode2 */ 762 | /* GL_POINT */ 763 | /* GL_LINE */ 764 | /* GL_FILL */ 765 | 766 | /* NormalPointerType */ 767 | /* GL_BYTE */ 768 | /* GL_SHORT */ 769 | /* GL_INT */ 770 | /* GL_FLOAT */ 771 | /* GL_DOUBLE */ 772 | 773 | /* PixelCopyType */ 774 | #define GL_COLOR 0x1800 775 | #define GL_DEPTH 0x1801 776 | #define GL_STENCIL 0x1802 777 | 778 | /* PixelFormat */ 779 | #define GL_COLOR_INDEX 0x1900 780 | #define GL_STENCIL_INDEX 0x1901 781 | #define GL_DEPTH_COMPONENT 0x1902 782 | #define GL_RED 0x1903 783 | #define GL_GREEN 0x1904 784 | #define GL_BLUE 0x1905 785 | #define GL_ALPHA 0x1906 786 | #define GL_RGB 0x1907 787 | #define GL_RGBA 0x1908 788 | #define GL_LUMINANCE 0x1909 789 | #define GL_LUMINANCE_ALPHA 0x190A 790 | 791 | /* PixelMap */ 792 | /* GL_PIXEL_MAP_I_TO_I */ 793 | /* GL_PIXEL_MAP_S_TO_S */ 794 | /* GL_PIXEL_MAP_I_TO_R */ 795 | /* GL_PIXEL_MAP_I_TO_G */ 796 | /* GL_PIXEL_MAP_I_TO_B */ 797 | /* GL_PIXEL_MAP_I_TO_A */ 798 | /* GL_PIXEL_MAP_R_TO_R */ 799 | /* GL_PIXEL_MAP_G_TO_G */ 800 | /* GL_PIXEL_MAP_B_TO_B */ 801 | /* GL_PIXEL_MAP_A_TO_A */ 802 | 803 | /* PixelStore */ 804 | /* GL_UNPACK_SWAP_BYTES */ 805 | /* GL_UNPACK_LSB_FIRST */ 806 | /* GL_UNPACK_ROW_LENGTH */ 807 | /* GL_UNPACK_SKIP_ROWS */ 808 | /* GL_UNPACK_SKIP_PIXELS */ 809 | /* GL_UNPACK_ALIGNMENT */ 810 | /* GL_PACK_SWAP_BYTES */ 811 | /* GL_PACK_LSB_FIRST */ 812 | /* GL_PACK_ROW_LENGTH */ 813 | /* GL_PACK_SKIP_ROWS */ 814 | /* GL_PACK_SKIP_PIXELS */ 815 | /* GL_PACK_ALIGNMENT */ 816 | 817 | /* PixelTransfer */ 818 | /* GL_MAP_COLOR */ 819 | /* GL_MAP_STENCIL */ 820 | /* GL_INDEX_SHIFT */ 821 | /* GL_INDEX_OFFSET */ 822 | /* GL_RED_SCALE */ 823 | /* GL_RED_BIAS */ 824 | /* GL_GREEN_SCALE */ 825 | /* GL_GREEN_BIAS */ 826 | /* GL_BLUE_SCALE */ 827 | /* GL_BLUE_BIAS */ 828 | /* GL_ALPHA_SCALE */ 829 | /* GL_ALPHA_BIAS */ 830 | /* GL_DEPTH_SCALE */ 831 | /* GL_DEPTH_BIAS */ 832 | 833 | /* PixelType */ 834 | #define GL_BITMAP 0x1A00 835 | /* GL_BYTE */ 836 | /* GL_UNSIGNED_BYTE */ 837 | /* GL_SHORT */ 838 | /* GL_UNSIGNED_SHORT */ 839 | /* GL_INT */ 840 | /* GL_UNSIGNED_INT */ 841 | /* GL_FLOAT */ 842 | 843 | /* PolygonMode */ 844 | #define GL_POINT 0x1B00 845 | #define GL_LINE 0x1B01 846 | #define GL_FILL 0x1B02 847 | 848 | /* ReadBufferMode */ 849 | /* GL_FRONT_LEFT */ 850 | /* GL_FRONT_RIGHT */ 851 | /* GL_BACK_LEFT */ 852 | /* GL_BACK_RIGHT */ 853 | /* GL_FRONT */ 854 | /* GL_BACK */ 855 | /* GL_LEFT */ 856 | /* GL_RIGHT */ 857 | /* GL_AUX0 */ 858 | /* GL_AUX1 */ 859 | /* GL_AUX2 */ 860 | /* GL_AUX3 */ 861 | 862 | /* RenderingMode */ 863 | #define GL_RENDER 0x1C00 864 | #define GL_FEEDBACK 0x1C01 865 | #define GL_SELECT 0x1C02 866 | 867 | /* ShadingModel */ 868 | #define GL_FLAT 0x1D00 869 | #define GL_SMOOTH 0x1D01 870 | 871 | 872 | /* StencilFunction */ 873 | /* GL_NEVER */ 874 | /* GL_LESS */ 875 | /* GL_EQUAL */ 876 | /* GL_LEQUAL */ 877 | /* GL_GREATER */ 878 | /* GL_NOTEQUAL */ 879 | /* GL_GEQUAL */ 880 | /* GL_ALWAYS */ 881 | 882 | /* StencilOp */ 883 | /* GL_ZERO */ 884 | #define GL_KEEP 0x1E00 885 | #define GL_REPLACE 0x1E01 886 | #define GL_INCR 0x1E02 887 | #define GL_DECR 0x1E03 888 | /* GL_INVERT */ 889 | 890 | /* StringName */ 891 | #define GL_VENDOR 0x1F00 892 | #define GL_RENDERER 0x1F01 893 | #define GL_VERSION 0x1F02 894 | #define GL_EXTENSIONS 0x1F03 895 | 896 | /* TextureCoordName */ 897 | #define GL_S 0x2000 898 | #define GL_T 0x2001 899 | #define GL_R 0x2002 900 | #define GL_Q 0x2003 901 | 902 | /* TexCoordPointerType */ 903 | /* GL_SHORT */ 904 | /* GL_INT */ 905 | /* GL_FLOAT */ 906 | /* GL_DOUBLE */ 907 | 908 | /* TextureEnvMode */ 909 | #define GL_MODULATE 0x2100 910 | #define GL_DECAL 0x2101 911 | /* GL_BLEND */ 912 | /* GL_REPLACE */ 913 | 914 | /* TextureEnvParameter */ 915 | #define GL_TEXTURE_ENV_MODE 0x2200 916 | #define GL_TEXTURE_ENV_COLOR 0x2201 917 | 918 | /* TextureEnvTarget */ 919 | #define GL_TEXTURE_ENV 0x2300 920 | 921 | /* TextureGenMode */ 922 | #define GL_EYE_LINEAR 0x2400 923 | #define GL_OBJECT_LINEAR 0x2401 924 | #define GL_SPHERE_MAP 0x2402 925 | 926 | /* TextureGenParameter */ 927 | #define GL_TEXTURE_GEN_MODE 0x2500 928 | #define GL_OBJECT_PLANE 0x2501 929 | #define GL_EYE_PLANE 0x2502 930 | 931 | /* TextureMagFilter */ 932 | #define GL_NEAREST 0x2600 933 | #define GL_LINEAR 0x2601 934 | 935 | /* TextureMinFilter */ 936 | /* GL_NEAREST */ 937 | /* GL_LINEAR */ 938 | #define GL_NEAREST_MIPMAP_NEAREST 0x2700 939 | #define GL_LINEAR_MIPMAP_NEAREST 0x2701 940 | #define GL_NEAREST_MIPMAP_LINEAR 0x2702 941 | #define GL_LINEAR_MIPMAP_LINEAR 0x2703 942 | 943 | /* TextureParameterName */ 944 | #define GL_TEXTURE_MAG_FILTER 0x2800 945 | #define GL_TEXTURE_MIN_FILTER 0x2801 946 | #define GL_TEXTURE_WRAP_S 0x2802 947 | #define GL_TEXTURE_WRAP_T 0x2803 948 | /* GL_TEXTURE_BORDER_COLOR */ 949 | /* GL_TEXTURE_PRIORITY */ 950 | 951 | /* TextureTarget */ 952 | /* GL_TEXTURE_1D */ 953 | /* GL_TEXTURE_2D */ 954 | /* GL_PROXY_TEXTURE_1D */ 955 | /* GL_PROXY_TEXTURE_2D */ 956 | 957 | /* TextureWrapMode */ 958 | #define GL_CLAMP 0x2900 959 | #define GL_REPEAT 0x2901 960 | 961 | /* VertexPointerType */ 962 | /* GL_SHORT */ 963 | /* GL_INT */ 964 | /* GL_FLOAT */ 965 | /* GL_DOUBLE */ 966 | 967 | /* ClientAttribMask */ 968 | #define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 969 | #define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 970 | #define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff 971 | 972 | /* polygon_offset */ 973 | #define GL_POLYGON_OFFSET_FACTOR 0x8038 974 | #define GL_POLYGON_OFFSET_UNITS 0x2A00 975 | #define GL_POLYGON_OFFSET_POINT 0x2A01 976 | #define GL_POLYGON_OFFSET_LINE 0x2A02 977 | #define GL_POLYGON_OFFSET_FILL 0x8037 978 | 979 | /* texture */ 980 | #define GL_ALPHA4 0x803B 981 | #define GL_ALPHA8 0x803C 982 | #define GL_ALPHA12 0x803D 983 | #define GL_ALPHA16 0x803E 984 | #define GL_LUMINANCE4 0x803F 985 | #define GL_LUMINANCE8 0x8040 986 | #define GL_LUMINANCE12 0x8041 987 | #define GL_LUMINANCE16 0x8042 988 | #define GL_LUMINANCE4_ALPHA4 0x8043 989 | #define GL_LUMINANCE6_ALPHA2 0x8044 990 | #define GL_LUMINANCE8_ALPHA8 0x8045 991 | #define GL_LUMINANCE12_ALPHA4 0x8046 992 | #define GL_LUMINANCE12_ALPHA12 0x8047 993 | #define GL_LUMINANCE16_ALPHA16 0x8048 994 | #define GL_INTENSITY 0x8049 995 | #define GL_INTENSITY4 0x804A 996 | #define GL_INTENSITY8 0x804B 997 | #define GL_INTENSITY12 0x804C 998 | #define GL_INTENSITY16 0x804D 999 | #define GL_R3_G3_B2 0x2A10 1000 | #define GL_RGB4 0x804F 1001 | #define GL_RGB5 0x8050 1002 | #define GL_RGB8 0x8051 1003 | #define GL_RGB10 0x8052 1004 | #define GL_RGB12 0x8053 1005 | #define GL_RGB16 0x8054 1006 | #define GL_RGBA2 0x8055 1007 | #define GL_RGBA4 0x8056 1008 | #define GL_RGB5_A1 0x8057 1009 | #define GL_RGBA8 0x8058 1010 | #define GL_RGB10_A2 0x8059 1011 | #define GL_RGBA12 0x805A 1012 | #define GL_RGBA16 0x805B 1013 | #define GL_TEXTURE_RED_SIZE 0x805C 1014 | #define GL_TEXTURE_GREEN_SIZE 0x805D 1015 | #define GL_TEXTURE_BLUE_SIZE 0x805E 1016 | #define GL_TEXTURE_ALPHA_SIZE 0x805F 1017 | #define GL_TEXTURE_LUMINANCE_SIZE 0x8060 1018 | #define GL_TEXTURE_INTENSITY_SIZE 0x8061 1019 | #define GL_PROXY_TEXTURE_1D 0x8063 1020 | #define GL_PROXY_TEXTURE_2D 0x8064 1021 | 1022 | /* texture_object */ 1023 | #define GL_TEXTURE_PRIORITY 0x8066 1024 | #define GL_TEXTURE_RESIDENT 0x8067 1025 | #define GL_TEXTURE_BINDING_1D 0x8068 1026 | #define GL_TEXTURE_BINDING_2D 0x8069 1027 | 1028 | /* vertex_array */ 1029 | #define GL_VERTEX_ARRAY 0x8074 1030 | #define GL_NORMAL_ARRAY 0x8075 1031 | #define GL_COLOR_ARRAY 0x8076 1032 | #define GL_INDEX_ARRAY 0x8077 1033 | #define GL_TEXTURE_COORD_ARRAY 0x8078 1034 | #define GL_EDGE_FLAG_ARRAY 0x8079 1035 | #define GL_VERTEX_ARRAY_SIZE 0x807A 1036 | #define GL_VERTEX_ARRAY_TYPE 0x807B 1037 | #define GL_VERTEX_ARRAY_STRIDE 0x807C 1038 | #define GL_NORMAL_ARRAY_TYPE 0x807E 1039 | #define GL_NORMAL_ARRAY_STRIDE 0x807F 1040 | #define GL_COLOR_ARRAY_SIZE 0x8081 1041 | #define GL_COLOR_ARRAY_TYPE 0x8082 1042 | #define GL_COLOR_ARRAY_STRIDE 0x8083 1043 | #define GL_INDEX_ARRAY_TYPE 0x8085 1044 | #define GL_INDEX_ARRAY_STRIDE 0x8086 1045 | #define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 1046 | #define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 1047 | #define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A 1048 | #define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C 1049 | #define GL_VERTEX_ARRAY_POINTER 0x808E 1050 | #define GL_NORMAL_ARRAY_POINTER 0x808F 1051 | #define GL_COLOR_ARRAY_POINTER 0x8090 1052 | #define GL_INDEX_ARRAY_POINTER 0x8091 1053 | #define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 1054 | #define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 1055 | #define GL_V2F 0x2A20 1056 | #define GL_V3F 0x2A21 1057 | #define GL_C4UB_V2F 0x2A22 1058 | #define GL_C4UB_V3F 0x2A23 1059 | #define GL_C3F_V3F 0x2A24 1060 | #define GL_N3F_V3F 0x2A25 1061 | #define GL_C4F_N3F_V3F 0x2A26 1062 | #define GL_T2F_V3F 0x2A27 1063 | #define GL_T4F_V4F 0x2A28 1064 | #define GL_T2F_C4UB_V3F 0x2A29 1065 | #define GL_T2F_C3F_V3F 0x2A2A 1066 | #define GL_T2F_N3F_V3F 0x2A2B 1067 | #define GL_T2F_C4F_N3F_V3F 0x2A2C 1068 | #define GL_T4F_C4F_N3F_V4F 0x2A2D 1069 | 1070 | /* Extensions */ 1071 | #define GL_EXT_vertex_array 1 1072 | #define GL_EXT_bgra 1 1073 | #define GL_EXT_paletted_texture 1 1074 | #define GL_WIN_swap_hint 1 1075 | #define GL_WIN_draw_range_elements 1 1076 | // #define GL_WIN_phong_shading 1 1077 | // #define GL_WIN_specular_fog 1 1078 | 1079 | /* EXT_vertex_array */ 1080 | #define GL_VERTEX_ARRAY_EXT 0x8074 1081 | #define GL_NORMAL_ARRAY_EXT 0x8075 1082 | #define GL_COLOR_ARRAY_EXT 0x8076 1083 | #define GL_INDEX_ARRAY_EXT 0x8077 1084 | #define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 1085 | #define GL_EDGE_FLAG_ARRAY_EXT 0x8079 1086 | #define GL_VERTEX_ARRAY_SIZE_EXT 0x807A 1087 | #define GL_VERTEX_ARRAY_TYPE_EXT 0x807B 1088 | #define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C 1089 | #define GL_VERTEX_ARRAY_COUNT_EXT 0x807D 1090 | #define GL_NORMAL_ARRAY_TYPE_EXT 0x807E 1091 | #define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F 1092 | #define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 1093 | #define GL_COLOR_ARRAY_SIZE_EXT 0x8081 1094 | #define GL_COLOR_ARRAY_TYPE_EXT 0x8082 1095 | #define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 1096 | #define GL_COLOR_ARRAY_COUNT_EXT 0x8084 1097 | #define GL_INDEX_ARRAY_TYPE_EXT 0x8085 1098 | #define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 1099 | #define GL_INDEX_ARRAY_COUNT_EXT 0x8087 1100 | #define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 1101 | #define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 1102 | #define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A 1103 | #define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B 1104 | #define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C 1105 | #define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D 1106 | #define GL_VERTEX_ARRAY_POINTER_EXT 0x808E 1107 | #define GL_NORMAL_ARRAY_POINTER_EXT 0x808F 1108 | #define GL_COLOR_ARRAY_POINTER_EXT 0x8090 1109 | #define GL_INDEX_ARRAY_POINTER_EXT 0x8091 1110 | #define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 1111 | #define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 1112 | #define GL_DOUBLE_EXT GL_DOUBLE 1113 | 1114 | /* EXT_bgra */ 1115 | #define GL_BGR_EXT 0x80E0 1116 | #define GL_BGRA_EXT 0x80E1 1117 | 1118 | /* EXT_paletted_texture */ 1119 | 1120 | /* These must match the GL_COLOR_TABLE_*_SGI enumerants */ 1121 | #define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 1122 | #define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 1123 | #define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA 1124 | #define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB 1125 | #define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC 1126 | #define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD 1127 | #define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE 1128 | #define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF 1129 | 1130 | #define GL_COLOR_INDEX1_EXT 0x80E2 1131 | #define GL_COLOR_INDEX2_EXT 0x80E3 1132 | #define GL_COLOR_INDEX4_EXT 0x80E4 1133 | #define GL_COLOR_INDEX8_EXT 0x80E5 1134 | #define GL_COLOR_INDEX12_EXT 0x80E6 1135 | #define GL_COLOR_INDEX16_EXT 0x80E7 1136 | 1137 | /* WIN_draw_range_elements */ 1138 | #define GL_MAX_ELEMENTS_VERTICES_WIN 0x80E8 1139 | #define GL_MAX_ELEMENTS_INDICES_WIN 0x80E9 1140 | 1141 | /* WIN_phong_shading */ 1142 | #define GL_PHONG_WIN 0x80EA 1143 | #define GL_PHONG_HINT_WIN 0x80EB 1144 | 1145 | /* WIN_specular_fog */ 1146 | #define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC 1147 | 1148 | /* For compatibility with OpenGL v1.0 */ 1149 | #define GL_LOGIC_OP GL_INDEX_LOGIC_OP 1150 | #define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT 1151 | 1152 | /* 1153 | * OpenGL 1.3 1154 | */ 1155 | 1156 | /* multitexture */ 1157 | #define GL_TEXTURE0 0x84C0 1158 | #define GL_TEXTURE1 0x84C1 1159 | #define GL_TEXTURE2 0x84C2 1160 | #define GL_TEXTURE3 0x84C3 1161 | #define GL_TEXTURE4 0x84C4 1162 | #define GL_TEXTURE5 0x84C5 1163 | #define GL_TEXTURE6 0x84C6 1164 | #define GL_TEXTURE7 0x84C7 1165 | 1166 | /*************************************************************/ 1167 | 1168 | void glAccum (GLenum op, GLfloat value); 1169 | void glAlphaFunc (GLenum func, GLclampf ref); 1170 | GLboolean glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences); 1171 | void glArrayElement (GLint i); 1172 | void glActiveTexture( GLenum texture); 1173 | void glBegin (GLenum mode); 1174 | void glBindTexture (GLenum target, GLuint texture); 1175 | void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); 1176 | void glBlendFunc (GLenum sfactor, GLenum dfactor); 1177 | void glCallList (GLuint list); 1178 | void glCallLists (GLsizei n, GLenum type, const GLvoid *lists); 1179 | void glClear (GLbitfield mask); 1180 | void glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); 1181 | void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); 1182 | void glClearDepth (GLclampd depth); 1183 | void glClearIndex (GLfloat c); 1184 | void glClearStencil (GLint s); 1185 | void glClipPlane (GLenum plane, const GLdouble *equation); 1186 | void glColor3b (GLbyte red, GLbyte green, GLbyte blue); 1187 | void glColor3bv (const GLbyte *v); 1188 | void glColor3d (GLdouble red, GLdouble green, GLdouble blue); 1189 | void glColor3dv (const GLdouble *v); 1190 | void glColor3f (GLfloat red, GLfloat green, GLfloat blue); 1191 | void glColor3fv (const GLfloat *v); 1192 | void glColor3i (GLint red, GLint green, GLint blue); 1193 | void glColor3iv (const GLint *v); 1194 | void glColor3s (GLshort red, GLshort green, GLshort blue); 1195 | void glColor3sv (const GLshort *v); 1196 | void glColor3ub (GLubyte red, GLubyte green, GLubyte blue); 1197 | void glColor3ubv (const GLubyte *v); 1198 | void glColor3ui (GLuint red, GLuint green, GLuint blue); 1199 | void glColor3uiv (const GLuint *v); 1200 | void glColor3us (GLushort red, GLushort green, GLushort blue); 1201 | void glColor3usv (const GLushort *v); 1202 | void glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); 1203 | void glColor4bv (const GLbyte *v); 1204 | void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); 1205 | void glColor4dv (const GLdouble *v); 1206 | void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); 1207 | void glColor4fv (const GLfloat *v); 1208 | void glColor4i (GLint red, GLint green, GLint blue, GLint alpha); 1209 | void glColor4iv (const GLint *v); 1210 | void glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); 1211 | void glColor4sv (const GLshort *v); 1212 | void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); 1213 | void glColor4ubv (const GLubyte *v); 1214 | void glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); 1215 | void glColor4uiv (const GLuint *v); 1216 | void glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); 1217 | void glColor4usv (const GLushort *v); 1218 | void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); 1219 | void glColorMaterial (GLenum face, GLenum mode); 1220 | void glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); 1221 | void glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); 1222 | void glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); 1223 | void glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); 1224 | void glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); 1225 | void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); 1226 | void glCullFace (GLenum mode); 1227 | void glDeleteLists (GLuint list, GLsizei range); 1228 | void glDeleteTextures (GLsizei n, const GLuint *textures); 1229 | void glDepthFunc (GLenum func); 1230 | void glDepthMask (GLboolean flag); 1231 | void glDepthRange (GLclampd zNear, GLclampd zFar); 1232 | void glDisable (GLenum cap); 1233 | void glDisableClientState (GLenum array); 1234 | void glDrawArrays (GLenum mode, GLint first, GLsizei count); 1235 | void glDrawBuffer (GLenum mode); 1236 | void glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); 1237 | void glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); 1238 | void glEdgeFlag (GLboolean flag); 1239 | void glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer); 1240 | void glEdgeFlagv (const GLboolean *flag); 1241 | void glEnable (GLenum cap); 1242 | void glEnableClientState (GLenum array); 1243 | void glEnd (void); 1244 | void glEndList (void); 1245 | void glEvalCoord1d (GLdouble u); 1246 | void glEvalCoord1dv (const GLdouble *u); 1247 | void glEvalCoord1f (GLfloat u); 1248 | void glEvalCoord1fv (const GLfloat *u); 1249 | void glEvalCoord2d (GLdouble u, GLdouble v); 1250 | void glEvalCoord2dv (const GLdouble *u); 1251 | void glEvalCoord2f (GLfloat u, GLfloat v); 1252 | void glEvalCoord2fv (const GLfloat *u); 1253 | void glEvalMesh1 (GLenum mode, GLint i1, GLint i2); 1254 | void glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); 1255 | void glEvalPoint1 (GLint i); 1256 | void glEvalPoint2 (GLint i, GLint j); 1257 | void glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); 1258 | void glFinish (void); 1259 | void glFlush (void); 1260 | void glFogf (GLenum pname, GLfloat param); 1261 | void glFogfv (GLenum pname, const GLfloat *params); 1262 | void glFogi (GLenum pname, GLint param); 1263 | void glFogiv (GLenum pname, const GLint *params); 1264 | void glFrontFace (GLenum mode); 1265 | void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); 1266 | GLuint glGenLists (GLsizei range); 1267 | void glGenTextures (GLsizei n, GLuint *textures); 1268 | void glGetBooleanv (GLenum pname, GLboolean *params); 1269 | void glGetClipPlane (GLenum plane, GLdouble *equation); 1270 | void glGetDoublev (GLenum pname, GLdouble *params); 1271 | GLenum glGetError (void); 1272 | void glGetFloatv (GLenum pname, GLfloat *params); 1273 | void glGetIntegerv (GLenum pname, GLint *params); 1274 | void glGetLightfv (GLenum light, GLenum pname, GLfloat *params); 1275 | void glGetLightiv (GLenum light, GLenum pname, GLint *params); 1276 | void glGetMapdv (GLenum target, GLenum query, GLdouble *v); 1277 | void glGetMapfv (GLenum target, GLenum query, GLfloat *v); 1278 | void glGetMapiv (GLenum target, GLenum query, GLint *v); 1279 | void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); 1280 | void glGetMaterialiv (GLenum face, GLenum pname, GLint *params); 1281 | void glGetPixelMapfv (GLenum map, GLfloat *values); 1282 | void glGetPixelMapuiv (GLenum map, GLuint *values); 1283 | void glGetPixelMapusv (GLenum map, GLushort *values); 1284 | void glGetPointerv (GLenum pname, GLvoid* *params); 1285 | void glGetPolygonStipple (GLubyte *mask); 1286 | const GLubyte * glGetString (GLenum name); 1287 | void glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); 1288 | void glGetTexEnviv (GLenum target, GLenum pname, GLint *params); 1289 | void glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); 1290 | void glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); 1291 | void glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); 1292 | void glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); 1293 | void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); 1294 | void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); 1295 | void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); 1296 | void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); 1297 | void glHint (GLenum target, GLenum mode); 1298 | void glIndexMask (GLuint mask); 1299 | void glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer); 1300 | void glIndexd (GLdouble c); 1301 | void glIndexdv (const GLdouble *c); 1302 | void glIndexf (GLfloat c); 1303 | void glIndexfv (const GLfloat *c); 1304 | void glIndexi (GLint c); 1305 | void glIndexiv (const GLint *c); 1306 | void glIndexs (GLshort c); 1307 | void glIndexsv (const GLshort *c); 1308 | void glIndexub (GLubyte c); 1309 | void glIndexubv (const GLubyte *c); 1310 | void glInitNames (void); 1311 | void glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer); 1312 | GLboolean glIsEnabled (GLenum cap); 1313 | GLboolean glIsList (GLuint list); 1314 | GLboolean glIsTexture (GLuint texture); 1315 | void glLightModelf (GLenum pname, GLfloat param); 1316 | void glLightModelfv (GLenum pname, const GLfloat *params); 1317 | void glLightModeli (GLenum pname, GLint param); 1318 | void glLightModeliv (GLenum pname, const GLint *params); 1319 | void glLightf (GLenum light, GLenum pname, GLfloat param); 1320 | void glLightfv (GLenum light, GLenum pname, const GLfloat *params); 1321 | void glLighti (GLenum light, GLenum pname, GLint param); 1322 | void glLightiv (GLenum light, GLenum pname, const GLint *params); 1323 | void glLineStipple (GLint factor, GLushort pattern); 1324 | void glLineWidth (GLfloat width); 1325 | void glListBase (GLuint base); 1326 | void glLoadIdentity (void); 1327 | void glLoadMatrixd (const GLdouble *m); 1328 | void glLoadMatrixf (const GLfloat *m); 1329 | void glLoadName (GLuint name); 1330 | void glLogicOp (GLenum opcode); 1331 | void glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); 1332 | void glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); 1333 | void glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); 1334 | void glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); 1335 | void glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); 1336 | void glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); 1337 | void glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); 1338 | void glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); 1339 | void glMaterialf (GLenum face, GLenum pname, GLfloat param); 1340 | void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); 1341 | void glMateriali (GLenum face, GLenum pname, GLint param); 1342 | void glMaterialiv (GLenum face, GLenum pname, const GLint *params); 1343 | void glMatrixMode (GLenum mode); 1344 | void glMultMatrixd (const GLdouble *m); 1345 | void glMultMatrixf (const GLfloat *m); 1346 | void glNewList (GLuint list, GLenum mode); 1347 | void glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); 1348 | void glNormal3bv (const GLbyte *v); 1349 | void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); 1350 | void glNormal3dv (const GLdouble *v); 1351 | void glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); 1352 | void glNormal3fv (const GLfloat *v); 1353 | void glNormal3i (GLint nx, GLint ny, GLint nz); 1354 | void glNormal3iv (const GLint *v); 1355 | void glNormal3s (GLshort nx, GLshort ny, GLshort nz); 1356 | void glNormal3sv (const GLshort *v); 1357 | void glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); 1358 | void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); 1359 | void glPassThrough (GLfloat token); 1360 | void glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values); 1361 | void glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values); 1362 | void glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values); 1363 | void glPixelStoref (GLenum pname, GLfloat param); 1364 | void glPixelStorei (GLenum pname, GLint param); 1365 | void glPixelTransferf (GLenum pname, GLfloat param); 1366 | void glPixelTransferi (GLenum pname, GLint param); 1367 | void glPixelZoom (GLfloat xfactor, GLfloat yfactor); 1368 | void glPointSize (GLfloat size); 1369 | void glPolygonMode (GLenum face, GLenum mode); 1370 | void glPolygonOffset (GLfloat factor, GLfloat units); 1371 | void glPolygonStipple (const GLubyte *mask); 1372 | void glPopAttrib (void); 1373 | void glPopClientAttrib (void); 1374 | void glPopMatrix (void); 1375 | void glPopName (void); 1376 | void glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities); 1377 | void glPushAttrib (GLbitfield mask); 1378 | void glPushClientAttrib (GLbitfield mask); 1379 | void glPushMatrix (void); 1380 | void glPushName (GLuint name); 1381 | void glRasterPos2d (GLdouble x, GLdouble y); 1382 | void glRasterPos2dv (const GLdouble *v); 1383 | void glRasterPos2f (GLfloat x, GLfloat y); 1384 | void glRasterPos2fv (const GLfloat *v); 1385 | void glRasterPos2i (GLint x, GLint y); 1386 | void glRasterPos2iv (const GLint *v); 1387 | void glRasterPos2s (GLshort x, GLshort y); 1388 | void glRasterPos2sv (const GLshort *v); 1389 | void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); 1390 | void glRasterPos3dv (const GLdouble *v); 1391 | void glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); 1392 | void glRasterPos3fv (const GLfloat *v); 1393 | void glRasterPos3i (GLint x, GLint y, GLint z); 1394 | void glRasterPos3iv (const GLint *v); 1395 | void glRasterPos3s (GLshort x, GLshort y, GLshort z); 1396 | void glRasterPos3sv (const GLshort *v); 1397 | void glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); 1398 | void glRasterPos4dv (const GLdouble *v); 1399 | void glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); 1400 | void glRasterPos4fv (const GLfloat *v); 1401 | void glRasterPos4i (GLint x, GLint y, GLint z, GLint w); 1402 | void glRasterPos4iv (const GLint *v); 1403 | void glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); 1404 | void glRasterPos4sv (const GLshort *v); 1405 | void glReadBuffer (GLenum mode); 1406 | void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); 1407 | void glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); 1408 | void glRectdv (const GLdouble *v1, const GLdouble *v2); 1409 | void glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); 1410 | void glRectfv (const GLfloat *v1, const GLfloat *v2); 1411 | void glRecti (GLint x1, GLint y1, GLint x2, GLint y2); 1412 | void glRectiv (const GLint *v1, const GLint *v2); 1413 | void glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); 1414 | void glRectsv (const GLshort *v1, const GLshort *v2); 1415 | GLint glRenderMode (GLenum mode); 1416 | void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); 1417 | void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); 1418 | void glScaled (GLdouble x, GLdouble y, GLdouble z); 1419 | void glScalef (GLfloat x, GLfloat y, GLfloat z); 1420 | void glScissor (GLint x, GLint y, GLsizei width, GLsizei height); 1421 | void glSelectBuffer (GLsizei size, GLuint *buffer); 1422 | void glShadeModel (GLenum mode); 1423 | void glStencilFunc (GLenum func, GLint ref, GLuint mask); 1424 | void glStencilMask (GLuint mask); 1425 | void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); 1426 | void glTexCoord1d (GLdouble s); 1427 | void glTexCoord1dv (const GLdouble *v); 1428 | void glTexCoord1f (GLfloat s); 1429 | void glTexCoord1fv (const GLfloat *v); 1430 | void glTexCoord1i (GLint s); 1431 | void glTexCoord1iv (const GLint *v); 1432 | void glTexCoord1s (GLshort s); 1433 | void glTexCoord1sv (const GLshort *v); 1434 | void glTexCoord2d (GLdouble s, GLdouble t); 1435 | void glTexCoord2dv (const GLdouble *v); 1436 | void glTexCoord2f (GLfloat s, GLfloat t); 1437 | void glTexCoord2fv (const GLfloat *v); 1438 | void glTexCoord2i (GLint s, GLint t); 1439 | void glTexCoord2iv (const GLint *v); 1440 | void glTexCoord2s (GLshort s, GLshort t); 1441 | void glTexCoord2sv (const GLshort *v); 1442 | void glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); 1443 | void glTexCoord3dv (const GLdouble *v); 1444 | void glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); 1445 | void glTexCoord3fv (const GLfloat *v); 1446 | void glTexCoord3i (GLint s, GLint t, GLint r); 1447 | void glTexCoord3iv (const GLint *v); 1448 | void glTexCoord3s (GLshort s, GLshort t, GLshort r); 1449 | void glTexCoord3sv (const GLshort *v); 1450 | void glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); 1451 | void glTexCoord4dv (const GLdouble *v); 1452 | void glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); 1453 | void glTexCoord4fv (const GLfloat *v); 1454 | void glTexCoord4i (GLint s, GLint t, GLint r, GLint q); 1455 | void glTexCoord4iv (const GLint *v); 1456 | void glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); 1457 | void glTexCoord4sv (const GLshort *v); 1458 | void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); 1459 | void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t); 1460 | 1461 | void glTexEnvf (GLenum target, GLenum pname, GLfloat param); 1462 | void glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); 1463 | void glTexEnvi (GLenum target, GLenum pname, GLint param); 1464 | void glTexEnviv (GLenum target, GLenum pname, const GLint *params); 1465 | void glTexGend (GLenum coord, GLenum pname, GLdouble param); 1466 | void glTexGendv (GLenum coord, GLenum pname, const GLdouble *params); 1467 | void glTexGenf (GLenum coord, GLenum pname, GLfloat param); 1468 | void glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params); 1469 | void glTexGeni (GLenum coord, GLenum pname, GLint param); 1470 | void glTexGeniv (GLenum coord, GLenum pname, const GLint *params); 1471 | void glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 1472 | void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); 1473 | void glTexParameterf (GLenum target, GLenum pname, GLfloat param); 1474 | void glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); 1475 | void glTexParameteri (GLenum target, GLenum pname, GLint param); 1476 | void glTexParameteriv (GLenum target, GLenum pname, const GLint *params); 1477 | void glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); 1478 | void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); 1479 | void glTranslated (GLdouble x, GLdouble y, GLdouble z); 1480 | void glTranslatef (GLfloat x, GLfloat y, GLfloat z); 1481 | void glVertex2d (GLdouble x, GLdouble y); 1482 | void glVertex2dv (const GLdouble *v); 1483 | void glVertex2f (GLfloat x, GLfloat y); 1484 | void glVertex2fv (const GLfloat *v); 1485 | void glVertex2i (GLint x, GLint y); 1486 | void glVertex2iv (const GLint *v); 1487 | void glVertex2s (GLshort x, GLshort y); 1488 | void glVertex2sv (const GLshort *v); 1489 | void glVertex3d (GLdouble x, GLdouble y, GLdouble z); 1490 | void glVertex3dv (const GLdouble *v); 1491 | void glVertex3f (GLfloat x, GLfloat y, GLfloat z); 1492 | void glVertex3fv (const GLfloat *v); 1493 | void glVertex3i (GLint x, GLint y, GLint z); 1494 | void glVertex3iv (const GLint *v); 1495 | void glVertex3s (GLshort x, GLshort y, GLshort z); 1496 | void glVertex3sv (const GLshort *v); 1497 | void glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); 1498 | void glVertex4dv (const GLdouble *v); 1499 | void glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); 1500 | void glVertex4fv (const GLfloat *v); 1501 | void glVertex4i (GLint x, GLint y, GLint z, GLint w); 1502 | void glVertex4iv (const GLint *v); 1503 | void glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); 1504 | void glVertex4sv (const GLshort *v); 1505 | void glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); 1506 | void glViewport (GLint x, GLint y, GLsizei width, GLsizei height); 1507 | 1508 | /* EXT_vertex_array */ 1509 | typedef void (* PFNGLARRAYELEMENTEXTPROC) (GLint i); 1510 | typedef void (* PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); 1511 | typedef void (* PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); 1512 | typedef void (* PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); 1513 | typedef void (* PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); 1514 | typedef void (* PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); 1515 | typedef void (* PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); 1516 | typedef void (* PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); 1517 | typedef void (* PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); 1518 | typedef void (* PFNGLARRAYELEMENTARRAYEXTPROC)(GLenum mode, GLsizei count, const GLvoid* pi); 1519 | 1520 | /* WIN_draw_range_elements */ 1521 | typedef void (* PFNGLDRAWRANGEELEMENTSWINPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); 1522 | 1523 | /* WIN_swap_hint */ 1524 | typedef void (* PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); 1525 | 1526 | /* EXT_paletted_texture */ 1527 | typedef void (* PFNGLCOLORTABLEEXTPROC) 1528 | (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, 1529 | GLenum type, const GLvoid *data); 1530 | typedef void (* PFNGLCOLORSUBTABLEEXTPROC) 1531 | (GLenum target, GLsizei start, GLsizei count, GLenum format, 1532 | GLenum type, const GLvoid *data); 1533 | typedef void (* PFNGLGETCOLORTABLEEXTPROC) 1534 | (GLenum target, GLenum format, GLenum type, GLvoid *data); 1535 | typedef void (* PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) 1536 | (GLenum target, GLenum pname, GLint *params); 1537 | typedef void (* PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) 1538 | (GLenum target, GLenum pname, GLfloat *params); 1539 | 1540 | #ifdef __cplusplus 1541 | } 1542 | #endif 1543 | 1544 | #endif /* __GL_H__ */ 1545 | #endif /* __gl_h_ */ 1546 | -------------------------------------------------------------------------------- /include/GL/glu.h: -------------------------------------------------------------------------------- 1 | 2 | void gluPerspective( GLdouble fovy, GLdouble aspect, 3 | GLdouble zNear, GLdouble zFar ); 4 | 5 | typedef struct { 6 | int draw_style; 7 | } GLUquadricObj; 8 | 9 | #define GLU_LINE 0 10 | 11 | GLUquadricObj *gluNewQuadric(void); 12 | void gluQuadricDrawStyle(GLUquadricObj *obj, int style); 13 | 14 | void gluSphere(GLUquadricObj *qobj, 15 | float radius,int slices,int stacks); 16 | void gluCylinder( GLUquadricObj *qobj, 17 | GLdouble baseRadius, GLdouble topRadius, GLdouble height, 18 | GLint slices, GLint stacks ); 19 | void gluDisk( GLUquadricObj *qobj, 20 | GLdouble innerRadius, GLdouble outerRadius, 21 | GLint slices, GLint loops ); 22 | 23 | void drawTorus(float rc, int numc, float rt, int numt); 24 | 25 | -------------------------------------------------------------------------------- /include/GL/mygl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/include/GL/mygl.h -------------------------------------------------------------------------------- /include/GL/util.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/include/GL/util.h -------------------------------------------------------------------------------- /lib/myOpenGL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/lib/myOpenGL.lib -------------------------------------------------------------------------------- /lib/myOpenGLd.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/lib/myOpenGLd.lib -------------------------------------------------------------------------------- /src/glapi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/src/glapi.c -------------------------------------------------------------------------------- /src/glcontext.c: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * procedure on GLContext 3 | * 4 | * \author jett huang 5 | * \date 2010-9-11 6 | * 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | #include "glcontext.h" 13 | #include "gltexture.h" 14 | 15 | 16 | /* \brief 17 | * initialize the GLContext 18 | * \ret 19 | * return 0 if succeed, otherwise return none-zero. 20 | */ 21 | int glContext_init(PtrGLContext pContext) 22 | { 23 | int i, j; 24 | 25 | if (!pContext) return 1; 26 | 27 | /* vertex attribute */ 28 | pContext->_vertex_edge_flag = GL_TRUE; 29 | pContext->_vertex_color._v[0] = 1.0; 30 | pContext->_vertex_color._v[1] = 1.0; 31 | pContext->_vertex_color._v[2] = 1.0; 32 | pContext->_vertex_color._v[3] = 1.0; 33 | pContext->_vertex_normal._v[0] = 0.0; 34 | pContext->_vertex_normal._v[1] = 0.0; 35 | pContext->_vertex_normal._v[2] = 1.0; 36 | for (i=0; i_vertex_texcoord[i]._v[0] = 0.0; 38 | pContext->_vertex_texcoord[i]._v[1] = 0.0; 39 | pContext->_vertex_texcoord[i]._v[2] = 0.0; 40 | pContext->_vertex_texcoord[i]._v[3] = 1.0; 41 | } 42 | 43 | /* lighting model && lighting */ 44 | /* pContext->_light_model_color_ctrl = GL_SINGLE_COLOR; */ 45 | pContext->_light_model_local_viewer = 0; 46 | pContext->_light_model_two_side = 0; 47 | pContext->_lighting_on = GL_FALSE; 48 | for (i=0; i_lights_on[i] = GL_FALSE; 50 | glLightSource_init(&(pContext->_lights_source[i])); 51 | } 52 | /* set the light0 */ 53 | pContext->_lights_source[0]._diffuse._v[0] = 1.0; 54 | pContext->_lights_source[0]._diffuse._v[1] = 1.0; 55 | pContext->_lights_source[0]._diffuse._v[2] = 1.0; 56 | pContext->_lights_source[0]._diffuse._v[3] = 1.0; 57 | pContext->_lights_source[0]._specular._v[0] = 1.0; 58 | pContext->_lights_source[0]._specular._v[1] = 1.0; 59 | pContext->_lights_source[0]._specular._v[2] = 1.0; 60 | pContext->_lights_source[0]._specular._v[3] = 1.0; 61 | 62 | glLightModel_init(&(pContext->_light_model)); 63 | 64 | /* meterial && mode */ 65 | pContext->_color_material_on = GL_FALSE; 66 | pContext->_color_material_face = GL_FRONT_AND_BACK; 67 | pContext->_color_material_mode = GL_AMBIENT_AND_DIFFUSE; 68 | glMaterialParameters_init(&(pContext->_front_material)); 69 | glMaterialParameters_init(&(pContext->_back_material)); 70 | 71 | /* vertex transform */ 72 | pContext->_normalize_on = GL_FALSE; 73 | for (i=0; i_matrix_stacks[0][i])); 75 | make_identity_matrix(&(pContext->_matrix_stacks[1][i])); 76 | make_identity_matrix(&(pContext->_matrix_stacks[2][i])); 77 | for (j=0; j_tex_matrix_stacks[0][i])); 79 | } 80 | } 81 | pContext->_matrix_top[0] = 0; /* the top of modelView matrix */ 82 | pContext->_matrix_top[1] = 0; /* the top of Projection matrix */ 83 | pContext->_matrix_top[2] = 0; /* the top of Color matrix */ 84 | pContext->_current_matrix = GL_MODELVIEW; /* current active matrix, 0~3 */ 85 | 86 | /* set vertex assamble state */ 87 | pContext->_primitive_type = 0; 88 | pContext->_cull_mode = GL_BACK; 89 | pContext->_fontface_mode = GL_CCW; 90 | pContext->_cull_face_on = GL_FALSE; 91 | 92 | /* view-port */ 93 | pContext->_viewport._x = 0; 94 | pContext->_viewport._y = 0; 95 | pContext->_viewport._width = 0; 96 | pContext->_viewport._height= 0; 97 | pContext->_viewport._zNear = 0.f; 98 | pContext->_viewport._zFar = 1.f; 99 | /* internal used */ 100 | pContext->_viewport._xScale = 0.f; pContext->_viewport._xCenter = 0.f; 101 | pContext->_viewport._yScale = 0.f; pContext->_viewport._yCenter = 0.f; 102 | pContext->_viewport._zScale = DEPTH * 0.5f, pContext->_viewport._zCenter = DEPTH * 0.5f; 103 | 104 | /* depth function */ 105 | pContext->_depth_test_on = GL_FALSE; 106 | pContext->_depth_func = GL_LESS; 107 | 108 | /* frame buffers */ 109 | pContext->_clear_r = 0; 110 | pContext->_clear_g = 0; 111 | pContext->_clear_b = 0; 112 | pContext->_clear_a = 255; 113 | pContext->_clear_depth= DEPTH; 114 | pContext->_buf_width = 0; 115 | pContext->_buf_height= 0; 116 | pContext->_buf_color_align = 0; 117 | pContext->_buf_color = NULL; 118 | pContext->_buf_depth = NULL; 119 | 120 | tex_initialize(); 121 | return 0; 122 | } 123 | 124 | /* \brief 125 | * unInitialize the GLContext 126 | */ 127 | void glContext_uninit(PtrGLContext pContext) 128 | { 129 | /* free buffers */ 130 | /* if (pContext->_buf_color) free(pContext->_buf_color); */ 131 | if (pContext->_buf_depth) free(pContext->_buf_depth); 132 | } 133 | 134 | /* \brief 135 | * initialize the GLLightSource 136 | * \ret 137 | * return 0 if succeed, otherwise return none-zero. 138 | */ 139 | int glLightSource_init(PtrGLLightSource pLightSrc) 140 | { 141 | if (!pLightSrc) return 1; 142 | 143 | pLightSrc->_ambient._v[0] = 0.0; 144 | pLightSrc->_ambient._v[1] = 0.0; 145 | pLightSrc->_ambient._v[2] = 0.0; 146 | pLightSrc->_ambient._v[3] = 1.0; 147 | pLightSrc->_diffuse._v[0] = 0.0; 148 | pLightSrc->_diffuse._v[1] = 0.0; 149 | pLightSrc->_diffuse._v[2] = 0.0; 150 | pLightSrc->_diffuse._v[3] = 1.0; 151 | pLightSrc->_specular._v[0] = 0.0; 152 | pLightSrc->_specular._v[1] = 0.0; 153 | pLightSrc->_specular._v[2] = 0.0; 154 | pLightSrc->_specular._v[3] = 1.0; 155 | 156 | pLightSrc->_position._v[0] = 0.0; 157 | pLightSrc->_position._v[1] = 0.0; 158 | pLightSrc->_position._v[2] = 1.0; 159 | pLightSrc->_position._v[3] = 0.0; 160 | pLightSrc->_spotDirection._v[0] = 0.0; 161 | pLightSrc->_spotDirection._v[1] = 0.0; 162 | pLightSrc->_spotDirection._v[2] = -1.0; 163 | 164 | pLightSrc->_spotExponent = 0.0; 165 | pLightSrc->_spotCutoff = 180.0; 166 | pLightSrc->_constantAttenuation = 1.0; 167 | pLightSrc->_linearAttenuation = 0.0; 168 | pLightSrc->_quadraticAttenuation= 0.0; 169 | 170 | return 0; 171 | } 172 | 173 | /* \brief 174 | * uninitialze the GLLightSource 175 | */ 176 | void glLightSource_uninit(PtrGLLightSource pLightSrc) 177 | { 178 | /* do nothing */ 179 | } 180 | 181 | /* \brief 182 | * initialize the GLLightModel 183 | * \ret 184 | * return 0 if succeed, otherwise return none-zero. 185 | */ 186 | int glLightModel_init(PtrGLLightModel pLightModel) 187 | { 188 | if (!pLightModel) return 1; 189 | 190 | pLightModel->_ambient._v[0] = 0.2f; 191 | pLightModel->_ambient._v[1] = 0.2f; 192 | pLightModel->_ambient._v[2] = 0.2f; 193 | pLightModel->_ambient._v[3] = 1.0f; 194 | return 0; 195 | } 196 | 197 | /* \brief 198 | * uninitialize the GLLightModel 199 | */ 200 | void glLightModel_uninit(PtrGLLightModel pLightModel) 201 | { 202 | /* do nothing */ 203 | } 204 | 205 | /* \brief 206 | * initialize the MaterialParameters 207 | * \ret 208 | * return 0 if succeed, otherwise return none-zero. 209 | */ 210 | int glMaterialParameters_init(PtrMaterialParameters pMaterial) 211 | { 212 | if (!pMaterial) return 1; 213 | 214 | pMaterial->_emission._v[0] = 0.0f; 215 | pMaterial->_emission._v[1] = 0.0f; 216 | pMaterial->_emission._v[2] = 0.0f; 217 | pMaterial->_emission._v[3] = 1.0f; 218 | pMaterial->_ambient._v[0] = 0.2f; 219 | pMaterial->_ambient._v[1] = 0.2f; 220 | pMaterial->_ambient._v[2] = 0.2f; 221 | pMaterial->_ambient._v[3] = 1.0f; 222 | pMaterial->_diffuse._v[0] = 0.8f; 223 | pMaterial->_diffuse._v[1] = 0.8f; 224 | pMaterial->_diffuse._v[2] = 0.8f; 225 | pMaterial->_diffuse._v[3] = 1.0f; 226 | pMaterial->_specular._v[0] = 0.0f; 227 | pMaterial->_specular._v[1] = 0.0f; 228 | pMaterial->_specular._v[2] = 0.0f; 229 | pMaterial->_specular._v[3] = 1.0f; 230 | pMaterial->_shininess = 0.0f; 231 | return 0; 232 | } 233 | 234 | /* \brief 235 | * uninitialize the MaterialParameters 236 | */ 237 | void glMaterialParameters_uninit(PtrMaterialParameters pMaterial) 238 | { 239 | /* do nothing */ 240 | } -------------------------------------------------------------------------------- /src/glcontext.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/src/glcontext.h -------------------------------------------------------------------------------- /src/glfragment.c: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * glfragment.c 3 | * 4 | */ 5 | 6 | #include 7 | #include "../include/GL/util.h" 8 | #include "glfragment.h" 9 | #include "gltexture.h" 10 | 11 | 12 | /* \brief 13 | * process fragment 14 | * 15 | */ 16 | void gl_process_fragment(PtrGLContext pContext, PtrGLFragment frag) 17 | { 18 | GLbyte *buf; 19 | GLushort *dep; 20 | GLuint width; 21 | GLfloat *rgba; 22 | 23 | if (!pContext->_buf_color) return; 24 | 25 | #if 0 26 | if (frag->_winX < 0 || frag->_winX >= pContext->_buf_width || 27 | frag->_winY < 0 || frag->_winY >= pContext->_buf_height) 28 | { 29 | printf("winx=%i, winy=%i, winz=%i\n", frag->_winX, frag->_winY, frag->_winZ); 30 | return; 31 | } 32 | #endif 33 | width = pContext->_buf_width; 34 | if (pContext->_depth_test_on) { 35 | if (pContext->_buf_depth) { 36 | dep = (GLushort *)pContext->_buf_depth; 37 | dep = dep + (width * frag->_winY + frag->_winX); 38 | if (*dep <= frag->_winZ) 39 | return; 40 | *dep = frag->_winZ; 41 | } 42 | else { 43 | printf("WARNING: depth buffer is NULL\n"); 44 | } 45 | } 46 | 47 | /* Sample texel */ 48 | #ifdef QUERY_PERFORMANCE 49 | begin_performance(); 50 | #endif 51 | tex_shade_fragment(frag); 52 | #ifdef QUERY_PERFORMANCE 53 | end_performance("tex_shade_fragment"); 54 | #endif 55 | 56 | rgba = frag->_color._v; 57 | width = pContext->_buf_color_align; 58 | buf = (pContext->_buf_color) + (width * frag->_winY + frag->_winX * 3); 59 | *buf++ = (GLbyte)(CLAMP(rgba[2], 0.f, 1.f) * 255); 60 | *buf++ = (GLbyte)(CLAMP(rgba[1], 0.f, 1.f) * 255); 61 | *buf = (GLbyte)(CLAMP(rgba[0], 0.f, 1.f) * 255); 62 | } -------------------------------------------------------------------------------- /src/glfragment.h: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * process the fragment. 3 | * 4 | * \author jett huang 5 | * \date 2010-10-19 6 | * 7 | * \change log: 8 | * 9 | */ 10 | 11 | #ifndef __GL_FRAGMENT_H__ 12 | #define __GL_FRAGMENT_H__ 13 | 14 | #include "glcontext.h" 15 | 16 | 17 | /* \brief 18 | * process fragment 19 | * 20 | */ 21 | void gl_process_fragment(PtrGLContext pContext, PtrGLFragment frag); 22 | 23 | #endif /* __GL_FRAGMENT_H__ */ -------------------------------------------------------------------------------- /src/gllistcmd.c: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * build the gl-operation table, and execute the handler. 3 | * 4 | * \author jett huang 5 | * \date 2010-9-8 6 | * 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | #include "glcontext.h" 13 | #include "glvertexmachine.h" 14 | #include "gllistcmd.h" 15 | 16 | 17 | /* the type of callback function */ 18 | typedef void (*PtrCmdHandler)(GLContext *, OpParam *); 19 | 20 | /* \brief 21 | * command mapping to ptr function. 22 | */ 23 | static PtrCmdHandler s_cmdTable[] = { 24 | glopEnable 25 | }; 26 | 27 | /* \brief 28 | * execute the command, this function is the interface of operation library. 29 | * \param 30 | * cmd (in) pointer to op-command 31 | * \ret 32 | * return 0 if succeed, otherwise return none-zero. 33 | */ 34 | int execute_command(PtrOpCommand cmd) 35 | { 36 | if (!cmd) return 1; 37 | if (cmd->_opcode >= sizeof(s_cmdTable)/sizeof(s_cmdTable[0])) 38 | { 39 | printf("ERROR IN GL_CORE: invalid opcode\n"); 40 | return 1; 41 | } 42 | 43 | if (!s_cmdTable[cmd->_opcode]) { 44 | printf("WARNING IN GL_CORE: no handler in cmdTable\n"); 45 | return 1; 46 | } 47 | 48 | /* TODO: 49 | (*s_cmdTable[cmd->_opcode])( ); 50 | */ 51 | return 0; 52 | } -------------------------------------------------------------------------------- /src/gllistcmd.h: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * openGL list commands. 3 | * 4 | * \author jett huang 5 | * \date 2010-9-5 6 | * 7 | * \change log 8 | * 9 | */ 10 | 11 | #ifndef __GL_LISTCMD_H__ 12 | #define __GL_LISTCMD_H__ 13 | 14 | 15 | #include "../include/GL/gl.h" 16 | 17 | /* maxinum count of params */ 18 | #define MAX_PARAM_COUNT 128 19 | 20 | /* opcode enum */ 21 | typedef enum { 22 | GLACTIVETEXTURE = 0, 23 | GLALPHAFUNC, 24 | GLARRAYELEMENT, 25 | 26 | GLBEGIN, 27 | GLBINDTEXTURE, 28 | GLBITMAP, 29 | GLBLENDCOLOR, 30 | GLBLENDEQUATION, 31 | GLBLENDEQUATIONSEPARATE, 32 | GLBLENDFUNC, 33 | GLBLENDFUNCSEPARATE, 34 | 35 | GLCALLLIST, 36 | GLCALLLISTS, 37 | GLCLEAR, 38 | GLCLEARCOLOR, 39 | GLCLEARDEPTH, 40 | GLCLEARSTENCIL, 41 | GLCLIPPLANE, 42 | GLCOLOR, 43 | GLCOLORMASK, 44 | GLCOLORMATERIAL, 45 | GLCOLORPOINTER, 46 | GLCULLFACE, 47 | 48 | GLDELETELISTS, 49 | GLDELETETEXTURES, 50 | GLDEPTHFUNC, 51 | GLDEPTHMASK, 52 | GLDISABLE, 53 | GLDISABLECLIENTSTATE, 54 | GLDRAWARRAYS, 55 | GLDRAWELEMENTS, 56 | GLDRAWPIXELS, 57 | GLDRAWRANGEELEMENTS, 58 | 59 | GLEDGEFLAG, 60 | GLEDGEFLAGPOINTER, 61 | GLENABLE, 62 | GLENABLECLIENTSTATE, 63 | GLEND, 64 | GLENDLIST, 65 | GLENDQUERY, 66 | 67 | GLFEEDBACKBUFFER, 68 | GLFINISH, 69 | GLFLUSH, 70 | GLFOG, 71 | GLFOGCOORD, 72 | GLFOGCOORDPOINTER, 73 | GLFRONTFACE, 74 | GLFRUSTUM, 75 | 76 | GLGENLISTS, 77 | GLGENTEXTURES, 78 | GLGETERROR, 79 | 80 | GLHINT, 81 | 82 | GLINITNAMES, 83 | GLISENABLED, 84 | GLISLIST, 85 | GLISTEXTURE, 86 | 87 | GLLIGHT, 88 | GLLIGHTMODEL, 89 | GLLINESTIPPLE, 90 | GLLINEWIDTH, 91 | GLLISTBASE, 92 | GLLOADIDENTITY, 93 | GLLOADMATRIX, 94 | GLLOADNAME, 95 | GLLOADTRANSPOSEMATRIX, 96 | GLLOGICOP, 97 | 98 | GLMATERIAL, 99 | GLMATRIXMODE, 100 | GLMULTMATRIX, 101 | GLMULTTRANSPOSEMATRIX, 102 | GLMULTIDRAWARRAYS, 103 | GLMULTIDRAWELEMENTS, 104 | GLMULTITEXCOORD, 105 | 106 | GLNEWLIST, 107 | GLNORMAL, 108 | GLNORMALPOINTER, 109 | 110 | GLORTHO, 111 | 112 | GLPIXELMAP, 113 | GLPIXELSTORE, 114 | GLPIXELZOOM, 115 | GLPOINTPARAMETER, 116 | GLPOINTSIZE, 117 | GLPOLYGONMODE, 118 | GLPOLYGONOFFSET, 119 | GLPOLYGONSTIPPLE, 120 | GLPOPMATRIX, 121 | GLPOPNAME, 122 | GLPUSHMATRIX, 123 | GLPUSHNAME, 124 | 125 | GLRASTERPOS, 126 | GLREADBUFFER, 127 | GLREADPIXELS, 128 | GLRECT, 129 | GLRENDERMODE, 130 | GLROTATE, 131 | 132 | GLSCALE, 133 | GLSCISSOR, 134 | GLSELECTBUFFER, 135 | GLSHADEMODEL, 136 | GLSTENCILFUNC, 137 | GLSTENCILFUNCSEPARATE, 138 | GLSTENCILMASK, 139 | GLSTENCILMASKSEPARATE, 140 | GLSTENCILOP, 141 | GLSTENCILOPSEPARATE, 142 | 143 | GLTEXCOORD, 144 | GLTEXCOORDPOINTER, 145 | GLTEXENV, 146 | GLTEXGEN, 147 | GLTEXIMAGE2D, 148 | GLTEXPARAMETER, 149 | GLTRANSLATE, 150 | 151 | GLVERTEX, 152 | GLVERTEXPOINTER, 153 | GLVIEWPORT, 154 | 155 | GLWINDOWPOS 156 | }OP_CODE; 157 | 158 | /* param struct */ 159 | typedef union { 160 | GLboolean b; 161 | GLenum e; 162 | GLint i; 163 | GLfloat f; 164 | GLuint ui; 165 | GLvoid *p; 166 | }OpParam; 167 | 168 | /* command struct */ 169 | typedef struct { 170 | OP_CODE _opcode; 171 | OpParam _params[MAX_PARAM_COUNT]; 172 | }OpCommand, *PtrOpCommand; 173 | 174 | /* \brief 175 | * execute the command, this function is the interface of operation library. 176 | * \param 177 | * cmd (in) pointer to op-command 178 | * \ret 179 | * return 0 if succeed, otherwise return none-zero. 180 | */ 181 | int execute_command(PtrOpCommand cmd); 182 | 183 | #endif /* __GL_LISTCMD_H__ */ -------------------------------------------------------------------------------- /src/glmath.c: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * implementation of glmath. 3 | * 4 | * \authro jett huang 5 | * \date 2010-9-3 6 | * 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "glmath.h" 16 | 17 | 18 | /* copy */ 19 | void copy_matrix4(PtrMatrix4 dst, PtrMatrix4 src) 20 | { 21 | memcpy(dst, src, sizeof(Matrix4)); 22 | } 23 | 24 | void copy_vector4(PtrVector4 dst, PtrVector4 src) 25 | { 26 | memcpy(dst, src, sizeof(Vector4)); 27 | } 28 | 29 | void copy_vector3(PtrVector3 dst, PtrVector3 src) 30 | { 31 | memcpy(dst, src, sizeof(Vector3)); 32 | } 33 | 34 | /* \brief 35 | * make a identity matrix4 36 | */ 37 | void make_identity_matrix(PtrMatrix4 m) 38 | { 39 | m->_m[0][0] = 1.0; m->_m[0][1] = 0.0; m->_m[0][2] = 0.0; m->_m[0][3] = 0.0; 40 | m->_m[1][0] = 0.0; m->_m[1][1] = 1.0; m->_m[1][2] = 0.0; m->_m[1][3] = 0.0; 41 | m->_m[2][0] = 0.0; m->_m[2][1] = 0.0; m->_m[2][2] = 1.0; m->_m[2][3] = 0.0; 42 | m->_m[3][0] = 0.0; m->_m[3][1] = 0.0; m->_m[3][2] = 0.0; m->_m[3][3] = 1.0; 43 | } 44 | 45 | /* \brief 46 | * check if a matrix is a identity matrix 47 | */ 48 | int is_identity_matrix(PtrMatrix4 m) 49 | { 50 | int i, j; 51 | 52 | for (i=0; i<4; ++i) 53 | for (j=0; j<4; ++j) 54 | { 55 | if (i == j) { 56 | if (m->_m[i][j] != 1.0) return 0; 57 | } else { 58 | if (m->_m[i][j] != 0.0) return 0; 59 | } 60 | } 61 | 62 | return 1; 63 | } 64 | 65 | /* \brief 66 | * transposition of matrix 67 | */ 68 | void transpose_matrix(PtrMatrix4 m, PtrMatrix4 result) 69 | { 70 | int i, j; 71 | 72 | for (i=0; i<4; ++i) 73 | for (j=0; j<4; ++j) 74 | { 75 | result->_m[j][i] = m->_m[i][j]; 76 | } 77 | } 78 | 79 | /* \brief 80 | * get the sub-matrix3x3, excluding the row i, col j 81 | * \param 82 | * m (in) the pointer to matrix4 83 | * i (in) the number of row 84 | * j (in) the number of column 85 | * sub (out) sub-matrix 86 | * \comment 87 | * the layout of sub is: 88 | * 89 | */ 90 | static 91 | void get_sub3x3_matrix(PtrMatrix4 m, int i, int j, float sub[3][3]) 92 | { 93 | int ti, tj, idst, jdst; 94 | 95 | for (ti=0; ti<4; ++ti) 96 | { 97 | idst = (ti < i) ? ti : (ti - 1); 98 | for (tj=0; tj<4; ++tj) 99 | { 100 | jdst = (tj < j) ? tj : (tj - 1); 101 | if (ti != i && tj != j) { 102 | sub[idst][jdst] = m->_m[ti][tj]; 103 | } 104 | } /* end for tj */ 105 | } /* end for ti */ 106 | } 107 | 108 | /* \brief 109 | * calculate the determinant 110 | * | | 111 | * | m11, m12, m13, m14 | 112 | * | m21, m22, m23, m24 | 113 | * | m31, m32, m33, m34 | 114 | * | m41, m42, m43, m44 | 115 | * | | 116 | * Result is: 117 | * m11 * (m22*(m33*m44 - m34*m43) + m23*(m34*m42 - m32*m44) + m24*(m32*m43 - m33*m42)) 118 | * -m12 * (m21*(m33*m44 - m34*m43) + m23*(m34*m41 - m31*m44) + m24*(m31*m43 - m33*m41)) 119 | * +m13 * (m21*(m32*m44 - m34*m42) + m22*(m34*m41 - m31*m44) + m24*(m31*m42 - m32*m41)) 120 | * -m14 * (m21*(m32*m43 - m33*m42) + m22*(m33*m41 - m31*m43) + m23*(m31*m42 - m32*m41)) 121 | * 122 | */ 123 | static 124 | float determinant_matrix(PtrMatrix4 m) 125 | { 126 | float det, result, sign; 127 | float sub[3][3]; 128 | int i; 129 | 130 | result = 0.0; sign = 1.0; 131 | 132 | for (i=0; i<4; ++i, sign *= -1.0) 133 | { 134 | get_sub3x3_matrix(m, 0, i, sub); 135 | det = sub[0][0] * (sub[1][1]*sub[2][2] - sub[1][2]*sub[2][1]) 136 | +sub[0][1] * (sub[2][0]*sub[1][2] - sub[1][0]*sub[2][2]) 137 | +sub[0][2] * (sub[1][0]*sub[2][1] - sub[2][0]*sub[1][1]); 138 | 139 | result += m->_m[0][i] * det * sign; 140 | } 141 | 142 | return result; 143 | } 144 | 145 | /* \brief 146 | * invert a matrix 147 | * | | 148 | * | m11, m12, m13, m14 | 149 | * | m21, m22, m23, m24 | 150 | * | m31, m32, m33, m34 | 151 | * | m41, m42, m43, m44 | 152 | * | | 153 | */ 154 | int invert_matrix(PtrMatrix4 m, PtrMatrix4 result) 155 | { 156 | float det = determinant_matrix(m); 157 | float oneOverDet; 158 | float sub[3][3]; 159 | int i, j, sign; 160 | 161 | /* assert del is not 0.0 */ 162 | if (fabs(det) < 10e-6) { 163 | #ifdef _DEBUG 164 | printf("INFO: invert_matrix, no inverse of matrix\n"); 165 | #endif 166 | return 1; 167 | } 168 | 169 | oneOverDet = 1.0f / det; 170 | for (i=0; i<4; ++i) 171 | { 172 | for (j=0; j<4; ++j) 173 | { 174 | sign = 1 - ((i+j)%2) * 2; 175 | get_sub3x3_matrix(m, j, i, sub); 176 | 177 | det = sub[0][0] * (sub[1][1]*sub[2][2] - sub[1][2]*sub[2][1]) 178 | +sub[0][1] * (sub[2][0]*sub[1][2] - sub[1][0]*sub[2][2]) 179 | +sub[0][2] * (sub[1][0]*sub[2][1] - sub[2][0]*sub[1][1]); 180 | result->_m[i][j] = (float)sign * det * oneOverDet; 181 | } 182 | } 183 | 184 | return 0; 185 | } 186 | 187 | /* \brief 188 | * make a rotation matrix 189 | * \param 190 | * m (in/out) pointer to matrix 191 | * theta (in) angle to rotation(in degree) 192 | * v3 (in) the axies to around 193 | * \comenet 194 | * 195 | * | Nx*Nx*(1-cos(theta)) + cos(theta), Nx*Ny*(1-cos(theta)) - Nz*sin(theta), Nx*Nz*(1-cos(theta)) + Ny*sin(theta) | 196 | * | Nx*Ny*(1-cos(theta)) + Nz*sin(theta), Ny*Ny*(1-cos(theta)) + cos(theta), Ny*Nz*(1-cos(theta)) - Nx*sin(theta) | 197 | * | Nx*Nz*(1-cos(theta)) - Ny*sin(theta), Ny*Nz*(1-cos(theta)) + Nx*sin(theta), Nz*Nz*(1-cos(theta)) + cos(theta) | 198 | * 199 | */ 200 | void make_rotate_matrix(PtrMatrix4 m, float theta, PtrVector3 v3) 201 | { 202 | float sintheta, costheta; 203 | Vector3 N = *v3; 204 | 205 | theta = theta * GL_PI / 180.0f; 206 | sintheta = (float)sin(theta); 207 | costheta = (float)cos(theta); 208 | normalize_vector3(&N); 209 | 210 | m->_m[0][0] = N._v[0] * N._v[0] * (1.0f - costheta) + costheta; 211 | m->_m[1][0] = N._v[0] * N._v[1] * (1.0f - costheta) + N._v[2] * sintheta; 212 | m->_m[2][0] = N._v[0] * N._v[2] * (1.0f - costheta) - N._v[1] * sintheta; 213 | m->_m[3][0] = 0.0; 214 | 215 | m->_m[0][1] = N._v[0] * N._v[1] * (1.0f - costheta) - N._v[2] * sintheta; 216 | m->_m[1][1] = N._v[1] * N._v[1] * (1.0f - costheta) + costheta; 217 | m->_m[2][1] = N._v[1] * N._v[2] * (1.0f - costheta) + N._v[0] * sintheta; 218 | m->_m[3][1] = 0.0; 219 | 220 | m->_m[0][2] = N._v[0] * N._v[2] * (1.0f - costheta) + N._v[1] * sintheta; 221 | m->_m[1][2] = N._v[1] * N._v[2] * (1.0f - costheta) - N._v[0] * sintheta; 222 | m->_m[2][2] = N._v[2] * N._v[2] * (1.0f - costheta) + costheta; 223 | m->_m[3][2] = 0.0f; 224 | 225 | m->_m[0][3] = 0.0f; 226 | m->_m[1][3] = 0.0f; 227 | m->_m[2][3] = 0.0f; 228 | m->_m[3][3] = 1.0f; 229 | } 230 | 231 | /* \brief 232 | * make a scale matrix 233 | * \param 234 | * m (in/out) pointer to matrix 235 | * v3 (in) a scale vector 236 | */ 237 | void make_scale_matrix(PtrMatrix4 m, PtrVector3 v3) 238 | { 239 | m->_m[0][0] = v3->_v[0]; m->_m[0][1] = 0.0; m->_m[0][2] = 0.0; m->_m[0][3] = 0.0; 240 | m->_m[1][0] = 0.0; m->_m[1][1] = v3->_v[1]; m->_m[1][2] = 0.0; m->_m[1][3] = 0.0; 241 | m->_m[2][0] = 0.0; m->_m[2][1] = 0.0; m->_m[2][2] = v3->_v[2]; m->_m[2][3] = 0.0; 242 | m->_m[3][0] = 0.0; m->_m[3][1] = 0.0; m->_m[3][2] = 0.0; m->_m[3][3] = 1.0; 243 | } 244 | 245 | /* \brief 246 | * make a transform matrix 247 | * \param 248 | * m (in/out) pointer to matrix 249 | * v3 (in) transform 250 | */ 251 | void make_transform_matrix(PtrMatrix4 m, PtrVector3 v3) 252 | { 253 | m->_m[0][0] = 1.0; m->_m[0][1] = 0.0; m->_m[0][2] = 0.0; m->_m[0][3] = v3->_v[0]; 254 | m->_m[1][0] = 0.0; m->_m[1][1] = 1.0; m->_m[1][2] = 0.0; m->_m[1][3] = v3->_v[1]; 255 | m->_m[2][0] = 0.0; m->_m[2][1] = 0.0; m->_m[2][2] = 1.0; m->_m[2][3] = v3->_v[2]; 256 | m->_m[3][0] = 0.0; m->_m[3][1] = 0.0; m->_m[3][2] = 0.0; m->_m[3][3] = 1.0; 257 | } 258 | 259 | /* \brief 260 | * multiply a matrix lhs by a another matrix rhs 261 | * \param 262 | * lhs (in) pointer to matrix 263 | * rhs (in) pointer to matrix 264 | * result (out) pointer to matrix 265 | * \comment 266 | * result can equal with lhs 267 | */ 268 | void multiply_matrix_by_matrix(PtrMatrix4 lhs, PtrMatrix4 rhs, PtrMatrix4 result) 269 | { 270 | Matrix4 mat; 271 | int i, j, k; 272 | 273 | for (i=0; i<4; ++i) 274 | { 275 | for (j=0; j<4; ++j) 276 | { 277 | mat._m[i][j] = 0.0; 278 | for (k=0; k<4; ++k) 279 | mat._m[i][j] += lhs->_m[i][k] * rhs->_m[k][j]; 280 | } 281 | } 282 | 283 | /* do copy */ 284 | copy_matrix4(result, &mat); 285 | } 286 | 287 | /* \brief 288 | * multiply a matrix by a scalar 289 | * \param 290 | * lhs (in) pointer to matrix 291 | * scalar (in) a scalar 292 | * result (out) pointer to a matrix 293 | * \comment 294 | * result can equal with m 295 | */ 296 | void multiply_matrix_by_scalar(PtrMatrix4 lhs, float scalar, PtrMatrix4 result) 297 | { 298 | result->_m[0][0] = lhs->_m[0][0] * scalar; 299 | result->_m[0][1] = lhs->_m[0][1] * scalar; 300 | result->_m[0][2] = lhs->_m[0][2] * scalar; 301 | result->_m[0][3] = lhs->_m[0][3] * scalar; 302 | 303 | result->_m[1][0] = lhs->_m[1][0] * scalar; 304 | result->_m[1][1] = lhs->_m[1][1] * scalar; 305 | result->_m[1][2] = lhs->_m[1][2] * scalar; 306 | result->_m[1][3] = lhs->_m[1][3] * scalar; 307 | 308 | result->_m[2][0] = lhs->_m[2][0] * scalar; 309 | result->_m[2][1] = lhs->_m[2][1] * scalar; 310 | result->_m[2][2] = lhs->_m[2][2] * scalar; 311 | result->_m[2][3] = lhs->_m[2][3] * scalar; 312 | 313 | result->_m[3][0] = lhs->_m[3][0] * scalar; 314 | result->_m[3][1] = lhs->_m[3][1] * scalar; 315 | result->_m[3][2] = lhs->_m[3][2] * scalar; 316 | result->_m[3][3] = lhs->_m[3][3] * scalar; 317 | } 318 | 319 | /* \brief 320 | * multiply a matrix with a vector3 321 | * \param 322 | * lhs (in) pointer to matrix 323 | * v3 (in) pointer to vector3 324 | * result (out) pointer to vector3 325 | */ 326 | void multiply_matrix_by_vector3(PtrMatrix4 lhs, PtrVector3 v3, PtrVector3 result) 327 | { 328 | Vector3 v; 329 | 330 | v._v[0] = lhs->_m[0][0] * v3->_v[0] + lhs->_m[0][1] * v3->_v[1] + lhs->_m[0][2] * v3->_v[2]; 331 | v._v[1] = lhs->_m[1][0] * v3->_v[0] + lhs->_m[1][1] * v3->_v[1] + lhs->_m[1][2] * v3->_v[2]; 332 | v._v[2] = lhs->_m[2][0] * v3->_v[0] + lhs->_m[2][1] * v3->_v[1] + lhs->_m[2][2] * v3->_v[2]; 333 | 334 | copy_vector3(result, &v); 335 | } 336 | 337 | /* \brief 338 | * multiply a matrix with a vector4 339 | * \param 340 | * lhs (in) pointer to matrix 341 | * v4 (in) pointer to vector4 342 | * result (out) pointer to vector4 343 | */ 344 | void multiply_matrix_by_vector4(PtrMatrix4 lhs, PtrVector4 v4, PtrVector4 result) 345 | { 346 | Vector4 v; 347 | 348 | v._v[0] = lhs->_m[0][0] * v4->_v[0] + lhs->_m[0][1] * v4->_v[1] + lhs->_m[0][2] * v4->_v[2] + lhs->_m[0][3] * v4->_v[3]; 349 | v._v[1] = lhs->_m[1][0] * v4->_v[0] + lhs->_m[1][1] * v4->_v[1] + lhs->_m[1][2] * v4->_v[2] + lhs->_m[1][3] * v4->_v[3]; 350 | v._v[2] = lhs->_m[2][0] * v4->_v[0] + lhs->_m[2][1] * v4->_v[1] + lhs->_m[2][2] * v4->_v[2] + lhs->_m[2][3] * v4->_v[3]; 351 | v._v[3] = lhs->_m[3][0] * v4->_v[0] + lhs->_m[3][1] * v4->_v[1] + lhs->_m[3][2] * v4->_v[2] + lhs->_m[3][3] * v4->_v[3]; 352 | 353 | copy_vector4(result, &v); 354 | } 355 | 356 | /* \brief 357 | * cross product of two vector3 358 | * \param 359 | * lhs (in) pointer to vector3 360 | * rhs (in) pointer to vector3 361 | * result (out) pointre to vector3 362 | * \comment 363 | * lhs can equal with result 364 | */ 365 | void cross_vector3(PtrVector3 lhs, PtrVector3 rhs, PtrVector3 result) 366 | { 367 | Vector3 v3; 368 | 369 | v3._v[0] = lhs->_v[1] * rhs->_v[2] - lhs->_v[2] * rhs->_v[1]; 370 | v3._v[1] = lhs->_v[2] * rhs->_v[0] - lhs->_v[0] * rhs->_v[2]; 371 | v3._v[2] = lhs->_v[0] * rhs->_v[1] - lhs->_v[1] * rhs->_v[0]; 372 | 373 | copy_vector3(result, &v3); 374 | } 375 | 376 | /* \brief 377 | * dot product of two vector3 378 | * \param 379 | * lhs (in) pointer to vector3 380 | * rhs (in) pointer to vector3 381 | * \ret 382 | * return the dot product 383 | */ 384 | float dot_vector3(PtrVector3 lhs, PtrVector3 rhs) 385 | { 386 | return lhs->_v[0] * rhs->_v[0] + lhs->_v[1] * rhs->_v[1] + lhs->_v[2] * rhs->_v[2]; 387 | } 388 | 389 | /* \brief 390 | * normalize the vector3 391 | * \param 392 | * v3 (in) pointer to vector3 393 | */ 394 | void normalize_vector3(PtrVector3 v3) 395 | { 396 | float mag; 397 | 398 | mag = (float)sqrt(v3->_v[0] * v3->_v[0] + v3->_v[1] * v3->_v[1] + v3->_v[2] * v3->_v[2]); 399 | assert(mag > 0.0f); 400 | /* get the 1.0 / mag */ 401 | mag = 1.0f / mag; 402 | 403 | v3->_v[0] *= mag; 404 | v3->_v[1] *= mag; 405 | v3->_v[2] *= mag; 406 | } 407 | 408 | /* \brief 409 | * vector3 subtract operation 410 | */ 411 | void sub_vector3(PtrVector3 lhs, PtrVector3 rhs, PtrVector3 res) 412 | { 413 | res->_v[0] = lhs->_v[0] - rhs->_v[0]; 414 | res->_v[1] = lhs->_v[1] - rhs->_v[1]; 415 | res->_v[2] = lhs->_v[2] - rhs->_v[2]; 416 | } 417 | 418 | /* \brief 419 | * vector3 add operation 420 | */ 421 | void add_vector3(PtrVector3 lhs, PtrVector3 rhs, PtrVector3 res) 422 | { 423 | res->_v[0] = lhs->_v[0] + rhs->_v[0]; 424 | res->_v[1] = lhs->_v[1] + rhs->_v[1]; 425 | res->_v[2] = lhs->_v[2] + rhs->_v[2]; 426 | } 427 | 428 | /* 429 | */ 430 | int invert_matrix_second(PtrMatrix4 mat, PtrMatrix4 result) 431 | { 432 | int i,j,k,l, n; 433 | float max,tmp,t; 434 | 435 | 436 | float *m, *r; 437 | 438 | m = &(mat->_m[0][0]); 439 | r = &(result->_m[0][0]); 440 | n = 4; 441 | 442 | /* identity the matrix */ 443 | for(i=0;ifabs(max)) { 452 | k=i; 453 | max=m[i*n+j]; 454 | } 455 | /* non intersible matrix */ 456 | if (max==0.0) return 1; 457 | 458 | /* permutation des lignes j et k */ 459 | if (k!=j) { 460 | for(i=0;i m[1] m[5] m[9] m[13] 6 | * m31 m32 m33 m34 m[2] m[6] m[10] m[14] 7 | * m41 m42 m43 m44 m[3] m[7] m[11] m[15] 8 | * 9 | * 10 | * \author jett huang 11 | * \date 2010-9-3 12 | * 13 | * \change log 14 | * 15 | * 16 | */ 17 | 18 | #ifndef __GL_MATH_H__ 19 | #define __GL_MATH_H__ 20 | 21 | 22 | #define GL_PI 3.1415926535897932384626433832795f 23 | 24 | /* Matrix & Vector */ 25 | typedef struct { 26 | float _m[4][4]; 27 | }Matrix4, *PtrMatrix4; 28 | 29 | typedef struct { 30 | float _v[4]; 31 | }Vector4, *PtrVector4; 32 | 33 | typedef struct { 34 | float _v[3]; 35 | }Vector3, *PtrVector3; 36 | 37 | /* copy */ 38 | void copy_matrix4(PtrMatrix4 dst, PtrMatrix4 src); 39 | void copy_vector4(PtrVector4 dst, PtrVector4 src); 40 | void copy_vector3(PtrVector3 dst, PtrVector3 src); 41 | 42 | /* \brief 43 | * make a identity matrix4 44 | * \param 45 | * m (in/out) pointer to matrix 46 | */ 47 | void make_identity_matrix(PtrMatrix4 m); 48 | 49 | /* \brief 50 | * check if a matrix is a identity matrix 51 | * \param 52 | * m (in) pointer to matrix 53 | * \ret 54 | * return 0 if not identity, otherwise return none-zero. 55 | */ 56 | int is_identity_matrix(PtrMatrix4 m); 57 | 58 | /* \brief 59 | * transposition of matrix 60 | * \param 61 | * m (in) pointer to matrix 62 | * result (out) pointer to matrix 63 | * \comment 64 | * m is not equal with result 65 | * 66 | */ 67 | void transpose_matrix(PtrMatrix4 m, PtrMatrix4 result); 68 | 69 | /* \brief 70 | * invert a matrix 71 | * \param 72 | * m (in) pointer to matrix 73 | * result (in) pointer to matrix 74 | * \ret 75 | * return 0 if succeed, otherwise rehturn non-zeor. 76 | * \comment 77 | * m is not equal with result 78 | */ 79 | int invert_matrix(PtrMatrix4 m, PtrMatrix4 result); 80 | 81 | /* \brief 82 | * make a rotation matrix 83 | * \param 84 | * m (in/out) pointer to matrix 85 | * theta (in) angle to rotation(in degree) 86 | * v3 (in) the axies to around 87 | */ 88 | void make_rotate_matrix(PtrMatrix4 m, float theta, PtrVector3 v3); 89 | 90 | /* \brief 91 | * make a scale matrix 92 | * \param 93 | * m (in/out) pointer to matrix 94 | * v3 (in) a scale vector 95 | */ 96 | void make_scale_matrix(PtrMatrix4 m, PtrVector3 v3); 97 | 98 | /* \brief 99 | * make a transform matrix 100 | * \param 101 | * m (in/out) pointer to matrix 102 | * v3 (in) transform 103 | */ 104 | void make_transform_matrix(PtrMatrix4 m, PtrVector3 v3); 105 | 106 | /* \brief 107 | * multiply a matrix lhs by a another matrix rhs 108 | * \param 109 | * lhs (in) pointer to matrix 110 | * rhs (in) pointer to matrix 111 | * result (out) pointer to matrix 112 | * \comment 113 | * result can equal with lhs 114 | */ 115 | void multiply_matrix_by_matrix(PtrMatrix4 lhs, PtrMatrix4 rhs, PtrMatrix4 result); 116 | 117 | /* \brief 118 | * multiply a matrix by a scalar 119 | * \param 120 | * lhs (in) pointer to matrix 121 | * scalar (in) a scalar 122 | * result (out) pointer to a matrix 123 | * \comment 124 | * result can equal with m 125 | */ 126 | void multiply_matrix_by_scalar(PtrMatrix4 lhs, float scalar, PtrMatrix4 result); 127 | 128 | /* \brief 129 | * multiply a matrix with a vector3 130 | * \param 131 | * lhs (in) pointer to matrix 132 | * v3 (in) pointer to vector3 133 | * result (out) pointer to vector3 134 | */ 135 | void multiply_matrix_by_vector3(PtrMatrix4 lhs, PtrVector3 v3, PtrVector3 result); 136 | 137 | /* \brief 138 | * multiply a matrix with a vector4 139 | * \param 140 | * lhs (in) pointer to matrix 141 | * v4 (in) pointer to vector4 142 | * result (out) pointer to vector4 143 | */ 144 | void multiply_matrix_by_vector4(PtrMatrix4 lhs, PtrVector4 v4, PtrVector4 result); 145 | 146 | /* \brief 147 | * cross product of two vector3 148 | * \param 149 | * lhs (in) pointer to vector3 150 | * rhs (in) pointer to vector3 151 | * result (out) pointre to vector3 152 | * \comment 153 | * lhs can equal with result 154 | */ 155 | void cross_vector3(PtrVector3 lhs, PtrVector3 rhs, PtrVector3 result); 156 | 157 | /* \brief 158 | * dot product of two vector3 159 | * \param 160 | * lhs (in) pointer to vector3 161 | * rhs (in) pointer to vector3 162 | * \ret 163 | * return the dot product 164 | */ 165 | float dot_vector3(PtrVector3 lhs, PtrVector3 rhs); 166 | 167 | /* \brief 168 | * normalize the vector3 169 | * \param 170 | * v3 (in) pointer to vector3 171 | */ 172 | void normalize_vector3(PtrVector3 v3); 173 | 174 | /* \brief 175 | * vector3 subtract operation 176 | * \param 177 | * lhs (in) left operand 178 | * rhs (in) right operand 179 | * res (out) result 180 | * \comment 181 | * lhs, rhs can equal with res 182 | */ 183 | void sub_vector3(PtrVector3 lhs, PtrVector3 rhs, PtrVector3 res); 184 | 185 | /* \brief 186 | * vector3 add operation 187 | * \param 188 | * lhs (in) left operand 189 | * rhs (in) right operand 190 | * res (out) result 191 | * \comment 192 | * lhs, rhs can equal with res 193 | */ 194 | void add_vector3(PtrVector3 lhs, PtrVector3 rhs, PtrVector3 res); 195 | 196 | /* \brief 197 | * anthor way to calculate the inverse of matrix. 198 | * \ret 199 | * return 0 if succeed. otherwise renturn non-zero. 200 | */ 201 | int invert_matrix_second(PtrMatrix4 m, PtrMatrix4 result); 202 | 203 | #endif /* __GL_MATH_H__ */ 204 | -------------------------------------------------------------------------------- /src/glrasterlize.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/src/glrasterlize.c -------------------------------------------------------------------------------- /src/glrasterlize.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/src/glrasterlize.h -------------------------------------------------------------------------------- /src/gltexture.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/src/gltexture.c -------------------------------------------------------------------------------- /src/gltexture.h: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * texture sampler. surpport 2D texture. 3 | * 4 | * \author jett huang 5 | * \date 2010-11-10 6 | * 7 | * \history: 8 | * 9 | */ 10 | 11 | #ifndef __GL_TEXTURE_H__ 12 | #define __GL_TEXTURE_H__ 13 | 14 | #include "../include/GL/gl.h" 15 | #include "glcontext.h" 16 | 17 | /* \brief 18 | * initialize the texture manager 19 | */ 20 | GLvoid tex_initialize(); 21 | 22 | /* \brief 23 | * allocate texture object 24 | */ 25 | GLvoid tex_GenTextures(GLsizei n, GLuint *textures); 26 | 27 | /* \brief 28 | * delete texture object 29 | */ 30 | GLvoid tex_DeleteTexture(GLsizei n, const GLuint *textures); 31 | 32 | /* \brief 33 | * bind a texture object as current 34 | */ 35 | GLvoid tex_BindTexture(GLenum target, GLuint texture); 36 | 37 | /* \brief 38 | * set the attributes of a texture object 39 | */ 40 | GLvoid tex_TexParameteri(GLenum target, GLenum pname, GLint param); 41 | 42 | GLvoid tex_TexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, 43 | GLenum type, const GLvoid *data); 44 | 45 | 46 | /* \brief 47 | * set texture environment parameters 48 | */ 49 | GLvoid tex_TexEnvi(GLenum target, GLenum pname, GLint param); 50 | 51 | /* select active texture unit */ 52 | GLvoid tex_ActiveTexture( GLenum texture); 53 | 54 | /* \brief 55 | * Enable texture 56 | */ 57 | GLvoid tex_TexEnable(GLenum target, GLboolean on); 58 | 59 | /* ============================================================================================= 60 | * SHADE A FRAGMENT 61 | * 62 | * ===========================================================================================*/ 63 | 64 | GLvoid tex_shade_fragment(PtrGLFragment frag); 65 | 66 | #endif /* __GL_TEXTURE_H__ */ 67 | -------------------------------------------------------------------------------- /src/glu.c: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * copy from tinyGL. 3 | * 4 | * \date 2010-11-08 5 | * 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #include "../include/GL/gl.h" 12 | #include "../include/GL/glu.h" 13 | 14 | #ifndef M_PI 15 | #define M_PI 3.14159265358979323846f 16 | #endif 17 | 18 | 19 | void drawTorus(float rc, int numc, float rt, int numt) 20 | { 21 | int i, j, k; 22 | double s, t; 23 | double x, y, z; 24 | double pi, twopi; 25 | 26 | pi = 3.14159265358979323846; 27 | twopi = 2 * pi; 28 | 29 | for (i = 0; i < numc; i++) { 30 | glBegin(GL_QUAD_STRIP); 31 | for (j = 0; j <= numt; j++) { 32 | for (k = 1; k >= 0; k--) { 33 | s = (i + k) % numc + 0.5; 34 | t = j % numt; 35 | 36 | x = cos(t*twopi/numt) * cos(s*twopi/numc); 37 | y = sin(t*twopi/numt) * cos(s*twopi/numc); 38 | z = sin(s*twopi/numc); 39 | glNormal3f(x, y, z); 40 | 41 | x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt); 42 | y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt); 43 | z = rc * sin(s*twopi/numc); 44 | glVertex3f(x, y, z); 45 | } 46 | } 47 | glEnd(); 48 | } 49 | } 50 | 51 | static void normal3f( GLfloat x, GLfloat y, GLfloat z ) 52 | { 53 | GLdouble mag; 54 | 55 | mag = sqrt( x*x + y*y + z*z ); 56 | if (mag>0.00001F) { 57 | x /= mag; 58 | y /= mag; 59 | z /= mag; 60 | } 61 | glNormal3f( x, y, z ); 62 | } 63 | 64 | void gluPerspective( GLdouble fovy, GLdouble aspect, 65 | GLdouble zNear, GLdouble zFar ) 66 | { 67 | GLdouble xmin, xmax, ymin, ymax; 68 | 69 | ymax = zNear * tan( fovy * M_PI / 360.0 ); 70 | ymin = -ymax; 71 | 72 | xmin = ymin * aspect; 73 | xmax = ymax * aspect; 74 | 75 | glFrustum( xmin, xmax, ymin, ymax, zNear, zFar ); 76 | } 77 | 78 | GLUquadricObj *gluNewQuadric(void) 79 | { 80 | return NULL; 81 | } 82 | 83 | void gluQuadricDrawStyle(GLUquadricObj *obj, int style) 84 | { 85 | } 86 | 87 | void gluCylinder( GLUquadricObj *qobj, 88 | GLdouble baseRadius, GLdouble topRadius, GLdouble height, 89 | GLint slices, GLint stacks ) 90 | { 91 | GLdouble da, r, dr, dz; 92 | GLfloat z, nz, nsign; 93 | GLint i, j; 94 | GLfloat du = 1.0 / slices; 95 | GLfloat dv = 1.0 / stacks; 96 | GLfloat tcx = 0.0, tcy = 0.0; 97 | 98 | nsign = 1.0; 99 | 100 | da = 2.0*M_PI / slices; 101 | dr = (topRadius-baseRadius) / stacks; 102 | dz = height / stacks; 103 | nz = (baseRadius-topRadius) / height; /* Z component of normal vectors */ 104 | 105 | for (i=0;i=0;j--) { 263 | theta = (j==slices) ? 0.0 : j * dtheta; 264 | x = -sin(theta) * sin(rho); 265 | y = cos(theta) * sin(rho); 266 | z = nsign * cos(rho); 267 | if (normals) glNormal3f( x*nsign, y*nsign, z*nsign ); 268 | glTexCoord2f(s,1-t); 269 | s -= ds; 270 | glVertex3f( x*radius, y*radius, z*radius ); 271 | } 272 | glEnd(); 273 | } 274 | -------------------------------------------------------------------------------- /src/glvertexmachine.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/src/glvertexmachine.c -------------------------------------------------------------------------------- /src/glvertexmachine.h: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * vertex machine of OpenGL. 3 | * 4 | * \author jett huang 5 | * \date 2010-9-12 6 | * 7 | * \change log 8 | * 9 | * 10 | */ 11 | 12 | #ifndef __GL_VERTEX_MACHINE_H__ 13 | #define __GL_VERTEX_MACHINE_H__ 14 | 15 | #include "../include/GL/gl.h" 16 | #include "glmath.h" 17 | #include "glcontext.h" 18 | #include "gllistcmd.h" 19 | 20 | 21 | /* --------------- the following function handle vertex ------------- */ 22 | /* 23 | * _params[0] enum variable 24 | */ 25 | void glopEnable(PtrGLContext pContext, OpParam _params[]); 26 | 27 | /* 28 | * _params[0] enum variable 29 | */ 30 | void glopDisable(PtrGLContext pContext, OpParam _params[]); 31 | 32 | /* 33 | * _params[0] GL_TRUE or GL_FALSE 34 | */ 35 | void glopEdgeFlag(PtrGLContext pContext, OpParam _params[]); 36 | 37 | /* 38 | * _params[0] red [0.0, 1.0] float 39 | * _params[1] green [0.0, 1.0] float 40 | * _params[2] blue [0.0, 1.0] float 41 | * _params[3] alpha [0.0, 1.0] float 42 | */ 43 | void glopColor(PtrGLContext pContext, OpParam _params[]); 44 | 45 | /* 46 | * _params[0] x float 47 | * _params[1] y float 48 | * _params[2] z float 49 | */ 50 | void glopNormal(PtrGLContext pContext, OpParam _params[]); 51 | 52 | /* 53 | * _params[0] x float 54 | * _params[1] y float 55 | * _params[2] z float 56 | * _params[3] w float 57 | */ 58 | void glopVertex(PtrGLContext pContext, OpParam _params[]); 59 | 60 | /* _params[0] texture unit id 61 | * _params[1] s float 62 | * _params[2] t float 63 | * _params[3] r float 64 | * _params[4] q float 65 | */ 66 | void glopTexCoord(PtrGLContext pContext, OpParam _params[]); 67 | 68 | /* 69 | * _params[0] paramName enum 70 | * _params[1,2,...] ... 71 | * 72 | */ 73 | void glopLightModel(PtrGLContext pContext, OpParam _params[]); 74 | 75 | /* 76 | * _params[0] light[i] 77 | * _params[1] pname 78 | * _params[2,...] param 79 | */ 80 | void glopLight(PtrGLContext pContext, OpParam _params[]); 81 | 82 | /* 83 | * _params[0] face 84 | * _params[1] mode 85 | */ 86 | void glopColorMaterial(PtrGLContext pContext, OpParam _params[]); 87 | 88 | /* 89 | * _params[0] face 90 | * _params[1] pname 91 | * _params[2,..] param 92 | */ 93 | void glopMaterial(PtrGLContext pContext, OpParam _params[]); 94 | 95 | /* 96 | * _params[0] mode 97 | */ 98 | void glopMatrixMode(PtrGLContext pContext, OpParam _params[]); 99 | 100 | /* 101 | * none 102 | */ 103 | void glopPushMatrix(PtrGLContext pContext, OpParam _params[]); 104 | 105 | /* 106 | * none 107 | */ 108 | void glopPopMatrix(PtrGLContext pContext, OpParam _params[]); 109 | 110 | /* 111 | * _params[0] degree float 112 | * _params[1,2,3] x,y,z axies 113 | * 114 | */ 115 | void glopRotate(PtrGLContext pContext, OpParam _params[]); 116 | 117 | /* 118 | * _params[0] x 119 | * _params[1] y 120 | * _params[2] z 121 | */ 122 | void glopTransform(PtrGLContext pContext, OpParam _params[]); 123 | 124 | /* 125 | * _params[0] x 126 | * _params[1] y 127 | * _params[2] z 128 | */ 129 | void glopScale(PtrGLContext pContext, OpParam _params[]); 130 | 131 | /* 132 | * _params[0..15] 133 | * 134 | */ 135 | void glopLoadMatrix(PtrGLContext pContext, OpParam _params[]); 136 | void glopLoadIdentity(PtrGLContext pContext, OpParam _params[]); 137 | void glopMultMatrix(PtrGLContext pContext, OpParam _params[]); 138 | 139 | #endif /* __GL_VERTEX_MACHINE_H__ */ -------------------------------------------------------------------------------- /src/util.c: -------------------------------------------------------------------------------- 1 | /* \brief 2 | * implement 3 | * 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | 11 | static LARGE_INTEGER last; 12 | 13 | /* \brief 14 | * begine to performance statis 15 | */ 16 | void begin_performance() 17 | { 18 | QueryPerformanceCounter(&last); 19 | } 20 | 21 | /* \brief 22 | * end to ... 23 | */ 24 | float end_performance(const char *comment) 25 | { 26 | LARGE_INTEGER now; 27 | LARGE_INTEGER freq; 28 | double interval, sec; 29 | 30 | QueryPerformanceCounter(&now); 31 | interval = (now.QuadPart - last.QuadPart); 32 | if (!QueryPerformanceFrequency(&freq)) 33 | return 0.f; 34 | 35 | sec = interval / (double)freq.QuadPart; 36 | 37 | if (comment) printf("%s use time %lf seconds\n", comment, sec); 38 | 39 | return 1.f / sec; /* return fps */ 40 | } 41 | -------------------------------------------------------------------------------- /vs2005/demo/demo.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /vs2005/demo/demo.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /vs2005/demo2/demo2.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /vs2005/demo2/demo2.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /vs2005/demo3/demo3.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /vs2005/demo3/demo3.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /vs2005/demo4/demo4.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /vs2005/demo4/demo4.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /vs2005/demo5/demo5.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 182 | 185 | 186 | 189 | 190 | 193 | 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /vs2005/demo5/demo5.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /vs2005/demo6/demo6.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 96 | 104 | 107 | 110 | 113 | 116 | 119 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 181 | 182 | 185 | 186 | 189 | 190 | 193 | 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /vs2005/demo6/demo6.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /vs2005/vs2005.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mygl", "vs2005\vs2005.vcproj", "{F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo1", "demo\demo.vcproj", "{FBE821EE-D051-4D1F-A11E-FA11F75EA2DF}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} = {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo2", "demo2\demo2.vcproj", "{BCF42EC5-7967-4DC8-BBD9-E7CEF60128A5}" 12 | ProjectSection(ProjectDependencies) = postProject 13 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} = {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} 14 | EndProjectSection 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo3", "demo3\demo3.vcproj", "{58B131A6-0CEB-4D34-B36B-4E726CEF2911}" 17 | ProjectSection(ProjectDependencies) = postProject 18 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} = {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} 19 | EndProjectSection 20 | EndProject 21 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo4", "demo4\demo4.vcproj", "{229C9B11-4A2C-4831-AB79-97305F209558}" 22 | ProjectSection(ProjectDependencies) = postProject 23 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} = {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} 24 | EndProjectSection 25 | EndProject 26 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo5", "demo5\demo5.vcproj", "{C745E223-176D-4166-9853-718AB3C7450F}" 27 | ProjectSection(ProjectDependencies) = postProject 28 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} = {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} 29 | EndProjectSection 30 | EndProject 31 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo6", "demo6\demo6.vcproj", "{C6BA3AFB-8EF4-48ED-8F50-E1648F7CC6E6}" 32 | ProjectSection(ProjectDependencies) = postProject 33 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} = {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC} 34 | EndProjectSection 35 | EndProject 36 | Global 37 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 38 | Debug|Win32 = Debug|Win32 39 | Release|Win32 = Release|Win32 40 | EndGlobalSection 41 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 42 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC}.Debug|Win32.Build.0 = Debug|Win32 44 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC}.Release|Win32.ActiveCfg = Release|Win32 45 | {F7ECD78E-DA9C-42E5-917E-4B7EC3EC84FC}.Release|Win32.Build.0 = Release|Win32 46 | {FBE821EE-D051-4D1F-A11E-FA11F75EA2DF}.Debug|Win32.ActiveCfg = Debug|Win32 47 | {FBE821EE-D051-4D1F-A11E-FA11F75EA2DF}.Debug|Win32.Build.0 = Debug|Win32 48 | {FBE821EE-D051-4D1F-A11E-FA11F75EA2DF}.Release|Win32.ActiveCfg = Release|Win32 49 | {FBE821EE-D051-4D1F-A11E-FA11F75EA2DF}.Release|Win32.Build.0 = Release|Win32 50 | {BCF42EC5-7967-4DC8-BBD9-E7CEF60128A5}.Debug|Win32.ActiveCfg = Debug|Win32 51 | {BCF42EC5-7967-4DC8-BBD9-E7CEF60128A5}.Debug|Win32.Build.0 = Debug|Win32 52 | {BCF42EC5-7967-4DC8-BBD9-E7CEF60128A5}.Release|Win32.ActiveCfg = Release|Win32 53 | {BCF42EC5-7967-4DC8-BBD9-E7CEF60128A5}.Release|Win32.Build.0 = Release|Win32 54 | {58B131A6-0CEB-4D34-B36B-4E726CEF2911}.Debug|Win32.ActiveCfg = Debug|Win32 55 | {58B131A6-0CEB-4D34-B36B-4E726CEF2911}.Debug|Win32.Build.0 = Debug|Win32 56 | {58B131A6-0CEB-4D34-B36B-4E726CEF2911}.Release|Win32.ActiveCfg = Release|Win32 57 | {58B131A6-0CEB-4D34-B36B-4E726CEF2911}.Release|Win32.Build.0 = Release|Win32 58 | {229C9B11-4A2C-4831-AB79-97305F209558}.Debug|Win32.ActiveCfg = Debug|Win32 59 | {229C9B11-4A2C-4831-AB79-97305F209558}.Debug|Win32.Build.0 = Debug|Win32 60 | {229C9B11-4A2C-4831-AB79-97305F209558}.Release|Win32.ActiveCfg = Release|Win32 61 | {229C9B11-4A2C-4831-AB79-97305F209558}.Release|Win32.Build.0 = Release|Win32 62 | {C745E223-176D-4166-9853-718AB3C7450F}.Debug|Win32.ActiveCfg = Debug|Win32 63 | {C745E223-176D-4166-9853-718AB3C7450F}.Debug|Win32.Build.0 = Debug|Win32 64 | {C745E223-176D-4166-9853-718AB3C7450F}.Release|Win32.ActiveCfg = Release|Win32 65 | {C745E223-176D-4166-9853-718AB3C7450F}.Release|Win32.Build.0 = Release|Win32 66 | {C6BA3AFB-8EF4-48ED-8F50-E1648F7CC6E6}.Debug|Win32.ActiveCfg = Debug|Win32 67 | {C6BA3AFB-8EF4-48ED-8F50-E1648F7CC6E6}.Debug|Win32.Build.0 = Debug|Win32 68 | {C6BA3AFB-8EF4-48ED-8F50-E1648F7CC6E6}.Release|Win32.ActiveCfg = Release|Win32 69 | {C6BA3AFB-8EF4-48ED-8F50-E1648F7CC6E6}.Release|Win32.Build.0 = Release|Win32 70 | EndGlobalSection 71 | GlobalSection(SolutionProperties) = preSolution 72 | HideSolutionNode = FALSE 73 | EndGlobalSection 74 | EndGlobal 75 | -------------------------------------------------------------------------------- /vs2005/vs2005.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JettHuang/MinOpenGL/bb65862a7ae8dc0cceca8155ddabd46e6aa06295/vs2005/vs2005.suo -------------------------------------------------------------------------------- /vs2005/vs2005/vs2005.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 25 | 28 | 31 | 34 | 37 | 40 | 53 | 56 | 59 | 62 | 66 | 69 | 72 | 75 | 78 | 81 | 82 | 90 | 93 | 96 | 99 | 102 | 105 | 114 | 117 | 120 | 123 | 127 | 130 | 133 | 136 | 139 | 142 | 143 | 144 | 145 | 146 | 147 | 152 | 155 | 156 | 159 | 160 | 163 | 164 | 167 | 168 | 171 | 172 | 175 | 176 | 179 | 180 | 183 | 184 | 187 | 188 | 191 | 192 | 195 | 196 | 199 | 200 | 203 | 204 | 207 | 208 | 211 | 212 | 215 | 216 | 219 | 220 | 221 | 226 | 229 | 232 | 233 | 236 | 237 | 240 | 241 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | -------------------------------------------------------------------------------- /vs2005/vs2005/vs2005.vcproj.GATEWAY-C3B43C3.Gateway.user: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 35 | 36 | 39 | 63 | 64 | 65 | 66 | --------------------------------------------------------------------------------