REVIEWED: rlgl enums and comments
This commit is contained in:
parent
0917290e95
commit
ad5ffd78d6
2 changed files with 135 additions and 129 deletions
10
src/rcore.c
10
src/rcore.c
|
@ -2339,7 +2339,7 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
|
||||||
{
|
{
|
||||||
VrStereoConfig config = { 0 };
|
VrStereoConfig config = { 0 };
|
||||||
|
|
||||||
if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
|
if ((rlGetVersion() == RL_OPENGL_33) || (rlGetVersion() == RL_OPENGL_ES_20))
|
||||||
{
|
{
|
||||||
// Compute aspect ratio
|
// Compute aspect ratio
|
||||||
float aspect = ((float)device.hResolution*0.5f)/(float)device.vResolution;
|
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.
|
// For example, if using OpenGL 1.1, driver can provide a 4.3 context forward compatible.
|
||||||
|
|
||||||
// Check selection OpenGL version
|
// 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_MAJOR, 2); // Choose OpenGL major version (just hint)
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); // Choose OpenGL minor 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_MAJOR, 3); // Choose OpenGL major version (just hint)
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); // Choose OpenGL minor 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
|
#endif
|
||||||
//glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); // Request OpenGL DEBUG context
|
//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_MAJOR, 4); // Choose OpenGL major version (just hint)
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); // Choose OpenGL minor 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
|
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); // Enable OpenGL Debug Context
|
||||||
#endif
|
#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_MAJOR, 2);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
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_LINEAR_MIP_NEAREST 0x2701 // GL_LINEAR_MIPMAP_NEAREST
|
||||||
#define RL_TEXTURE_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
#define RL_TEXTURE_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
||||||
#define RL_TEXTURE_FILTER_ANISOTROPIC 0x3000 // Anisotropic filter (custom identifier)
|
#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_REPEAT 0x2901 // GL_REPEAT
|
||||||
#define RL_TEXTURE_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE
|
#define RL_TEXTURE_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE
|
||||||
|
@ -283,37 +283,23 @@
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
typedef enum {
|
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
|
||||||
OPENGL_11 = 1,
|
#include <stdbool.h>
|
||||||
OPENGL_21,
|
#elif !defined(__cplusplus) && !defined(bool) && !defined(RL_BOOL_TYPE)
|
||||||
OPENGL_33,
|
// Boolean type
|
||||||
OPENGL_43,
|
typedef enum bool { false = 0, true = !false } bool;
|
||||||
OPENGL_ES_20
|
#endif
|
||||||
} rlGlVersion;
|
|
||||||
|
|
||||||
typedef enum {
|
#if !defined(RL_MATRIX_TYPE)
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL0 = 0,
|
// Matrix, 4x4 components, column major, OpenGL style, right handed
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL1,
|
typedef struct Matrix {
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL2,
|
float m0, m4, m8, m12; // Matrix first row (4 components)
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL3,
|
float m1, m5, m9, m13; // Matrix second row (4 components)
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL4,
|
float m2, m6, m10, m14; // Matrix third row (4 components)
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL5,
|
float m3, m7, m11, m15; // Matrix fourth row (4 components)
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL6,
|
} Matrix;
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL7,
|
#define RL_MATRIX_TYPE
|
||||||
RL_ATTACHMENT_DEPTH = 100,
|
#endif
|
||||||
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;
|
|
||||||
|
|
||||||
// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||||
typedef struct rlVertexBuffer {
|
typedef struct rlVertexBuffer {
|
||||||
|
@ -359,23 +345,15 @@ typedef struct rlRenderBatch {
|
||||||
float currentDepth; // Current depth value for next draw
|
float currentDepth; // Current depth value for next draw
|
||||||
} rlRenderBatch;
|
} 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)
|
// OpenGL version
|
||||||
// Matrix, 4x4 components, column major, OpenGL style, right handed
|
typedef enum {
|
||||||
typedef struct Matrix {
|
RL_OPENGL_11 = 1, // OpenGL 1.1
|
||||||
float m0, m4, m8, m12; // Matrix first row (4 components)
|
RL_OPENGL_21, // OpenGL 2.1 (GLSL 120)
|
||||||
float m1, m5, m9, m13; // Matrix second row (4 components)
|
RL_OPENGL_33, // OpenGL 3.3 (GLSL 330)
|
||||||
float m2, m6, m10, m14; // Matrix third row (4 components)
|
RL_OPENGL_43, // OpenGL 4.3 (using GLSL 330)
|
||||||
float m3, m7, m11, m15; // Matrix fourth row (4 components)
|
RL_OPENGL_ES_20 // OpenGL ES 2.0 (GLSL 100)
|
||||||
} Matrix;
|
} rlGlVersion;
|
||||||
#define RL_MATRIX_TYPE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Trace log level
|
// Trace log level
|
||||||
// NOTE: Organized by priority level
|
// NOTE: Organized by priority level
|
||||||
|
@ -390,7 +368,8 @@ typedef enum {
|
||||||
RL_LOG_NONE // Disable logging
|
RL_LOG_NONE // Disable logging
|
||||||
} rlTraceLogLevel;
|
} rlTraceLogLevel;
|
||||||
|
|
||||||
// Texture formats (support depends on OpenGL version)
|
// Texture pixel formats
|
||||||
|
// NOTE: Support depends on OpenGL version
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
|
RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
|
||||||
RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels)
|
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)
|
RL_SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float)
|
||||||
} rlShaderAttributeDataType;
|
} 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
|
// Functions Declaration - Matrix operations
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
@ -2211,22 +2217,22 @@ int rlGetVersion(void)
|
||||||
{
|
{
|
||||||
int glVersion = 0;
|
int glVersion = 0;
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
glVersion = OPENGL_11;
|
glVersion = RL_OPENGL_11;
|
||||||
#endif
|
#endif
|
||||||
#if defined(GRAPHICS_API_OPENGL_21)
|
#if defined(GRAPHICS_API_OPENGL_21)
|
||||||
#if defined(__APPLE__)
|
#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
|
#else
|
||||||
glVersion = OPENGL_21;
|
glVersion = RL_OPENGL_21;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
#elif defined(GRAPHICS_API_OPENGL_33)
|
||||||
glVersion = OPENGL_33;
|
glVersion = RL_OPENGL_33;
|
||||||
#endif
|
#endif
|
||||||
#if defined(GRAPHICS_API_OPENGL_43)
|
#if defined(GRAPHICS_API_OPENGL_43)
|
||||||
glVersion = OPENGL_43;
|
glVersion = RL_OPENGL_43;
|
||||||
#endif
|
#endif
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
glVersion = OPENGL_ES_20;
|
glVersion = RL_OPENGL_ES_20;
|
||||||
#endif
|
#endif
|
||||||
return glVersion;
|
return glVersion;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue