mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	REVIEWED: rlgl enums and comments
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/rcore.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rcore.c
									
									
									
									
									
								
							| @@ -2339,7 +2339,7 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device) | ||||
| { | ||||
|     VrStereoConfig config = { 0 }; | ||||
|  | ||||
|     if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20)) | ||||
|     if ((rlGetVersion() == RL_OPENGL_33) || (rlGetVersion() == RL_OPENGL_ES_20)) | ||||
|     { | ||||
|         // Compute aspect ratio | ||||
|         float aspect = ((float)device.hResolution*0.5f)/(float)device.vResolution; | ||||
| @@ -4006,12 +4006,12 @@ static bool InitGraphicsDevice(int width, int height) | ||||
|     // For example, if using OpenGL 1.1, driver can provide a 4.3 context forward compatible. | ||||
|  | ||||
|     // Check selection OpenGL version | ||||
|     if (rlGetVersion() == OPENGL_21) | ||||
|     if (rlGetVersion() == RL_OPENGL_21) | ||||
|     { | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);          // Choose OpenGL major version (just hint) | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);          // Choose OpenGL minor version (just hint) | ||||
|     } | ||||
|     else if (rlGetVersion() == OPENGL_33) | ||||
|     else if (rlGetVersion() == RL_OPENGL_33) | ||||
|     { | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);          // Choose OpenGL major version (just hint) | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);          // Choose OpenGL minor version (just hint) | ||||
| @@ -4024,7 +4024,7 @@ static bool InitGraphicsDevice(int width, int height) | ||||
| #endif | ||||
|         //glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); // Request OpenGL DEBUG context | ||||
|     } | ||||
|     else if (rlGetVersion() == OPENGL_43) | ||||
|     else if (rlGetVersion() == RL_OPENGL_43) | ||||
|     { | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);          // Choose OpenGL major version (just hint) | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);          // Choose OpenGL minor version (just hint) | ||||
| @@ -4034,7 +4034,7 @@ static bool InitGraphicsDevice(int width, int height) | ||||
|         glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);   // Enable OpenGL Debug Context | ||||
| #endif | ||||
|     } | ||||
|     else if (rlGetVersion() == OPENGL_ES_20)                    // Request OpenGL ES 2.0 context | ||||
|     else if (rlGetVersion() == RL_OPENGL_ES_20)                    // Request OpenGL ES 2.0 context | ||||
|     { | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); | ||||
|         glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); | ||||
|   | ||||
							
								
								
									
										114
									
								
								src/rlgl.h
									
									
									
									
									
								
							
							
						
						
									
										114
									
								
								src/rlgl.h
									
									
									
									
									
								
							| @@ -243,7 +243,7 @@ | ||||
| #define RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST    0x2701      // GL_LINEAR_MIPMAP_NEAREST | ||||
| #define RL_TEXTURE_FILTER_MIP_LINEAR            0x2703      // GL_LINEAR_MIPMAP_LINEAR | ||||
| #define RL_TEXTURE_FILTER_ANISOTROPIC           0x3000      // Anisotropic filter (custom identifier) | ||||
| #define RL_TEXTURE_MIPMAP_BIAS_RATIO            0x4000      // Texture mipmap bias (percentage ratio) | ||||
| #define RL_TEXTURE_MIPMAP_BIAS_RATIO            0x4000      // Texture mipmap bias, percentage ratio (custom identifier) | ||||
|  | ||||
| #define RL_TEXTURE_WRAP_REPEAT                  0x2901      // GL_REPEAT | ||||
| #define RL_TEXTURE_WRAP_CLAMP                   0x812F      // GL_CLAMP_TO_EDGE | ||||
| @@ -283,37 +283,23 @@ | ||||
| //---------------------------------------------------------------------------------- | ||||
| // Types and Structures Definition | ||||
| //---------------------------------------------------------------------------------- | ||||
| typedef enum { | ||||
|     OPENGL_11 = 1, | ||||
|     OPENGL_21, | ||||
|     OPENGL_33, | ||||
|     OPENGL_43, | ||||
|     OPENGL_ES_20 | ||||
| } rlGlVersion; | ||||
| #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) | ||||
|     #include <stdbool.h> | ||||
| #elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE) | ||||
|     // Boolean type | ||||
| typedef enum bool { false = 0, true = !false } bool; | ||||
| #endif | ||||
|  | ||||
| typedef enum { | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL0 = 0, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL1, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL2, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL3, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL4, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL5, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL6, | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL7, | ||||
|     RL_ATTACHMENT_DEPTH = 100, | ||||
|     RL_ATTACHMENT_STENCIL = 200, | ||||
| } rlFramebufferAttachType; | ||||
|  | ||||
| typedef enum { | ||||
|     RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, | ||||
|     RL_ATTACHMENT_CUBEMAP_NEGATIVE_X, | ||||
|     RL_ATTACHMENT_CUBEMAP_POSITIVE_Y, | ||||
|     RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y, | ||||
|     RL_ATTACHMENT_CUBEMAP_POSITIVE_Z, | ||||
|     RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z, | ||||
|     RL_ATTACHMENT_TEXTURE2D = 100, | ||||
|     RL_ATTACHMENT_RENDERBUFFER = 200, | ||||
| } rlFramebufferAttachTextureType; | ||||
| #if !defined(RL_MATRIX_TYPE) | ||||
| // Matrix, 4x4 components, column major, OpenGL style, right handed | ||||
| typedef struct Matrix { | ||||
|     float m0, m4, m8, m12;      // Matrix first row (4 components) | ||||
|     float m1, m5, m9, m13;      // Matrix second row (4 components) | ||||
|     float m2, m6, m10, m14;     // Matrix third row (4 components) | ||||
|     float m3, m7, m11, m15;     // Matrix fourth row (4 components) | ||||
| } Matrix; | ||||
| #define RL_MATRIX_TYPE | ||||
| #endif | ||||
|  | ||||
| // Dynamic vertex buffers (position + texcoords + colors + indices arrays) | ||||
| typedef struct rlVertexBuffer { | ||||
| @@ -359,23 +345,15 @@ typedef struct rlRenderBatch { | ||||
|     float currentDepth;         // Current depth value for next draw | ||||
| } rlRenderBatch; | ||||
|  | ||||
| #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) | ||||
|     #include <stdbool.h> | ||||
| #elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE) | ||||
|     // Boolean type | ||||
| typedef enum bool { false = 0, true = !false } bool; | ||||
| #endif | ||||
|  | ||||
| #if !defined(RL_MATRIX_TYPE) | ||||
| // Matrix, 4x4 components, column major, OpenGL style, right handed | ||||
| typedef struct Matrix { | ||||
|     float m0, m4, m8, m12;  // Matrix first row (4 components) | ||||
|     float m1, m5, m9, m13;  // Matrix second row (4 components) | ||||
|     float m2, m6, m10, m14; // Matrix third row (4 components) | ||||
|     float m3, m7, m11, m15; // Matrix fourth row (4 components) | ||||
| } Matrix; | ||||
| #define RL_MATRIX_TYPE | ||||
| #endif | ||||
| // OpenGL version | ||||
| typedef enum { | ||||
|     RL_OPENGL_11 = 1,           // OpenGL 1.1 | ||||
|     RL_OPENGL_21,               // OpenGL 2.1 (GLSL 120) | ||||
|     RL_OPENGL_33,               // OpenGL 3.3 (GLSL 330) | ||||
|     RL_OPENGL_43,               // OpenGL 4.3 (using GLSL 330) | ||||
|     RL_OPENGL_ES_20             // OpenGL ES 2.0 (GLSL 100) | ||||
| } rlGlVersion; | ||||
|  | ||||
| // Trace log level | ||||
| // NOTE: Organized by priority level | ||||
| @@ -390,7 +368,8 @@ typedef enum { | ||||
|     RL_LOG_NONE                 // Disable logging | ||||
| } rlTraceLogLevel; | ||||
|  | ||||
| // Texture formats (support depends on OpenGL version) | ||||
| // Texture pixel formats | ||||
| // NOTE: Support depends on OpenGL version | ||||
| typedef enum { | ||||
|     RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1,     // 8 bit per pixel (no alpha) | ||||
|     RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA,        // 8*2 bpp (2 channels) | ||||
| @@ -492,6 +471,33 @@ typedef enum { | ||||
|     RL_SHADER_ATTRIB_VEC4               // Shader attribute type: vec4 (4 float) | ||||
| } rlShaderAttributeDataType; | ||||
|  | ||||
| // Framebuffer attachment type | ||||
| // NOTE: By default up to 8 color channels defined but it can be more | ||||
| typedef enum { | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL0 = 0,   // Framebuffer attachmment type: color 0 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL1,       // Framebuffer attachmment type: color 1 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL2,       // Framebuffer attachmment type: color 2 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL3,       // Framebuffer attachmment type: color 3 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL4,       // Framebuffer attachmment type: color 4 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL5,       // Framebuffer attachmment type: color 5 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL6,       // Framebuffer attachmment type: color 6 | ||||
|     RL_ATTACHMENT_COLOR_CHANNEL7,       // Framebuffer attachmment type: color 7 | ||||
|     RL_ATTACHMENT_DEPTH = 100,          // Framebuffer attachmment type: depth | ||||
|     RL_ATTACHMENT_STENCIL = 200,        // Framebuffer attachmment type: stencil | ||||
| } rlFramebufferAttachType; | ||||
|  | ||||
| // Framebuffer texture attachment type | ||||
| typedef enum { | ||||
|     RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, // Framebuffer texture attachment type: cubemap, +X side | ||||
|     RL_ATTACHMENT_CUBEMAP_NEGATIVE_X,   // Framebuffer texture attachment type: cubemap, -X side | ||||
|     RL_ATTACHMENT_CUBEMAP_POSITIVE_Y,   // Framebuffer texture attachment type: cubemap, +Y side | ||||
|     RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y,   // Framebuffer texture attachment type: cubemap, -Y side | ||||
|     RL_ATTACHMENT_CUBEMAP_POSITIVE_Z,   // Framebuffer texture attachment type: cubemap, +Z side | ||||
|     RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z,   // Framebuffer texture attachment type: cubemap, -Z side | ||||
|     RL_ATTACHMENT_TEXTURE2D = 100,      // Framebuffer texture attachment type: texture2d | ||||
|     RL_ATTACHMENT_RENDERBUFFER = 200,   // Framebuffer texture attachment type: renderbuffer | ||||
| } rlFramebufferAttachTextureType; | ||||
|  | ||||
| //------------------------------------------------------------------------------------ | ||||
| // Functions Declaration - Matrix operations | ||||
| //------------------------------------------------------------------------------------ | ||||
| @@ -2211,22 +2217,22 @@ int rlGetVersion(void) | ||||
| { | ||||
|     int glVersion = 0; | ||||
| #if defined(GRAPHICS_API_OPENGL_11) | ||||
|     glVersion = OPENGL_11; | ||||
|     glVersion = RL_OPENGL_11; | ||||
| #endif | ||||
| #if defined(GRAPHICS_API_OPENGL_21) | ||||
|     #if defined(__APPLE__) | ||||
|         glVersion = OPENGL_33;           // NOTE: Force OpenGL 3.3 on OSX | ||||
|         glVersion = RL_OPENGL_33;           // NOTE: Force OpenGL 3.3 on OSX | ||||
|     #else | ||||
|         glVersion = OPENGL_21; | ||||
|         glVersion = RL_OPENGL_21; | ||||
|     #endif | ||||
| #elif defined(GRAPHICS_API_OPENGL_33) | ||||
|     glVersion = OPENGL_33; | ||||
|     glVersion = RL_OPENGL_33; | ||||
| #endif | ||||
| #if defined(GRAPHICS_API_OPENGL_43) | ||||
|     glVersion = OPENGL_43; | ||||
|     glVersion = RL_OPENGL_43; | ||||
| #endif | ||||
| #if defined(GRAPHICS_API_OPENGL_ES2) | ||||
|     glVersion = OPENGL_ES_20; | ||||
|     glVersion = RL_OPENGL_ES_20; | ||||
| #endif | ||||
|     return glVersion; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ray
					Ray