Bladeren bron

Very hacky fix for using the right textures

Thomas Buck 11 jaren geleden
bovenliggende
commit
dd085bef14
2 gewijzigde bestanden met toevoegingen van 7 en 5 verwijderingen
  1. 1
    1
      src/Render.cpp
  2. 6
    4
      src/Texture.cpp

+ 1
- 1
src/Render.cpp Bestand weergeven

@@ -70,7 +70,7 @@ void Render::drawLoadScreen()
70 70
     glTranslatef(0.0f, 0.0f, -2000.0f);
71 71
     glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
72 72
 
73
-    glBindTexture(GL_TEXTURE_2D, 3);
73
+    glBindTexture(GL_TEXTURE_2D, 2);
74 74
 
75 75
     glBegin(GL_TRIANGLE_STRIP);
76 76
     glTexCoord2f(1.0, 1.0);

+ 6
- 4
src/Texture.cpp Bestand weergeven

@@ -22,6 +22,8 @@
22 22
 #include "utils/tga.h"
23 23
 #include "Texture.h"
24 24
 
25
+#define TEXTURE_OFFSET -1
26
+
25 27
 Texture::Texture() {
26 28
     mTextureIds = NULL;
27 29
     mFlags = 0;
@@ -124,11 +126,11 @@ void Texture::bindMultiTexture(int texture0, int texture1) {
124 126
 
125 127
     glActiveTextureARB(GL_TEXTURE0_ARB);
126 128
     glEnable(GL_TEXTURE_2D);
127
-    glBindTexture(GL_TEXTURE_2D, mTextureIds[texture0]);
129
+    glBindTexture(GL_TEXTURE_2D, mTextureIds[texture0] + TEXTURE_OFFSET);
128 130
 
129 131
     glActiveTextureARB(GL_TEXTURE1_ARB);
130 132
     glEnable(GL_TEXTURE_2D);
131
-    glBindTexture(GL_TEXTURE_2D, mTextureIds[texture1]);
133
+    glBindTexture(GL_TEXTURE_2D, mTextureIds[texture1] + TEXTURE_OFFSET);
132 134
 }
133 135
 
134 136
 void Texture::setMaxTextureCount(unsigned int n) {
@@ -241,7 +243,7 @@ int Texture::loadBufferSlot(unsigned char *image,
241 243
 
242 244
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
243 245
 
244
-    glBindTexture(GL_TEXTURE_2D, mTextureIds[slot]);
246
+    glBindTexture(GL_TEXTURE_2D, mTextureIds[slot] + TEXTURE_OFFSET);
245 247
 
246 248
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
247 249
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@@ -279,7 +281,7 @@ void Texture::bindTextureId(unsigned int n) {
279 281
     glEnable(GL_TEXTURE_2D);
280 282
     //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
281 283
 
282
-    glBindTexture(GL_TEXTURE_2D, mTextureIds[n]);
284
+    glBindTexture(GL_TEXTURE_2D, mTextureIds[n] + TEXTURE_OFFSET);
283 285
 }
284 286
 
285 287
 void Texture::glScreenShot(char *base, unsigned int width, unsigned int height) {

Laden…
Annuleren
Opslaan