diff options
| author | raysan5 <raysan5@gmail.com> | 2016-03-30 20:09:16 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-03-30 20:09:16 +0200 |
| commit | 66b096d97848eb096a043781f1f305e7189f2a00 (patch) | |
| tree | cf87fdd3f4bc46dc93dcaa2f189a5d1dd1e3f32b /src/raylib.h | |
| parent | 1136d4222f81524c10b2319b325fcf1282bc6ec1 (diff) | |
| download | raylib-66b096d97848eb096a043781f1f305e7189f2a00.tar.gz raylib-66b096d97848eb096a043781f1f305e7189f2a00.zip | |
Added support for render to texture (use RenderTexture2D)
Now it's possible to render to texture, old postprocessing system will
be removed on next raylib version.
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/raylib.h b/src/raylib.h index 2b65df9e..c8f2c2a2 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -324,6 +324,13 @@ typedef struct Texture2D { 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; + // SpriteFont type, includes texture and charSet array data typedef struct SpriteFont { Texture2D texture; // Font texture @@ -565,6 +572,8 @@ void EndDrawing(void); // End canvas drawin void Begin3dMode(Camera camera); // Initializes 3D mode for drawing (Camera setup) void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode +void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing +void EndTextureMode(void); // Ends drawing to render texture Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position Vector2 WorldToScreen(Vector3 position, Camera camera); // Returns the screen space position from a 3d world space position @@ -714,8 +723,10 @@ Texture2D LoadTexture(const char *fileName); Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat); // Load a texture from raw data into GPU memory Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource) Texture2D LoadTextureFromImage(Image image); // Load a texture from image data +RenderTexture2D LoadRenderTexture(int width, int height); // Load a texture to be used for rendering void UnloadImage(Image image); // Unload image from CPU memory (RAM) void UnloadTexture(Texture2D texture); // Unload texture from GPU memory +void UnloadRenderTexture(RenderTexture2D target); // Unload render texture from GPU memory Color *GetImageData(Image image); // Get pixel data from image as a Color struct array Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) |
