mirror of
https://github.com/raysan5/raylib.git
synced 2026-10-11 04:01:54 -04:00
Compare commits
4 Commits
9f3cadf1e6
...
9b2efc4552
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b2efc4552 | |||
| 5a433a51a3 | |||
| 237c1f85dd | |||
| 656d42c4da |
@ -1461,6 +1461,7 @@ RLAPI Texture2D LoadTexture(const char *fileName);
|
|||||||
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
RLAPI Texture2D LoadTextureFromImage(Image image); // Load texture from image data
|
||||||
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
RLAPI TextureCubemap LoadTextureCubemap(Image image, int layout); // Load cubemap from image, multiple image cubemap layouts supported
|
||||||
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
RLAPI RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
|
||||||
|
RLAPI RenderTexture2D LoadRenderTextureEx(int width, int height, int format); // Load texture for rendering (framebuffer), with specific format
|
||||||
RLAPI bool IsTextureValid(Texture2D texture); // Check if texture is valid (loaded in GPU)
|
RLAPI bool IsTextureValid(Texture2D texture); // Check if texture is valid (loaded in GPU)
|
||||||
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
RLAPI void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)
|
||||||
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if render texture is valid (loaded in GPU)
|
RLAPI bool IsRenderTextureValid(RenderTexture2D target); // Check if render texture is valid (loaded in GPU)
|
||||||
|
|||||||
@ -994,6 +994,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
|||||||
#if !defined(GRAPHICS_API_OPENGL_ES3)
|
#if !defined(GRAPHICS_API_OPENGL_ES3)
|
||||||
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
#define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
|
||||||
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
#define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
|
||||||
|
#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1847,7 +1848,7 @@ void rlEnableFramebuffer(unsigned int id)
|
|||||||
unsigned int rlGetActiveFramebuffer(void)
|
unsigned int rlGetActiveFramebuffer(void)
|
||||||
{
|
{
|
||||||
GLint fboId = 0;
|
GLint fboId = 0;
|
||||||
#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3) || defined(GRAPHICS_API_OPENGL_SOFTWARE))
|
#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_SOFTWARE))
|
||||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboId);
|
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboId);
|
||||||
#endif
|
#endif
|
||||||
return fboId;
|
return fboId;
|
||||||
|
|||||||
@ -3977,10 +3977,10 @@ void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color col
|
|||||||
|
|
||||||
while (y >= x)
|
while (y >= x)
|
||||||
{
|
{
|
||||||
ImageDrawRectangle(dst, centerX - x, centerY + y, x*2, 1, color);
|
ImageDrawRectangle(dst, centerX - x, centerY + y, x*2 + 1, 1, color);
|
||||||
ImageDrawRectangle(dst, centerX - x, centerY - y, x*2, 1, color);
|
ImageDrawRectangle(dst, centerX - x, centerY - y, x*2 + 1, 1, color);
|
||||||
ImageDrawRectangle(dst, centerX - y, centerY + x, y*2, 1, color);
|
ImageDrawRectangle(dst, centerX - y, centerY + x, y*2 + 1, 1, color);
|
||||||
ImageDrawRectangle(dst, centerX - y, centerY - x, y*2, 1, color);
|
ImageDrawRectangle(dst, centerX - y, centerY - x, y*2 + 1, 1, color);
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
if (decesionParameter > 0)
|
if (decesionParameter > 0)
|
||||||
@ -4388,12 +4388,24 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
|||||||
return cubemap;
|
return cubemap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load texture for rendering (framebuffer)
|
// Load RGBA texture for rendering (framebuffer)
|
||||||
// NOTE: Render texture is loaded by default with RGBA color attachment and depth RenderBuffer
|
|
||||||
RenderTexture2D LoadRenderTexture(int width, int height)
|
RenderTexture2D LoadRenderTexture(int width, int height)
|
||||||
|
{
|
||||||
|
return LoadRenderTextureEx(width, height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load texture for rendering (framebuffer), with specific format
|
||||||
|
// NOTE: Render texture is loaded by default with RGBA color attachment and depth RenderBuffer
|
||||||
|
RLAPI RenderTexture2D LoadRenderTextureEx(int width, int height, int format)
|
||||||
{
|
{
|
||||||
RenderTexture2D target = { 0 };
|
RenderTexture2D target = { 0 };
|
||||||
|
|
||||||
|
if (format >= PIXELFORMAT_COMPRESSED_DXT1_RGB)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "FBO: Render texture format not supported");
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
target.id = rlLoadFramebuffer(); // Load an empty framebuffer
|
target.id = rlLoadFramebuffer(); // Load an empty framebuffer
|
||||||
|
|
||||||
if (target.id > 0)
|
if (target.id > 0)
|
||||||
@ -4401,10 +4413,10 @@ RenderTexture2D LoadRenderTexture(int width, int height)
|
|||||||
rlEnableFramebuffer(target.id);
|
rlEnableFramebuffer(target.id);
|
||||||
|
|
||||||
// Create color texture (default to RGBA)
|
// Create color texture (default to RGBA)
|
||||||
target.texture.id = rlLoadTexture(NULL, width, height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
|
target.texture.id = rlLoadTexture(NULL, width, height, format, 1);
|
||||||
target.texture.width = width;
|
target.texture.width = width;
|
||||||
target.texture.height = height;
|
target.texture.height = height;
|
||||||
target.texture.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
target.texture.format = format;
|
||||||
target.texture.mipmaps = 1;
|
target.texture.mipmaps = 1;
|
||||||
|
|
||||||
// Create depth renderbuffer/texture
|
// Create depth renderbuffer/texture
|
||||||
@ -5333,7 +5345,7 @@ Color GetPixelColor(const void *srcPtr, int format)
|
|||||||
{
|
{
|
||||||
color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255/31);
|
color.r = (unsigned char)((((unsigned short *)srcPtr)[0] >> 11)*255/31);
|
||||||
color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 6) & 0b0000000000011111)*255/31);
|
color.g = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 6) & 0b0000000000011111)*255/31);
|
||||||
color.b = (unsigned char)((((unsigned short *)srcPtr)[0] & 0b0000000000011111)*255/31);
|
color.b = (unsigned char)(((((unsigned short *)srcPtr)[0] >> 1) & 0b0000000000011111)*255/31);
|
||||||
color.a = (((unsigned short *)srcPtr)[0] & 0b0000000000000001)? 255 : 0;
|
color.a = (((unsigned short *)srcPtr)[0] & 0b0000000000000001)? 255 : 0;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
@ -9125,6 +9125,25 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "LoadRenderTextureEx",
|
||||||
|
"description": "Load texture for rendering (framebuffer), with specific format",
|
||||||
|
"returnType": "RenderTexture2D",
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "width"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "height"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "int",
|
||||||
|
"name": "format"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "IsTextureValid",
|
"name": "IsTextureValid",
|
||||||
"description": "Check if texture is valid (loaded in GPU)",
|
"description": "Check if texture is valid (loaded in GPU)",
|
||||||
|
|||||||
@ -6536,6 +6536,16 @@ return {
|
|||||||
{type = "int", name = "height"}
|
{type = "int", name = "height"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "LoadRenderTextureEx",
|
||||||
|
description = "Load texture for rendering (framebuffer), with specific format",
|
||||||
|
returnType = "RenderTexture2D",
|
||||||
|
params = {
|
||||||
|
{type = "int", name = "width"},
|
||||||
|
{type = "int", name = "height"},
|
||||||
|
{type = "int", name = "format"}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name = "IsTextureValid",
|
name = "IsTextureValid",
|
||||||
description = "Check if texture is valid (loaded in GPU)",
|
description = "Check if texture is valid (loaded in GPU)",
|
||||||
|
|||||||
@ -4930,6 +4930,14 @@
|
|||||||
((type "int") (name "width"))
|
((type "int") (name "width"))
|
||||||
((type "int") (name "height"))))
|
((type "int") (name "height"))))
|
||||||
|
|
||||||
|
((name "LoadRenderTextureEx")
|
||||||
|
(description "Load texture for rendering (framebuffer), with specific format")
|
||||||
|
(return-type "RenderTexture2D")
|
||||||
|
(params
|
||||||
|
((type "int") (name "width"))
|
||||||
|
((type "int") (name "height"))
|
||||||
|
((type "int") (name "format"))))
|
||||||
|
|
||||||
((name "IsTextureValid")
|
((name "IsTextureValid")
|
||||||
(description "Check if texture is valid (loaded in GPU)")
|
(description "Check if texture is valid (loaded in GPU)")
|
||||||
(return-type "bool")
|
(return-type "bool")
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -681,7 +681,7 @@
|
|||||||
<Param type="unsigned int" name="frames" desc="" />
|
<Param type="unsigned int" name="frames" desc="" />
|
||||||
</Callback>
|
</Callback>
|
||||||
</Callbacks>
|
</Callbacks>
|
||||||
<Functions count="617">
|
<Functions count="618">
|
||||||
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
<Function name="InitWindow" retType="void" paramCount="3" desc="Initialize window and OpenGL context">
|
||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
@ -2306,6 +2306,11 @@
|
|||||||
<Param type="int" name="width" desc="" />
|
<Param type="int" name="width" desc="" />
|
||||||
<Param type="int" name="height" desc="" />
|
<Param type="int" name="height" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name="LoadRenderTextureEx" retType="RenderTexture2D" paramCount="3" desc="Load texture for rendering (framebuffer), with specific format">
|
||||||
|
<Param type="int" name="width" desc="" />
|
||||||
|
<Param type="int" name="height" desc="" />
|
||||||
|
<Param type="int" name="format" desc="" />
|
||||||
|
</Function>
|
||||||
<Function name="IsTextureValid" retType="bool" paramCount="1" desc="Check if texture is valid (loaded in GPU)">
|
<Function name="IsTextureValid" retType="bool" paramCount="1" desc="Check if texture is valid (loaded in GPU)">
|
||||||
<Param type="Texture2D" name="texture" desc="" />
|
<Param type="Texture2D" name="texture" desc="" />
|
||||||
</Function>
|
</Function>
|
||||||
|
|||||||
Reference in New Issue
Block a user