Draw: Limpiar correctamente la pantalla cuando se usa OpenGLES. Realmente dibuja un polígono blanco sobre toda la pantalla

This commit is contained in:
2014-08-25 01:52:34 +02:00
committed by Valeriano A.R
parent 89c43d8206
commit aee23413b6

View File

@@ -68,6 +68,8 @@ float _color[4];
#if USE_OpenGLES
GLuint _whiteTex;
GLuint Draw_CompileShader(GLenum type, const char *source){
GLuint shader = glCreateShader(type);
if (shader == 0) {
@@ -132,6 +134,8 @@ GLuint vertexObject;
#endif
GLuint Draw_UploadGLTexture(int w, int h, unsigned char *pixels);
/////////////////////////////
// Draw_Init
//
@@ -303,6 +307,9 @@ int Draw_Init(int width,int height,char *title,int pfps,int fps){
glUniformMatrix4fv(projectionMatrixLoc,
1, GL_FALSE, projectionMatrix);
unsigned char whiteTexData[4]={255,255,255,255};
_whiteTex=Draw_UploadGLTexture(1, 1, whiteTexData);
#endif
// Enable Alpha blending
@@ -429,6 +436,7 @@ void Draw_Clean(
0.0, 0.0, // TexCoord 0
fr, fg, fb, 1.0, // Color
};
glBindTexture(GL_TEXTURE_2D, _whiteTex);
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vVertices), vVertices);
glDrawArrays(GL_TRIANGLES, 0, 6);
#endif