summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2012-12-07 22:49:18 +0100
committerRyan Houdek <Sonicadvance1@gmail.com>2012-12-13 15:27:49 -0600
commit8b62be20253a282edc8308cd3ce541be5ecbbb70 (patch)
tree27d36bda0740214616eba4337cd3c6dfc7f7622e
parent6864b40e26354f6b366e8fe8c2ff4f6680f09189 (diff)
fix ShowEFBCopyRegions
those fancy colors were the result of the usage of non-allocated heap Signed-off-by: Ryan Houdek <Sonicadvance1@gmail.com>
-rw-r--r--Source/Core/VideoCommon/Src/BPFunctions.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp122
2 files changed, 90 insertions, 34 deletions
diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp
index cddeae3000..b9a76ba7b6 100644
--- a/Source/Core/VideoCommon/Src/BPFunctions.cpp
+++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp
@@ -236,7 +236,7 @@ bool GetConfig(const int &type)
case CONFIG_DISABLEFOG:
return g_ActiveConfig.bDisableFog;
case CONFIG_SHOWEFBREGIONS:
- return false;
+ return g_ActiveConfig.bShowEFBCopyRegions;
default:
PanicAlert("GetConfig Error: Unknown Config Type!");
return false;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index 3b7205867d..56991457e1 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -533,13 +533,15 @@ void Renderer::DrawDebugInfo()
// Set Line Size
glLineWidth(3.0f);
- GLfloat *RectPoints = new GLfloat[stats.efb_regions.size() * 16];
- GLfloat *Colours = new GLfloat[stats.efb_regions.size() * 3];
+ // 2*Coords + 3*Color
+ GLfloat *Vertices = new GLfloat[stats.efb_regions.size() * (2+3)*2*6];
// Draw EFB copy regions rectangles
int a = 0;
+ GLfloat color[3] = {0.0f, 1.0f, 1.0f};
+
for (std::vector<EFBRectangle>::const_iterator it = stats.efb_regions.begin();
- it != stats.efb_regions.end(); ++it, ++a)
+ it != stats.efb_regions.end(); ++it)
{
GLfloat halfWidth = EFB_WIDTH / 2.0f;
GLfloat halfHeight = EFB_HEIGHT / 2.0f;
@@ -548,33 +550,88 @@ void Renderer::DrawDebugInfo()
GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)it->right / halfWidth);
GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)it->bottom / halfHeight);
- Colours[a * 3] = 0.0f;
- Colours[a * 3 + 1] = 1.0f;
- Colours[a * 3 + 2] = 1.0f;
-
- RectPoints[a * 16] = x;
- RectPoints[a * 16 + 1] = y;
+ Vertices[a++] = x;
+ Vertices[a++] = y;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
- RectPoints[a * 16 + 2] = x2;
- RectPoints[a * 16 + 3] = y;
+ Vertices[a++] = x2;
+ Vertices[a++] = y;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
- RectPoints[a * 16 + 4] = x;
- RectPoints[a * 16 + 5] = y2;
-
- RectPoints[a * 16 + 6] = x2;
- RectPoints[a * 16 + 7] = y2;
-
- RectPoints[a * 16 + 8] = x;
- RectPoints[a * 16 + 9] = y;
-
- RectPoints[a * 16 + 10] = x;
- RectPoints[a * 16 + 11] = y2;
-
- RectPoints[a * 16 + 12] = x2;
- RectPoints[a * 16 + 13] = y;
-
- RectPoints[a * 16 + 14] = x2;
- RectPoints[a * 16 + 15] = y2;
+
+ Vertices[a++] = x2;
+ Vertices[a++] = y;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+ Vertices[a++] = x2;
+ Vertices[a++] = y2;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+
+ Vertices[a++] = x2;
+ Vertices[a++] = y2;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+ Vertices[a++] = x;
+ Vertices[a++] = y2;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+
+ Vertices[a++] = x;
+ Vertices[a++] = y2;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+ Vertices[a++] = x;
+ Vertices[a++] = y;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+
+ Vertices[a++] = x;
+ Vertices[a++] = y;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+ Vertices[a++] = x2;
+ Vertices[a++] = y2;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+
+ Vertices[a++] = x2;
+ Vertices[a++] = y;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+ Vertices[a++] = x;
+ Vertices[a++] = y2;
+ Vertices[a++] = color[0];
+ Vertices[a++] = color[1];
+ Vertices[a++] = color[2];
+
+ // TO DO: build something nicer here
+ GLfloat temp = color[0];
+ color[0] = color[1];
+ color[1] = color[2];
+ color[2] = temp;
}
// disable all pointer, TODO: use VAO
@@ -590,11 +647,10 @@ void Renderer::DrawDebugInfo()
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
- glColorPointer (3, GL_FLOAT, 0, Colours);
- glVertexPointer(2, GL_FLOAT, 0, RectPoints);
- glDrawArrays(GL_LINE_STRIP, 0, stats.efb_regions.size() * 8);
- delete[] RectPoints;
- delete[] Colours;
+ glColorPointer (3, GL_FLOAT, sizeof(GLfloat)*5, Vertices+2);
+ glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*5, Vertices);
+ glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
+ delete[] Vertices;
// Restore Line Size
glLineWidth(lSize);