From d0301ca89d318d8d6e3e7fde9c4b60e470e184e4 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 7 Jan 2013 13:47:34 -0600 Subject: Revert 30dd9c2 e9d00bf db5f4c8 and bff0fae --- Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp') diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index d2f77cd256..49739b7f6e 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -96,11 +96,12 @@ void SWRenderer::RenderText(const char* pstr, int left, int top, u32 color) #ifndef USE_GLES int nBackbufferWidth = (int)GLInterface->GetBackBufferWidth(); int nBackbufferHeight = (int)GLInterface->GetBackBufferHeight(); - + glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f, + ((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f); s_pfont->printMultilineText(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight, - 0, nBackbufferWidth, nBackbufferHeight, color); + 0, nBackbufferWidth, nBackbufferHeight); #endif } -- cgit v1.2.3 From ff9ba6777327d07291bd8682e38931b77fea463d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 19 Jan 2013 00:51:00 -0600 Subject: Remove the dependency on rectangle textures in the software rasterizer. Also make it the be used by default in the software renderer like it was before. --- .../Plugin_VideoSoftware/Src/SWRenderer.cpp | 68 +++++++++------------- 1 file changed, 27 insertions(+), 41 deletions(-) (limited to 'Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp') diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index 49739b7f6e..16ac1c3cd0 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -52,10 +52,10 @@ void CreateShaders() { static const char *fragShaderText = "varying " PREC " vec2 TexCoordOut;\n" - "uniform " TEXTYPE " Texture;\n" + "uniform sampler2D Texture;\n" "void main() {\n" " " PREC " vec4 tmpcolor;\n" - " tmpcolor = " TEXFUNC "(Texture, TexCoordOut);\n" + " tmpcolor = texture2D(Texture, TexCoordOut);\n" " gl_FragColor = tmpcolor;\n" "}\n"; static const char *vertShaderText = @@ -63,7 +63,7 @@ void CreateShaders() "attribute vec2 TexCoordIn;\n " "varying vec2 TexCoordOut;\n " "void main() {\n" - " gl_Position = pos;\n" + " gl_Position = pos;\n" " TexCoordOut = TexCoordIn;\n" "}\n"; @@ -74,6 +74,23 @@ void CreateShaders() uni_tex = glGetUniformLocation(program, "Texture"); attr_pos = glGetAttribLocation(program, "pos"); attr_tex = glGetAttribLocation(program, "TexCoordIn"); + + static const GLfloat verts[4][2] = { + { -1, -1}, // Left top + { -1, 1}, // left bottom + { 1, 1}, // right bottom + { 1, -1} // right top + }; + static const GLfloat texverts[4][2] = { + {0, 1}, + {0, 0}, + {1, 0}, + {1, 1} + }; + + glUniform1i(uni_tex, 0); + glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts); + glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts); } void SWRenderer::Prepare() @@ -86,7 +103,7 @@ void SWRenderer::Prepare() // TODO: Enable for GLES once RasterFont supports GLES #ifndef USE_GLES s_pfont = new RasterFont(); - glEnable(GL_TEXTURE_RECTANGLE_ARB); + glEnable(GL_TEXTURE_2D); #endif GL_REPORT_ERRORD(); } @@ -142,48 +159,20 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) glViewport(0, 0, glWidth, glHeight); glScissor(0, 0, glWidth, glHeight); - glBindTexture(TEX2D, s_RenderTarget); + glBindTexture(GL_TEXTURE_2D, s_RenderTarget); - glTexImage2D(TEX2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture); - glTexParameteri(TEX2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(TEX2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)width, (GLsizei)height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - static const GLfloat verts[4][2] = { - { -1, -1}, // Left top - { -1, 1}, // left bottom - { 1, 1}, // right bottom - { 1, -1} // right top - }; - //Texture rectangle uses pixel coordinates -#ifndef USE_GLES - GLfloat u_max = (GLfloat)width; - GLfloat v_max = (GLfloat)height; - - static const GLfloat texverts[4][2] = { - {0, v_max}, - {0, 0}, - {u_max, 0}, - {u_max, v_max} - }; -#else - static const GLfloat texverts[4][2] = { - {0, 1}, - {0, 0}, - {1, 0}, - {1, 1} - }; -#endif - glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts); - glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts); glEnableVertexAttribArray(attr_pos); glEnableVertexAttribArray(attr_tex); glActiveTexture(GL_TEXTURE0); - glUniform1i(uni_tex, 0); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableVertexAttribArray(attr_pos); glDisableVertexAttribArray(attr_tex); - glBindTexture(TEX2D, 0); + glBindTexture(GL_TEXTURE_2D, 0); GL_REPORT_ERRORD(); } @@ -195,11 +184,8 @@ void SWRenderer::SwapBuffer() GLInterface->Swap(); - swstats.ResetFrame(); + swstats.ResetFrame(); -#ifndef USE_GLES - glClearDepth(1.0f); -#endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GL_REPORT_ERRORD(); -- cgit v1.2.3 From 621204f3e86212de77e10285b9cfd70b95c8fd8d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 19 Jan 2013 02:18:39 -0600 Subject: Fix switching from the different rasterizers --- .../Plugin_VideoSoftware/Src/SWRenderer.cpp | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp') diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index 16ac1c3cd0..fb472cfdba 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -75,22 +75,7 @@ void CreateShaders() attr_pos = glGetAttribLocation(program, "pos"); attr_tex = glGetAttribLocation(program, "TexCoordIn"); - static const GLfloat verts[4][2] = { - { -1, -1}, // Left top - { -1, 1}, // left bottom - { 1, 1}, // right bottom - { 1, -1} // right top - }; - static const GLfloat texverts[4][2] = { - {0, 1}, - {0, 0}, - {1, 0}, - {1, 1} - }; - - glUniform1i(uni_tex, 0); - glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts); - glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts); + } void SWRenderer::Prepare() @@ -165,8 +150,25 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glUseProgram(program); + static const GLfloat verts[4][2] = { + { -1, -1}, // Left top + { -1, 1}, // left bottom + { 1, 1}, // right bottom + { 1, -1} // right top + }; + static const GLfloat texverts[4][2] = { + {0, 1}, + {0, 0}, + {1, 0}, + {1, 1} + }; + + glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts); + glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts); glEnableVertexAttribArray(attr_pos); glEnableVertexAttribArray(attr_tex); + glUniform1i(uni_tex, 0); glActiveTexture(GL_TEXTURE0); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDisableVertexAttribArray(attr_pos); -- cgit v1.2.3 From d60cc373d1b389215eb63c4e20fe24e902680c7a Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 24 Jan 2013 16:11:07 +0100 Subject: Revert "Revert 30dd9c2 e9d00bf db5f4c8 and bff0fae" This reverts commit d0301ca89d318d8d6e3e7fde9c4b60e470e184e4. Conflicts: .gitignore --- Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp') diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp index fb472cfdba..9d2ad1e254 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp @@ -98,12 +98,11 @@ void SWRenderer::RenderText(const char* pstr, int left, int top, u32 color) #ifndef USE_GLES int nBackbufferWidth = (int)GLInterface->GetBackBufferWidth(); int nBackbufferHeight = (int)GLInterface->GetBackBufferHeight(); - glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f, - ((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f); + s_pfont->printMultilineText(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight, - 0, nBackbufferWidth, nBackbufferHeight); + 0, nBackbufferWidth, nBackbufferHeight, color); #endif } -- cgit v1.2.3