|
@@ -17,7 +17,9 @@
|
|
* #define GRAPHICS_API_OPENGL_21
|
|
* #define GRAPHICS_API_OPENGL_21
|
|
* #define GRAPHICS_API_OPENGL_33
|
|
* #define GRAPHICS_API_OPENGL_33
|
|
* #define GRAPHICS_API_OPENGL_ES2
|
|
* #define GRAPHICS_API_OPENGL_ES2
|
|
-* Use selected OpenGL backend
|
|
|
|
|
|
+* Use selected OpenGL graphics backend, should be supported by platform
|
|
|
|
+* Those preprocessor defines are only used on rlgl module, if OpenGL version is
|
|
|
|
+* required by any other module, use rlGetVersion() tocheck it
|
|
*
|
|
*
|
|
* #define RLGL_STANDALONE
|
|
* #define RLGL_STANDALONE
|
|
* Use rlgl as standalone library (no raylib dependency)
|
|
* Use rlgl as standalone library (no raylib dependency)
|
|
@@ -57,11 +59,8 @@
|
|
#ifndef RLGL_H
|
|
#ifndef RLGL_H
|
|
#define RLGL_H
|
|
#define RLGL_H
|
|
|
|
|
|
-//#define RLGL_STANDALONE // NOTE: To use rlgl as standalone lib, just uncomment this line
|
|
|
|
-
|
|
|
|
#ifndef RLGL_STANDALONE
|
|
#ifndef RLGL_STANDALONE
|
|
- #include "raylib.h" // Required for: Model, Shader, Texture2D
|
|
|
|
- #include "utils.h" // Required for: TraceLog()
|
|
|
|
|
|
+ #include "raylib.h" // Required for: Model, Shader, Texture2D, TraceLog()
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef RLGL_STANDALONE
|
|
#ifdef RLGL_STANDALONE
|
|
@@ -70,15 +69,6 @@
|
|
|
|
|
|
#include "raymath.h" // Required for: Vector3, Matrix
|
|
#include "raymath.h" // Required for: Vector3, Matrix
|
|
|
|
|
|
-// Select desired OpenGL version
|
|
|
|
-// NOTE: Those preprocessor defines are only used on rlgl module,
|
|
|
|
-// if OpenGL version is required by any other module, it uses rlGetVersion()
|
|
|
|
-
|
|
|
|
-// Choose opengl version here or just define it at compile time: -DGRAPHICS_API_OPENGL_33
|
|
|
|
-//#define GRAPHICS_API_OPENGL_11 // Only available on PLATFORM_DESKTOP
|
|
|
|
-//#define GRAPHICS_API_OPENGL_33 // Only available on PLATFORM_DESKTOP and RLGL_OCULUS_SUPPORT
|
|
|
|
-//#define GRAPHICS_API_OPENGL_ES2 // Only available on PLATFORM_ANDROID or PLATFORM_RPI or PLATFORM_WEB
|
|
|
|
-
|
|
|
|
// Security check in case no GRAPHICS_API_OPENGL_* defined
|
|
// Security check in case no GRAPHICS_API_OPENGL_* defined
|
|
#if !defined(GRAPHICS_API_OPENGL_11) && !defined(GRAPHICS_API_OPENGL_21) && !defined(GRAPHICS_API_OPENGL_33) && !defined(GRAPHICS_API_OPENGL_ES2)
|
|
#if !defined(GRAPHICS_API_OPENGL_11) && !defined(GRAPHICS_API_OPENGL_21) && !defined(GRAPHICS_API_OPENGL_33) && !defined(GRAPHICS_API_OPENGL_ES2)
|
|
#define GRAPHICS_API_OPENGL_11
|
|
#define GRAPHICS_API_OPENGL_11
|
|
@@ -165,28 +155,23 @@ typedef unsigned char byte;
|
|
unsigned char b;
|
|
unsigned char b;
|
|
unsigned char a;
|
|
unsigned char a;
|
|
} Color;
|
|
} Color;
|
|
|
|
+
|
|
|
|
+ // Texture2D type
|
|
|
|
+ // NOTE: Data stored in GPU memory
|
|
|
|
+ typedef struct Texture2D {
|
|
|
|
+ unsigned int id; // OpenGL texture id
|
|
|
|
+ int width; // Texture base width
|
|
|
|
+ int height; // Texture base height
|
|
|
|
+ int mipmaps; // Mipmap levels, 1 by default
|
|
|
|
+ int format; // Data format (TextureFormat)
|
|
|
|
+ } Texture2D;
|
|
|
|
|
|
- // Texture formats (support depends on OpenGL version)
|
|
|
|
- typedef enum {
|
|
|
|
- UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
|
|
|
|
- UNCOMPRESSED_GRAY_ALPHA,
|
|
|
|
- UNCOMPRESSED_R5G6B5, // 16 bpp
|
|
|
|
- UNCOMPRESSED_R8G8B8, // 24 bpp
|
|
|
|
- UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha)
|
|
|
|
- UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha)
|
|
|
|
- UNCOMPRESSED_R8G8B8A8, // 32 bpp
|
|
|
|
- COMPRESSED_DXT1_RGB, // 4 bpp (no alpha)
|
|
|
|
- COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha)
|
|
|
|
- COMPRESSED_DXT3_RGBA, // 8 bpp
|
|
|
|
- COMPRESSED_DXT5_RGBA, // 8 bpp
|
|
|
|
- COMPRESSED_ETC1_RGB, // 4 bpp
|
|
|
|
- COMPRESSED_ETC2_RGB, // 4 bpp
|
|
|
|
- COMPRESSED_ETC2_EAC_RGBA, // 8 bpp
|
|
|
|
- COMPRESSED_PVRT_RGB, // 4 bpp
|
|
|
|
- COMPRESSED_PVRT_RGBA, // 4 bpp
|
|
|
|
- COMPRESSED_ASTC_4x4_RGBA, // 8 bpp
|
|
|
|
- COMPRESSED_ASTC_8x8_RGBA // 2 bpp
|
|
|
|
- } TextureFormat;
|
|
|
|
|
|
+ // RenderTexture2D type, for texture rendering
|
|
|
|
+ typedef struct RenderTexture2D {
|
|
|
|
+ unsigned int id; // Render texture (fbo) id
|
|
|
|
+ Texture2D texture; // Color buffer attachment texture
|
|
|
|
+ Texture2D depth; // Depth buffer attachment texture
|
|
|
|
+ } RenderTexture2D;
|
|
|
|
|
|
// Vertex data definning a mesh
|
|
// Vertex data definning a mesh
|
|
typedef struct Mesh {
|
|
typedef struct Mesh {
|
|
@@ -228,23 +213,6 @@ typedef unsigned char byte;
|
|
int mapTexture2Loc; // Map texture uniform location point (default-texture-unit = 2)
|
|
int mapTexture2Loc; // Map texture uniform location point (default-texture-unit = 2)
|
|
} Shader;
|
|
} Shader;
|
|
|
|
|
|
- // Texture2D type
|
|
|
|
- // NOTE: Data stored in GPU memory
|
|
|
|
- typedef struct Texture2D {
|
|
|
|
- unsigned int id; // OpenGL texture id
|
|
|
|
- int width; // Texture base width
|
|
|
|
- int height; // Texture base height
|
|
|
|
- int mipmaps; // Mipmap levels, 1 by default
|
|
|
|
- int format; // Data format (TextureFormat)
|
|
|
|
- } Texture2D;
|
|
|
|
-
|
|
|
|
- // RenderTexture2D type, for texture rendering
|
|
|
|
- typedef struct RenderTexture2D {
|
|
|
|
- unsigned int id; // Render texture (fbo) id
|
|
|
|
- Texture2D texture; // Color buffer attachment texture
|
|
|
|
- Texture2D depth; // Depth buffer attachment texture
|
|
|
|
- } RenderTexture2D;
|
|
|
|
-
|
|
|
|
// Material type
|
|
// Material type
|
|
typedef struct Material {
|
|
typedef struct Material {
|
|
Shader shader; // Standard shader (supports 3 map types: diffuse, normal, specular)
|
|
Shader shader; // Standard shader (supports 3 map types: diffuse, normal, specular)
|
|
@@ -267,6 +235,37 @@ typedef unsigned char byte;
|
|
Vector3 up; // Camera up vector (rotation over its axis)
|
|
Vector3 up; // Camera up vector (rotation over its axis)
|
|
float fovy; // Camera field-of-view apperture in Y (degrees)
|
|
float fovy; // Camera field-of-view apperture in Y (degrees)
|
|
} Camera;
|
|
} Camera;
|
|
|
|
+
|
|
|
|
+ // TraceLog message types
|
|
|
|
+ typedef enum {
|
|
|
|
+ INFO = 0,
|
|
|
|
+ ERROR,
|
|
|
|
+ WARNING,
|
|
|
|
+ DEBUG,
|
|
|
|
+ OTHER
|
|
|
|
+ } TraceLogType;
|
|
|
|
+
|
|
|
|
+ // Texture formats (support depends on OpenGL version)
|
|
|
|
+ typedef enum {
|
|
|
|
+ UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
|
|
|
|
+ UNCOMPRESSED_GRAY_ALPHA,
|
|
|
|
+ UNCOMPRESSED_R5G6B5, // 16 bpp
|
|
|
|
+ UNCOMPRESSED_R8G8B8, // 24 bpp
|
|
|
|
+ UNCOMPRESSED_R5G5B5A1, // 16 bpp (1 bit alpha)
|
|
|
|
+ UNCOMPRESSED_R4G4B4A4, // 16 bpp (4 bit alpha)
|
|
|
|
+ UNCOMPRESSED_R8G8B8A8, // 32 bpp
|
|
|
|
+ COMPRESSED_DXT1_RGB, // 4 bpp (no alpha)
|
|
|
|
+ COMPRESSED_DXT1_RGBA, // 4 bpp (1 bit alpha)
|
|
|
|
+ COMPRESSED_DXT3_RGBA, // 8 bpp
|
|
|
|
+ COMPRESSED_DXT5_RGBA, // 8 bpp
|
|
|
|
+ COMPRESSED_ETC1_RGB, // 4 bpp
|
|
|
|
+ COMPRESSED_ETC2_RGB, // 4 bpp
|
|
|
|
+ COMPRESSED_ETC2_EAC_RGBA, // 8 bpp
|
|
|
|
+ COMPRESSED_PVRT_RGB, // 4 bpp
|
|
|
|
+ COMPRESSED_PVRT_RGBA, // 4 bpp
|
|
|
|
+ COMPRESSED_ASTC_4x4_RGBA, // 8 bpp
|
|
|
|
+ COMPRESSED_ASTC_8x8_RGBA // 2 bpp
|
|
|
|
+ } TextureFormat;
|
|
|
|
|
|
// Texture parameters: filter mode
|
|
// Texture parameters: filter mode
|
|
// NOTE 1: Filtering considers mipmaps if available in the texture
|
|
// NOTE 1: Filtering considers mipmaps if available in the texture
|
|
@@ -281,13 +280,18 @@ typedef unsigned char byte;
|
|
} TextureFilterMode;
|
|
} TextureFilterMode;
|
|
|
|
|
|
// Texture parameters: wrap mode
|
|
// Texture parameters: wrap mode
|
|
- typedef enum { WRAP_REPEAT = 0, WRAP_CLAMP, WRAP_MIRROR } TextureWrapMode;
|
|
|
|
|
|
+ typedef enum {
|
|
|
|
+ WRAP_REPEAT = 0,
|
|
|
|
+ WRAP_CLAMP,
|
|
|
|
+ WRAP_MIRROR
|
|
|
|
+ } TextureWrapMode;
|
|
|
|
|
|
// Color blending modes (pre-defined)
|
|
// Color blending modes (pre-defined)
|
|
- typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
|
|
|
|
-
|
|
|
|
- // TraceLog message types
|
|
|
|
- typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
|
|
|
|
|
|
+ typedef enum {
|
|
|
|
+ BLEND_ALPHA = 0,
|
|
|
|
+ BLEND_ADDITIVE,
|
|
|
|
+ BLEND_MULTIPLIED
|
|
|
|
+ } BlendMode;
|
|
|
|
|
|
// VR Head Mounted Display devices
|
|
// VR Head Mounted Display devices
|
|
typedef enum {
|
|
typedef enum {
|