mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed bug 4453 - GLES / GLES2: first white renderer clear cmd is drawn as black
This commit is contained in:
parent
7b42f03fd9
commit
be991f3a78
@ -26,8 +26,8 @@
|
|||||||
#include "SDL_opengles.h"
|
#include "SDL_opengles.h"
|
||||||
#include "../SDL_sysrender.h"
|
#include "../SDL_sysrender.h"
|
||||||
|
|
||||||
/* To prevent unnecessary window recreation,
|
/* To prevent unnecessary window recreation,
|
||||||
* these should match the defaults selected in SDL_GL_ResetAttributes
|
* these should match the defaults selected in SDL_GL_ResetAttributes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RENDERER_CONTEXT_MAJOR 1
|
#define RENDERER_CONTEXT_MAJOR 1
|
||||||
@ -170,7 +170,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data)
|
|||||||
#define SDL_PROC_OES(ret,func,params) \
|
#define SDL_PROC_OES(ret,func,params) \
|
||||||
do { \
|
do { \
|
||||||
data->func = SDL_GL_GetProcAddress(#func); \
|
data->func = SDL_GL_GetProcAddress(#func); \
|
||||||
} while ( 0 );
|
} while ( 0 );
|
||||||
#endif /* __SDL_NOGETPROCADDR__ */
|
#endif /* __SDL_NOGETPROCADDR__ */
|
||||||
|
|
||||||
#include "SDL_glesfuncs.h"
|
#include "SDL_glesfuncs.h"
|
||||||
@ -351,7 +351,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
if (texture->access == SDL_TEXTUREACCESS_TARGET) {
|
||||||
if (!renderdata->GL_OES_framebuffer_object_supported) {
|
if (!renderdata->GL_OES_framebuffer_object_supported) {
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
@ -361,7 +361,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||||||
} else {
|
} else {
|
||||||
data->fbo = NULL;
|
data->fbo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
renderdata->glGetError();
|
renderdata->glGetError();
|
||||||
renderdata->glEnable(GL_TEXTURE_2D);
|
renderdata->glEnable(GL_TEXTURE_2D);
|
||||||
@ -397,7 +397,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
return GLES_SetError("glTexImage2D()", result);
|
return GLES_SetError("glTexImage2D()", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
texture->driverdata = data;
|
texture->driverdata = data;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1210,6 +1210,8 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||||||
data->glEnableClientState(GL_VERTEX_ARRAY);
|
data->glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
data->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
|
||||||
|
data->glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
||||||
data->drawstate.color = 0xFFFFFFFF;
|
data->drawstate.color = 0xFFFFFFFF;
|
||||||
data->drawstate.clear_color = 0xFFFFFFFF;
|
data->drawstate.clear_color = 0xFFFFFFFF;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "SDL_shaders_gles2.h"
|
#include "SDL_shaders_gles2.h"
|
||||||
|
|
||||||
/* To prevent unnecessary window recreation,
|
/* To prevent unnecessary window recreation,
|
||||||
* these should match the defaults selected in SDL_GL_ResetAttributes
|
* these should match the defaults selected in SDL_GL_ResetAttributes
|
||||||
*/
|
*/
|
||||||
#define RENDERER_CONTEXT_MAJOR 2
|
#define RENDERER_CONTEXT_MAJOR 2
|
||||||
#define RENDERER_CONTEXT_MINOR 0
|
#define RENDERER_CONTEXT_MINOR 0
|
||||||
@ -2076,6 +2076,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
|
|||||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES;
|
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set up parameters for rendering */
|
||||||
data->glActiveTexture(GL_TEXTURE0);
|
data->glActiveTexture(GL_TEXTURE0);
|
||||||
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
data->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
@ -2083,6 +2084,8 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
|
|||||||
data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION);
|
data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_POSITION);
|
||||||
data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD);
|
data->glDisableVertexAttribArray(GLES2_ATTRIBUTE_TEXCOORD);
|
||||||
|
|
||||||
|
data->glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
data->drawstate.blend = SDL_BLENDMODE_INVALID;
|
||||||
data->drawstate.color = 0xFFFFFFFF;
|
data->drawstate.color = 0xFFFFFFFF;
|
||||||
data->drawstate.clear_color = 0xFFFFFFFF;
|
data->drawstate.clear_color = 0xFFFFFFFF;
|
||||||
|
Loading…
Reference in New Issue
Block a user