|
@@ -111,7 +111,7 @@ void TextureManager::bindMultiTexture(int texture0, int texture1) {
|
111
|
111
|
int TextureManager::loadBufferSlot(unsigned char *image,
|
112
|
112
|
unsigned int width, unsigned int height,
|
113
|
113
|
ColorMode mode, unsigned int bpp,
|
114
|
|
- unsigned int slot) {
|
|
114
|
+ unsigned int slot, bool filter) {
|
115
|
115
|
assert(image != NULL);
|
116
|
116
|
assert(width > 0);
|
117
|
117
|
assert(height > 0);
|
|
@@ -163,17 +163,19 @@ int TextureManager::loadBufferSlot(unsigned char *image,
|
163
|
163
|
|
164
|
164
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
165
|
165
|
|
166
|
|
- glBindTexture(GL_TEXTURE_2D, mTextureIds[slot]);
|
|
166
|
+ glBindTexture(GL_TEXTURE_2D, mTextureIds.at(slot));
|
167
|
167
|
|
168
|
|
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
169
|
|
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
170
|
|
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
171
|
|
-
|
172
|
|
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
173
|
|
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR);
|
174
|
|
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
168
|
+ if (filter) {
|
|
169
|
+ glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
|
170
|
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
|
171
|
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
172
|
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
|
173
|
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
|
174
|
+ } else {
|
|
175
|
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
176
|
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
177
|
+ }
|
175
|
178
|
|
176
|
|
- glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
177
|
179
|
glTexImage2D(GL_TEXTURE_2D, 0, bpp / 8, width, height, 0, glcMode, GL_UNSIGNED_BYTE, image);
|
178
|
180
|
|
179
|
181
|
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|