summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.h
diff options
context:
space:
mode:
authorvictorfisac <[email protected]>2017-03-06 09:47:08 +0100
committervictorfisac <[email protected]>2017-03-06 09:47:08 +0100
commitf9277f216372179560c560427beccdd2e5c5d094 (patch)
tree8d3858c978f2b36ea8912f25e3cbe6fa56952aff /src/rlgl.h
parentce56fcb1eda06385b88c1a906f0968d742ff8130 (diff)
parentc05701253e0a4eda211a0d7ced74ae29d6585917 (diff)
downloadraylib-f9277f216372179560c560427beccdd2e5c5d094.tar.gz
raylib-f9277f216372179560c560427beccdd2e5c5d094.zip
Merge remote-tracking branch 'refs/remotes/raysan5/master'
Diffstat (limited to 'src/rlgl.h')
-rw-r--r--src/rlgl.h315
1 files changed, 215 insertions, 100 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 9e0aaaaa..41f671e6 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -2,12 +2,29 @@
*
* rlgl - raylib OpenGL abstraction layer
*
-* raylib now uses OpenGL 1.1 style functions (rlVertex) that are mapped to selected OpenGL version:
-* OpenGL 1.1 - Direct map rl* -> gl*
-* OpenGL 3.3 - Vertex data is stored in VAOs, call rlglDraw() to render
-* OpenGL ES 2 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
+* rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
+* selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
*
-* Copyright (c) 2014 Ramon Santamaria (@raysan5)
+* When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
+* VBO buffers (and VAOs if available). It requires calling 3 functions:
+* rlglInit() - Initialize internal buffers and auxiliar resources
+* rlglDraw() - Process internal buffers and send required draw calls
+* rlglClose() - De-initialize internal buffers data and other auxiliar resources
+*
+* External libs:
+* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
+* GLAD - OpenGL extensions loading (OpenGL 3.3 Core only)
+*
+* Module Configuration Flags:
+* GRAPHICS_API_OPENGL_11 - Use OpenGL 1.1 backend
+* GRAPHICS_API_OPENGL_21 - Use OpenGL 2.1 backend
+* GRAPHICS_API_OPENGL_33 - Use OpenGL 3.3 Core profile backend
+* GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
+*
+* RLGL_STANDALONE - Use rlgl as standalone library (no raylib dependency)
+*
+*
+* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
@@ -32,11 +49,15 @@
//#define RLGL_STANDALONE // NOTE: To use rlgl as standalone lib, just uncomment this line
#ifndef RLGL_STANDALONE
- #include "raylib.h" // Required for typedef(s): Model, Shader, Texture2D
- #include "utils.h" // Required for function TraceLog()
+ #include "raylib.h" // Required for: Model, Shader, Texture2D
+ #include "utils.h" // Required for: TraceLog()
+#endif
+
+#ifdef RLGL_STANDALONE
+ #define RAYMATH_STANDALONE
#endif
-#include "raymath.h"
+#include "raymath.h" // Required for: Vector3, Matrix
// Select desired OpenGL version
// NOTE: Those preprocessor defines are only used on rlgl module,
@@ -44,25 +65,31 @@
// 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
+//#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
-#if !defined(GRAPHICS_API_OPENGL_11) && !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
#endif
// Security check in case multiple GRAPHICS_API_OPENGL_* defined
#if defined(GRAPHICS_API_OPENGL_11)
+ #if defined(GRAPHICS_API_OPENGL_21)
+ #undef GRAPHICS_API_OPENGL_21
+ #endif
#if defined(GRAPHICS_API_OPENGL_33)
#undef GRAPHICS_API_OPENGL_33
#endif
-
#if defined(GRAPHICS_API_OPENGL_ES2)
#undef GRAPHICS_API_OPENGL_ES2
#endif
#endif
+#if defined(GRAPHICS_API_OPENGL_21)
+ #define GRAPHICS_API_OPENGL_33
+#endif
+
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
@@ -70,7 +97,7 @@
// NOTE: This is the maximum amount of lines, triangles and quads per frame, be careful!
#define MAX_LINES_BATCH 8192
#define MAX_TRIANGLES_BATCH 4096
- #define MAX_QUADS_BATCH 4096
+ #define MAX_QUADS_BATCH 8192
#elif defined(GRAPHICS_API_OPENGL_ES2)
// NOTE: Reduce memory sizes for embedded systems (RPI and HTML5)
// NOTE: On HTML5 (emscripten) this is allocated on heap, by default it's only 16MB!...just take care...
@@ -79,14 +106,34 @@
#define MAX_QUADS_BATCH 1024 // Be careful with text, every letter maps a quad
#endif
+// Texture parameters (equivalent to OpenGL defines)
+#define RL_TEXTURE_WRAP_S 0x2802 // GL_TEXTURE_WRAP_S
+#define RL_TEXTURE_WRAP_T 0x2803 // GL_TEXTURE_WRAP_T
+#define RL_TEXTURE_MAG_FILTER 0x2800 // GL_TEXTURE_MAG_FILTER
+#define RL_TEXTURE_MIN_FILTER 0x2801 // GL_TEXTURE_MIN_FILTER
+#define RL_TEXTURE_ANISOTROPIC_FILTER 0x3000 // Anisotropic filter (custom identifier)
+
+#define RL_FILTER_NEAREST 0x2600 // GL_NEAREST
+#define RL_FILTER_LINEAR 0x2601 // GL_LINEAR
+#define RL_FILTER_MIP_NEAREST 0x2700 // GL_NEAREST_MIPMAP_NEAREST
+#define RL_FILTER_NEAREST_MIP_LINEAR 0x2702 // GL_NEAREST_MIPMAP_LINEAR
+#define RL_FILTER_LINEAR_MIP_NEAREST 0x2701 // GL_LINEAR_MIPMAP_NEAREST
+#define RL_FILTER_MIP_LINEAR 0x2703 // GL_LINEAR_MIPMAP_LINEAR
+
+#define RL_WRAP_REPEAT 0x2901 // GL_REPEAT
+#define RL_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE
+#define RL_WRAP_CLAMP_MIRROR 0x8742 // GL_MIRROR_CLAMP_EXT
+
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
+typedef enum { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_ES_20 } GlVersion;
+
typedef enum { RL_PROJECTION, RL_MODELVIEW, RL_TEXTURE } MatrixMode;
typedef enum { RL_LINES, RL_TRIANGLES, RL_QUADS } DrawMode;
-typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
+typedef unsigned char byte;
#if defined(RLGL_STANDALONE)
#ifndef __cplusplus
@@ -94,9 +141,6 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
typedef enum { false, true } bool;
#endif
- // byte type
- typedef unsigned char byte;
-
// Color type, RGBA (32bit)
typedef struct Color {
unsigned char r;
@@ -106,7 +150,7 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
} Color;
// Texture formats (support depends on OpenGL version)
- typedef enum {
+ typedef enum {
UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
UNCOMPRESSED_GRAY_ALPHA,
UNCOMPRESSED_R5G6B5, // 16 bpp
@@ -126,52 +170,45 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
COMPRESSED_ASTC_4x4_RGBA, // 8 bpp
COMPRESSED_ASTC_8x8_RGBA // 2 bpp
} TextureFormat;
-
- // Bounding box type
- typedef struct BoundingBox {
- Vector3 min;
- Vector3 max;
- } BoundingBox;
-
- // Mesh with vertex data type
- // NOTE: If using OpenGL 1.1, data loaded in CPU; if OpenGL 3.3+ data loaded in GPU (vaoId)
+
+ // Vertex data definning a mesh
typedef struct Mesh {
- int vertexCount; // num vertices
- float *vertices; // vertex position (XYZ - 3 components per vertex)
- float *texcoords; // vertex texture coordinates (UV - 2 components per vertex)
- float *texcoords2; // vertex second texture coordinates (useful for lightmaps)
- float *normals; // vertex normals (XYZ - 3 components per vertex)
- float *tangents; // vertex tangents (XYZ - 3 components per vertex)
- unsigned char *colors; // vertex colors (RGBA - 4 components per vertex)
-
- BoundingBox bounds; // mesh limits defined by min and max points
-
- unsigned int vaoId; // OpenGL Vertex Array Object id
- unsigned int vboId[6]; // OpenGL Vertex Buffer Objects id (6 types of vertex data)
+ int vertexCount; // number of vertices stored in arrays
+ int triangleCount; // number of triangles stored (indexed or not)
+ float *vertices; // vertex position (XYZ - 3 components per vertex) (shader-location = 0)
+ float *texcoords; // vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
+ float *texcoords2; // vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
+ float *normals; // vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
+ float *tangents; // vertex tangents (XYZ - 3 components per vertex) (shader-location = 4)
+ unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
+ unsigned short *indices;// vertex indices (in case vertex data comes indexed)
+
+ unsigned int vaoId; // OpenGL Vertex Array Object id
+ unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data)
} Mesh;
- // Shader type
+ // Shader type (generic shader)
typedef struct Shader {
- unsigned int id; // Shader program id
-
- // TODO: This should be Texture2D objects
- unsigned int texDiffuseId; // Diffuse texture id
- unsigned int texNormalId; // Normal texture id
- unsigned int texSpecularId; // Specular texture id
-
- // Variable attributes
- int vertexLoc; // Vertex attribute location point (vertex shader)
- int texcoordLoc; // Texcoord attribute location point (vertex shader)
- int normalLoc; // Normal attribute location point (vertex shader)
- int colorLoc; // Color attibute location point (vertex shader)
-
- // Uniforms
- int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
- int tintColorLoc; // Color uniform location point (fragment shader)
-
- int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader)
- int mapNormalLoc; // Normal map texture uniform location point (fragment shader)
- int mapSpecularLoc; // Specular map texture uniform location point (fragment shader)
+ unsigned int id; // Shader program id
+
+ // Vertex attributes locations (default locations)
+ int vertexLoc; // Vertex attribute location point (default-location = 0)
+ int texcoordLoc; // Texcoord attribute location point (default-location = 1)
+ int normalLoc; // Normal attribute location point (default-location = 2)
+ int colorLoc; // Color attibute location point (default-location = 3)
+ int tangentLoc; // Tangent attribute location point (default-location = 4)
+ int texcoord2Loc; // Texcoord2 attribute location point (default-location = 5)
+
+ // Uniform locations
+ int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader)
+ int colDiffuseLoc; // Color uniform location point (fragment shader)
+ int colAmbientLoc; // Ambient color uniform location point (fragment shader)
+ int colSpecularLoc; // Specular color uniform location point (fragment shader)
+
+ // Texture map locations (generic for any kind of map)
+ int mapTexture0Loc; // Map texture uniform location point (default-texture-unit = 0)
+ int mapTexture1Loc; // Map texture uniform location point (default-texture-unit = 1)
+ int mapTexture2Loc; // Map texture uniform location point (default-texture-unit = 2)
} Shader;
// Texture2D type
@@ -183,17 +220,70 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
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
+ typedef struct Material {
+ Shader shader; // Standard shader (supports 3 map types: diffuse, normal, specular)
+
+ Texture2D texDiffuse; // Diffuse texture
+ Texture2D texNormal; // Normal texture
+ Texture2D texSpecular; // Specular texture
+
+ Color colDiffuse; // Diffuse color
+ Color colAmbient; // Ambient color
+ Color colSpecular; // Specular color
+
+ float glossiness; // Glossiness level (Ranges from 0 to 1000)
+ } Material;
+
+ // Camera type, defines a camera position/orientation in 3d space
+ typedef struct Camera {
+ Vector3 position; // Camera position
+ Vector3 target; // Camera target it looks-at
+ Vector3 up; // Camera up vector (rotation over its axis)
+ float fovy; // Camera field-of-view apperture in Y (degrees)
+ } Camera;
+
+ // Texture parameters: filter mode
+ // NOTE 1: Filtering considers mipmaps if available in the texture
+ // NOTE 2: Filter is accordingly set for minification and magnification
+ typedef enum {
+ FILTER_POINT = 0, // No filter, just pixel aproximation
+ FILTER_BILINEAR, // Linear filtering
+ FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
+ FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x
+ FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x
+ FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x
+ } TextureFilterMode;
- // 3d Model type
- typedef struct Model {
- Mesh mesh;
- Matrix transform;
- Texture2D texture;
- Shader shader;
- } Model;
-
+ // Texture parameters: wrap mode
+ typedef enum { WRAP_REPEAT = 0, WRAP_CLAMP, WRAP_MIRROR } TextureWrapMode;
+
// 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;
+
+ // VR Head Mounted Display devices
+ typedef enum {
+ HMD_DEFAULT_DEVICE = 0,
+ HMD_OCULUS_RIFT_DK2,
+ HMD_OCULUS_RIFT_CV1,
+ HMD_VALVE_HTC_VIVE,
+ HMD_SAMSUNG_GEAR_VR,
+ HMD_GOOGLE_CARDBOARD,
+ HMD_SONY_PLAYSTATION_VR,
+ HMD_RAZER_OSVR,
+ HMD_FOVE_VR,
+ } VrDevice;
#endif
#ifdef __cplusplus
@@ -213,6 +303,7 @@ void rlScalef(float x, float y, float z); // Multiply the current matrix b
void rlMultMatrixf(float *mat); // Multiply the current matrix by another matrix
void rlFrustum(double left, double right, double bottom, double top, double near, double far);
void rlOrtho(double left, double right, double bottom, double top, double near, double far);
+void rlViewport(int x, int y, int width, int height); // Set the viewport area
//------------------------------------------------------------------------------------
// Functions Declaration - Vertex level operations
@@ -234,45 +325,51 @@ void rlColor4f(float x, float y, float z, float w); // Define one vertex (color)
//------------------------------------------------------------------------------------
void rlEnableTexture(unsigned int id); // Enable texture usage
void rlDisableTexture(void); // Disable texture usage
+void rlTextureParameters(unsigned int id, int param, int value); // Set texture parameters (filter, wrap)
+void rlEnableRenderTexture(unsigned int id); // Enable render texture (fbo)
+void rlDisableRenderTexture(void); // Disable render texture (fbo), return to default framebuffer
+void rlEnableDepthTest(void); // Enable depth test
+void rlDisableDepthTest(void); // Disable depth test
+void rlEnableWireMode(void); // Enable wire mode
+void rlDisableWireMode(void); // Disable wire mode
void rlDeleteTextures(unsigned int id); // Delete OpenGL texture from GPU
+void rlDeleteRenderTextures(RenderTexture2D target); // Delete render textures (fbo) from GPU
void rlDeleteShader(unsigned int id); // Delete OpenGL shader program from GPU
void rlDeleteVertexArrays(unsigned int id); // Unload vertex data (VAO) from GPU memory
void rlDeleteBuffers(unsigned int id); // Unload vertex data (VBO) from GPU memory
void rlClearColor(byte r, byte g, byte b, byte a); // Clear color buffer with color
void rlClearScreenBuffers(void); // Clear used screen buffers (color and depth)
int rlGetVersion(void); // Returns current OpenGL version
-void rlEnablePostproFBO(void); // Enable rendering to postprocessing FBO
//------------------------------------------------------------------------------------
// Functions Declaration - rlgl functionality
//------------------------------------------------------------------------------------
-void rlglInit(void); // Initialize rlgl (shaders, VAO, VBO...)
+void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states)
void rlglClose(void); // De-init rlgl
void rlglDraw(void); // Draw VAO/VBO
-void rlglInitGraphics(int offsetX, int offsetY, int width, int height); // Initialize Graphics (OpenGL stuff)
+void rlglLoadExtensions(void *loader); // Load OpenGL extensions
unsigned int rlglLoadTexture(void *data, int width, int height, int textureFormat, int mipmapCount); // Load texture in GPU
-void rlglUpdateTexture(unsigned int id, int width, int height, int format, void *data); // Update GPU texture with new data
-void rlglGenerateMipmaps(Texture2D texture); // Generate mipmap data for selected texture
-
-// NOTE: There is a set of shader related functions that are available to end user,
-// to avoid creating function wrappers through core module, they have been directly declared in raylib.h
+RenderTexture2D rlglLoadRenderTexture(int width, int height); // Load a texture to be used for rendering (fbo with color and depth attachments)
+void rlglUpdateTexture(unsigned int id, int width, int height, int format, const void *data); // Update GPU texture with new data
+void rlglGenerateMipmaps(Texture2D *texture); // Generate mipmap data for selected texture
-void rlglInitPostpro(void); // Initialize postprocessing system
-void rlglDrawPostpro(void); // Draw with postprocessing shader
-
-Model rlglLoadModel(Mesh mesh); // Upload vertex data into GPU and provided VAO/VBO ids
-void rlglDrawModel(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color color, bool wires);
+void rlglLoadMesh(Mesh *mesh, bool dynamic); // Upload vertex data into GPU and provided VAO/VBO ids
+void rlglUpdateMesh(Mesh mesh, int buffer, int numVertex); // Update vertex data on GPU (upload new data to one buffer)
+void rlglDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform
+void rlglUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU
Vector3 rlglUnproject(Vector3 source, Matrix proj, Matrix view); // Get world coordinates from screen coordinates
unsigned char *rlglReadScreenPixels(int width, int height); // Read screen pixel data (color buffer)
void *rlglReadTexturePixels(Texture2D texture); // Read texture pixel data
-#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
-void PrintProjectionMatrix(void); // DEBUG: Print projection matrix
-void PrintModelviewMatrix(void); // DEBUG: Print modelview matrix
-#endif
+// VR functions exposed to core module but not to raylib users
+void BeginVrDrawing(void); // Begin VR drawing configuration
+void EndVrDrawing(void); // End VR drawing process (and desktop mirror)
+
+// NOTE: There is a set of shader related functions that are available to end user,
+// to avoid creating function wrappers through core module, they have been directly declared in raylib.h
#if defined(RLGL_STANDALONE)
//------------------------------------------------------------------------------------
@@ -280,23 +377,41 @@ void PrintModelviewMatrix(void); // DEBUG: Print modelview matrix
// NOTE: This functions are useless when using OpenGL 1.1
//------------------------------------------------------------------------------------
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
-unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr); // Load custom shader strings and return program id
void UnloadShader(Shader shader); // Unload a custom shader from memory
-void SetPostproShader(Shader shader); // Set fullscreen postproduction shader
-void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
-void SetDefaultShader(void); // Set default shader to be used in batch draw
-void SetModelShader(Model *model, Shader shader); // Link a shader to a model
-bool IsPosproShaderEnabled(void); // Check if postprocessing shader is enabled
-
-int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
-void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // Set shader uniform value (float)
-void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int)
-void SetShaderMapDiffuse(Shader *shader, Texture2D texture); // Default diffuse shader map texture assignment
-void SetShaderMapNormal(Shader *shader, const char *uniformName, Texture2D texture); // Normal map texture shader assignment
-void SetShaderMapSpecular(Shader *shader, const char *uniformName, Texture2D texture); // Specular map texture shader assignment
-void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textureUnit); // TODO: Generic shader map assignment
-
-void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied)
+
+Shader GetDefaultShader(void); // Get default shader
+Shader GetStandardShader(void); // Get default shader
+Texture2D GetDefaultTexture(void); // Get default texture
+
+int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
+void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // Set shader uniform value (float)
+void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int)
+void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
+
+void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix)
+void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix)
+
+void BeginShaderMode(Shader shader); // Begin custom shader drawing
+void EndShaderMode(void); // End custom shader drawing (use default shader)
+void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
+void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
+
+void TraceLog(int msgType, const char *text, ...);
+float *MatrixToFloat(Matrix mat);
+
+void InitVrDevice(int vrDevice); // Init VR device
+void CloseVrDevice(void); // Close VR device
+bool IsVrDeviceReady(void); // Detect if VR device is ready
+bool IsVrSimulator(void); // Detect if VR simulator is running
+void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
+void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
+
+// Oculus Rift API for direct access the device (no simulator)
+bool InitOculusDevice(void); // Initialize Oculus device (returns true if success)
+void CloseOculusDevice(void); // Close Oculus device
+void UpdateOculusTracking(Camera *camera); // Update Oculus head position-orientation tracking (and camera)
+void BeginOculusDrawing(void); // Setup Oculus buffers for drawing
+void EndOculusDrawing(void); // Finish Oculus drawing and blit framebuffer to mirror
#endif
#ifdef __cplusplus