changeset 90:3863ad92f8d8

Rename a variable.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 Jan 2021 14:33:18 +0200
parents ff739727dfec
children 4df8a7337e3e
files dmglrender.cpp dmglrender.h
diffstat 2 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/dmglrender.cpp	Sat Oct 31 18:14:17 2020 +0200
+++ b/dmglrender.cpp	Tue Jan 12 14:33:18 2021 +0200
@@ -165,6 +165,19 @@
 }
 
 
+#define TWIDTH 8
+#define THEIGHT 8
+static char texSrc8[TWIDTH * THEIGHT + 1] =
+    "..%##%.."
+    ".%####%."
+    "%#*..*#%"
+    "##....##"
+    "########"
+    "##....##"
+    "##....##"
+    "##....##";
+
+
 bool DMGLSimpleRenderer::initRenderer2(void)
 {
     // Dump some information
@@ -215,24 +228,14 @@
 
 
     // Create texture bitmap
-#define TWIDTH 8
-#define THEIGHT 8
-    char texSrc[TWIDTH * THEIGHT + 1] =
-    "..%##%.."
-    ".%####%."
-    "%#*..*#%"
-    "##....##"
-    "########"
-    "##....##"
-    "##....##"
-    "##....##";
 
     for (int yc = 0; yc < THEIGHT; yc++)
     {
-        Uint8 *dp = ((Uint8 *) texSrc) + yc * TWIDTH;
+        Uint8 *dp8 = ((Uint8 *) texSrc8) + yc * TWIDTH;
+
         for (int xc = 0; xc < TWIDTH; xc++)
         {
-            Uint8 col = dp[xc];
+            Uint8 col = dp8[xc];
             switch (col)
             {
                 case '.': col = 0; break;
@@ -240,16 +243,16 @@
                 case '*': col = 128; break;
                 default: col = 192; break;
             }
-            dp[xc] = col;
+            dp8[xc] = col;
         }
     }
 
     // Upload to GPU texture
-    glGenTextures(1, &tex);
-    glBindTexture(GL_TEXTURE_2D, tex);
+    glGenTextures(1, &tex8);
+    glBindTexture(GL_TEXTURE_2D, tex8);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, TWIDTH, THEIGHT, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, texSrc);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, TWIDTH, THEIGHT, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, texSrc8);
     glBindTexture(GL_TEXTURE_2D, 0);
 
     return checkErrors();
@@ -370,7 +373,7 @@
     // Draw texture
     glColor3ub(0xff, 0xff, 0xff);
     glEnable(GL_TEXTURE_2D);
-    glBindTexture(GL_TEXTURE_2D, tex);
+    glBindTexture(GL_TEXTURE_2D, tex8);
     glBegin(GL_QUADS);
     float s = 0.50f;
     glTexCoord2i(-1,  0); glVertex2f(0, 0);
--- a/dmglrender.h	Sat Oct 31 18:14:17 2020 +0200
+++ b/dmglrender.h	Tue Jan 12 14:33:18 2021 +0200
@@ -16,7 +16,7 @@
 struct DMGLSimpleRenderer : DMSimpleRenderer
 {
     SDL_GLContext sdlGLContext;
-    GLuint tex;
+    GLuint tex8;
 
     DMGLSimpleRenderer()
     {