-----------------------------------------------------------------------------
| 1283 | } |
| 1284 | //----------------------------------------------------------------------------- |
| 1285 | void GLRenderSystem::_setTexture(size_t stage, bool enabled, const TexturePtr &texPtr) |
| 1286 | { |
| 1287 | GLenum lastTextureType = mTextureTypes[stage]; |
| 1288 | |
| 1289 | mStateCacheManager->activateGLTextureUnit(stage); |
| 1290 | |
| 1291 | if (enabled) |
| 1292 | { |
| 1293 | GLTexturePtr tex = static_pointer_cast<GLTexture>(texPtr); |
| 1294 | |
| 1295 | // note used |
| 1296 | tex->touch(); |
| 1297 | mTextureTypes[stage] = tex->getGLTextureTarget(); |
| 1298 | |
| 1299 | if(lastTextureType != mTextureTypes[stage] && lastTextureType != 0) |
| 1300 | { |
| 1301 | if (stage < mFixedFunctionTextureUnits) |
| 1302 | { |
| 1303 | if(lastTextureType != GL_TEXTURE_2D_ARRAY_EXT) |
| 1304 | glDisable( lastTextureType ); |
| 1305 | } |
| 1306 | } |
| 1307 | |
| 1308 | if (stage < mFixedFunctionTextureUnits) |
| 1309 | { |
| 1310 | if(mTextureTypes[stage] != GL_TEXTURE_2D_ARRAY_EXT) |
| 1311 | glEnable( mTextureTypes[stage] ); |
| 1312 | } |
| 1313 | |
| 1314 | mStateCacheManager->bindGLTexture( mTextureTypes[stage], tex->getGLID() ); |
| 1315 | } |
| 1316 | else |
| 1317 | { |
| 1318 | if (stage < mFixedFunctionTextureUnits) |
| 1319 | { |
| 1320 | if (lastTextureType != 0) |
| 1321 | { |
| 1322 | if(mTextureTypes[stage] != GL_TEXTURE_2D_ARRAY_EXT) |
| 1323 | glDisable( mTextureTypes[stage] ); |
| 1324 | } |
| 1325 | glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
| 1326 | } |
| 1327 | // bind zero texture |
| 1328 | mStateCacheManager->bindGLTexture(GL_TEXTURE_2D, 0); |
| 1329 | } |
| 1330 | } |
| 1331 | |
| 1332 | void GLRenderSystem::_setSampler(size_t unit, Sampler& sampler) |
| 1333 | { |
no test coverage detected