Update rlgl.h
This commit is contained in:
parent
c1d9489294
commit
6f3b2a7661
1 changed files with 9 additions and 9 deletions
18
src/rlgl.h
18
src/rlgl.h
|
@ -641,7 +641,7 @@ RLAPI unsigned int rlLoadTexture(const void *data, int width, int height, int fo
|
||||||
RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo)
|
RLAPI unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer); // Load depth texture/renderbuffer (to be attached to fbo)
|
||||||
RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap
|
RLAPI unsigned int rlLoadTextureCubemap(const void *data, int size, int format); // Load texture cubemap
|
||||||
RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update GPU texture with new data
|
RLAPI void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data); // Update GPU texture with new data
|
||||||
RLAPI void rlGetGlTextureFormats(int format, int *glInternalFormat, int *glFormat, int *glType); // Get OpenGL internal formats
|
RLAPI void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType); // Get OpenGL internal formats
|
||||||
RLAPI const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format
|
RLAPI const char *rlGetPixelFormatName(unsigned int format); // Get name string for pixel format
|
||||||
RLAPI void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory
|
RLAPI void rlUnloadTexture(unsigned int id); // Unload texture from GPU memory
|
||||||
RLAPI void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps); // Generate mipmap data for selected texture
|
RLAPI void rlGenTextureMipmaps(unsigned int id, int width, int height, int format, int *mipmaps); // Generate mipmap data for selected texture
|
||||||
|
@ -2772,7 +2772,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
|
||||||
{
|
{
|
||||||
unsigned int mipSize = rlGetPixelDataSize(mipWidth, mipHeight, format);
|
unsigned int mipSize = rlGetPixelDataSize(mipWidth, mipHeight, format);
|
||||||
|
|
||||||
int glInternalFormat, glFormat, glType;
|
unsigned int glInternalFormat, glFormat, glType;
|
||||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||||
|
|
||||||
TRACELOGD("TEXTURE: Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset);
|
TRACELOGD("TEXTURE: Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset);
|
||||||
|
@ -2922,7 +2922,7 @@ unsigned int rlLoadTextureCubemap(const void *data, int size, int format)
|
||||||
glGenTextures(1, &id);
|
glGenTextures(1, &id);
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, id);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, id);
|
||||||
|
|
||||||
int glInternalFormat, glFormat, glType;
|
unsigned int glInternalFormat, glFormat, glType;
|
||||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||||
|
|
||||||
if (glInternalFormat != -1)
|
if (glInternalFormat != -1)
|
||||||
|
@ -2994,7 +2994,7 @@ void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int h
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, id);
|
glBindTexture(GL_TEXTURE_2D, id);
|
||||||
|
|
||||||
int glInternalFormat, glFormat, glType;
|
unsigned int glInternalFormat, glFormat, glType;
|
||||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||||
|
|
||||||
if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB))
|
if ((glInternalFormat != -1) && (format < RL_PIXELFORMAT_COMPRESSED_DXT1_RGB))
|
||||||
|
@ -3005,11 +3005,11 @@ void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int h
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get OpenGL internal formats and data type from raylib PixelFormat
|
// Get OpenGL internal formats and data type from raylib PixelFormat
|
||||||
void rlGetGlTextureFormats(int format, int *glInternalFormat, int *glFormat, int *glType)
|
void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType)
|
||||||
{
|
{
|
||||||
*glInternalFormat = -1;
|
*glInternalFormat = 0;
|
||||||
*glFormat = -1;
|
*glFormat = 0;
|
||||||
*glType = -1;
|
*glType = 0;
|
||||||
|
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
|
@ -3152,7 +3152,7 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
|
||||||
// GL_UNPACK_ALIGNMENT affects operations that write to OpenGL memory (glTexImage, etc.)
|
// GL_UNPACK_ALIGNMENT affects operations that write to OpenGL memory (glTexImage, etc.)
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
|
|
||||||
int glInternalFormat, glFormat, glType;
|
unsigned int glInternalFormat, glFormat, glType;
|
||||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||||
unsigned int size = rlGetPixelDataSize(width, height, format);
|
unsigned int size = rlGetPixelDataSize(width, height, format);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue