Review some issues, view description
- Review RPI compilation (core_drop_files not supported) - Review ImageFormat(), some issues - GetTextureData() reviewed for RPI
This commit is contained in:
parent
f460b3842e
commit
415e7e972c
@ -267,7 +267,6 @@ EXAMPLES = \
|
|||||||
core/core_input_gamepad \
|
core/core_input_gamepad \
|
||||||
core/core_random_values \
|
core/core_random_values \
|
||||||
core/core_color_select \
|
core/core_color_select \
|
||||||
core/core_drop_files \
|
|
||||||
core/core_storage_values \
|
core/core_storage_values \
|
||||||
core/core_gestures_detection \
|
core/core_gestures_detection \
|
||||||
core/core_3d_mode \
|
core/core_3d_mode \
|
||||||
@ -327,6 +326,10 @@ EXAMPLES = \
|
|||||||
physac/physics_shatter \
|
physac/physics_shatter \
|
||||||
fix_dylib \
|
fix_dylib \
|
||||||
|
|
||||||
|
ifneq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
EXAMPLES += core/core_drop_files
|
||||||
|
endif
|
||||||
|
|
||||||
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
|
CURRENT_MAKEFILE = $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
# Default target entry
|
# Default target entry
|
||||||
|
@ -2226,8 +2226,8 @@ void *rlReadTexturePixels(Texture2D texture)
|
|||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
//glDisable(GL_BLEND);
|
//glDisable(GL_BLEND);
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, texture.width, texture.height);
|
||||||
rlOrtho(0.0, width, height, 0.0, 0.0, 1.0);
|
rlOrtho(0.0, texture.width, texture.height, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
glUseProgram(GetShaderDefault().id);
|
glUseProgram(GetShaderDefault().id);
|
||||||
|
@ -536,14 +536,13 @@ Image GetTextureData(Texture2D texture)
|
|||||||
{
|
{
|
||||||
image.width = texture.width;
|
image.width = texture.width;
|
||||||
image.height = texture.height;
|
image.height = texture.height;
|
||||||
|
image.format = texture.format;
|
||||||
image.mipmaps = 1;
|
image.mipmaps = 1;
|
||||||
|
|
||||||
if (rlGetVersion() == OPENGL_ES_20)
|
// NOTE: Data retrieved on OpenGL ES 2.0 should be RGBA
|
||||||
{
|
// coming from FBO color buffer, but it seems original
|
||||||
// NOTE: Data retrieved on OpenGL ES 2.0 comes as RGBA (from framebuffer)
|
// texture format is retrieved on RPI... weird...
|
||||||
image.format = UNCOMPRESSED_R8G8B8A8;
|
//image.format = UNCOMPRESSED_R8G8B8A8;
|
||||||
}
|
|
||||||
else image.format = texture.format;
|
|
||||||
|
|
||||||
TraceLog(LOG_INFO, "Texture pixel data obtained successfully");
|
TraceLog(LOG_INFO, "Texture pixel data obtained successfully");
|
||||||
}
|
}
|
||||||
@ -622,9 +621,9 @@ void ImageFormat(Image *image, int newFormat)
|
|||||||
|
|
||||||
for (int i = 0; i < image->width*image->height; i++)
|
for (int i = 0; i < image->width*image->height; i++)
|
||||||
{
|
{
|
||||||
r = (unsigned char)(round((float)pixels[k].r*31/255));
|
r = (unsigned char)(round((float)pixels[i].r*31.0f/255));
|
||||||
g = (unsigned char)(round((float)pixels[k].g*63/255));
|
g = (unsigned char)(round((float)pixels[i].g*63.0f/255));
|
||||||
b = (unsigned char)(round((float)pixels[k].b*31/255));
|
b = (unsigned char)(round((float)pixels[i].b*31.0f/255));
|
||||||
|
|
||||||
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 5 | (unsigned short)b;
|
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 5 | (unsigned short)b;
|
||||||
}
|
}
|
||||||
@ -655,9 +654,9 @@ void ImageFormat(Image *image, int newFormat)
|
|||||||
|
|
||||||
for (int i = 0; i < image->width*image->height; i++)
|
for (int i = 0; i < image->width*image->height; i++)
|
||||||
{
|
{
|
||||||
r = (unsigned char)(round((float)pixels[i].r*31/255));
|
r = (unsigned char)(round((float)pixels[i].r*31.0f/255));
|
||||||
g = (unsigned char)(round((float)pixels[i].g*31/255));
|
g = (unsigned char)(round((float)pixels[i].g*31.0f/255));
|
||||||
b = (unsigned char)(round((float)pixels[i].b*31/255));
|
b = (unsigned char)(round((float)pixels[i].b*31.0f/255));
|
||||||
a = (pixels[i].a > ALPHA_THRESHOLD) ? 1 : 0;
|
a = (pixels[i].a > ALPHA_THRESHOLD) ? 1 : 0;
|
||||||
|
|
||||||
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a;
|
((unsigned short *)image->data)[i] = (unsigned short)r << 11 | (unsigned short)g << 6 | (unsigned short)b << 1 | (unsigned short)a;
|
||||||
@ -675,12 +674,12 @@ void ImageFormat(Image *image, int newFormat)
|
|||||||
|
|
||||||
for (int i = 0; i < image->width*image->height; i++)
|
for (int i = 0; i < image->width*image->height; i++)
|
||||||
{
|
{
|
||||||
r = (unsigned char)(round((float)pixels[i].r*15/255));
|
r = (unsigned char)(round((float)pixels[i].r*15.0f/255));
|
||||||
g = (unsigned char)(round((float)pixels[i].g*15/255));
|
g = (unsigned char)(round((float)pixels[i].g*15.0f/255));
|
||||||
b = (unsigned char)(round((float)pixels[i].b*15/255));
|
b = (unsigned char)(round((float)pixels[i].b*15.0f/255));
|
||||||
a = (unsigned char)(round((float)pixels[i].a*15/255));
|
a = (unsigned char)(round((float)pixels[i].a*15.0f/255));
|
||||||
|
|
||||||
((unsigned short *)image->data)[i] = (unsigned short)r << 12 | (unsigned short)g << 8| (unsigned short)b << 4| (unsigned short)a;
|
((unsigned short *)image->data)[i] = (unsigned short)r << 12 | (unsigned short)g << 8 | (unsigned short)b << 4 | (unsigned short)a;
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@ -801,7 +800,7 @@ void ImageToPOT(Image *image, Color fillColor)
|
|||||||
// Copy an image to a new image
|
// Copy an image to a new image
|
||||||
Image ImageCopy(Image image)
|
Image ImageCopy(Image image)
|
||||||
{
|
{
|
||||||
Image newImage;
|
Image newImage = { 0 };
|
||||||
|
|
||||||
int byteSize = image.width*image.height;
|
int byteSize = image.width*image.height;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user