void Assets::releaseResources() { releaseTextures(); releaseMaterials(); releaseMeshes(); releaseEnvironments(); }
void FontAtlas::reset() { releaseTextures(); _currLineHeight = 0; _currentPage = 0; _currentPageOrigX = 0; _currentPageOrigY = 0; _letterDefinitions.clear(); reinit(); }
void PSSMLightShadowMap::_setNumSplits( U32 numSplits, U32 texSize ) { AssertFatal(numSplits > 0 && numSplits <= MAX_SPLITS, avar("PSSMLightShadowMap::_setNumSplits() - Splits must be between 1 and %d!", MAX_SPLITS)); releaseTextures(); mNumSplits = numSplits; mTexSize = texSize; F32 texWidth, texHeight; // If the split count is less than 4 then do a // 1xN layout of shadow maps... if ( mNumSplits < 4 ) { texHeight = texSize; texWidth = texSize * mNumSplits; for ( U32 i = 0; i < 4; i++ ) { mViewports[i].extent.set(texSize, texSize); mViewports[i].point.set(texSize*i, 0); } } else { // ... with 4 splits do a 2x2. texWidth = texHeight = texSize * 2; for ( U32 i = 0; i < 4; i++ ) { F32 xOff = (i == 1 || i == 3) ? 0.5f : 0.0f; F32 yOff = (i > 1) ? 0.5f : 0.0f; mViewports[i].extent.set( texSize, texSize ); mViewports[i].point.set( xOff * texWidth, yOff * texHeight ); } } mShadowMapTex.set( texWidth, texHeight, ShadowMapFormat, &ShadowMapProfile, "PSSMLightShadowMap" ); }
FontAtlas::~FontAtlas() { #if CC_ENABLE_CACHE_TEXTURE_DATA if (_fontFreeType && _rendererRecreatedListener) { auto eventDispatcher = Director::getInstance()->getEventDispatcher(); eventDispatcher->removeEventListener(_rendererRecreatedListener); _rendererRecreatedListener = nullptr; } #endif _font->release(); releaseTextures(); delete []_currentPageData; #if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_WINRT && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID if (_iconv) { iconv_close(_iconv); _iconv = nullptr; } #endif }
void VideoFrameGrabber::_onTextureEvent(GFXTexCallbackCode code) { if ( code == GFXZombify ) releaseTextures(); }
void ShaderLibrary::generateFilters() { GLuint texId(s_normalBuffer->texture()); QSize size(s_normalBuffer->size()); Texture texture; texture.id = texId; texture.size = size; texture.slot = NormalBuffer; texture.data = 0; setTextureVariable("Filters", "NormalMap", texture); s_filterBuffer->bind(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); bindShader("Filters"); texture.id = s_normalBuffer->texture(); texture.size = size; texture.slot = (Texture_t)0; texture.data = 0; setTextureVariable("Filters", "NormalMap", texture); texture.id = s_rotationTextureId; texture.size = QSize(s_rotationTextureSize, s_rotationTextureSize); texture.slot = (Texture_t)1; texture.data = s_rotationTextureData; setTextureVariable("Filters", "RotationTexture", texture); //bindTextures("Filters"); /* glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texId); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, s_rotationTextureId); */ float w(size.width()); float h(size.height()); float z(0.0); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(z, w, z, h, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glBegin(GL_QUADS); glTexCoord2f(1.0f,0.0f); glVertex3f(w, z, z); glTexCoord2f(0.0f,0.0f); glVertex3f(z, z, z); glTexCoord2f(0.0f,1.0f); glVertex3f(z, h, z); glTexCoord2f(1.0f,1.0f); glVertex3f(w, h, z); glEnd(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); s_filterBuffer->release(); releaseTextures(); }
ParaboloidLightShadowMap::~ParaboloidLightShadowMap() { releaseTextures(); }
SingleLightShadowMap::~SingleLightShadowMap() { releaseTextures(); }