TextureBufferTransitPtr DeferredShadingStage::createGBuffer( UInt32 index, Int32 width, Int32 height) { TextureBufferTransitPtr buf = TextureBuffer ::createLocal(); TextureObjChunkUnrecPtr bufTex = TextureObjChunk::createLocal(); ImageUnrecPtr bufImg = Image ::createLocal(); bufImg->set(_mfPixelFormats[index], width, height, 1, 1, 1, 0.0f, NULL, _mfPixelTypes[index], false, 1); bufTex->setImage (bufImg ); bufTex->setTarget (GL_TEXTURE_RECTANGLE_ARB); bufTex->setMinFilter(GL_NEAREST ); bufTex->setMagFilter(GL_NEAREST ); bufTex->setWrapS (GL_CLAMP ); bufTex->setWrapT (GL_CLAMP ); bufTex->setScale (false ); buf ->setTexture (bufTex ); // START DEBUG GLenum internalFormat; GLenum externalFormat; bufTex->determineFormats(internalFormat, externalFormat); FLOG(("DSStage::createGBuffer: IF [%s] EF [%s]\n", GLDefineMapper::the()->toString(internalFormat).c_str(), GLDefineMapper::the()->toString(externalFormat).c_str() )); // END DEBUG return buf; }
void ShaderShadowMapEngine::updateShadowTexChunk(SSMEngineData *data) { TextureObjChunk *bufTex = data->getShadowTexChunk(); if(bufTex == NULL) { TextureObjChunkUnrecPtr newBufTex = TextureObjChunk::createLocal(); newBufTex->setMinFilter (GL_LINEAR ); newBufTex->setMagFilter (GL_LINEAR ); newBufTex->setWrapS (GL_CLAMP_TO_EDGE ); newBufTex->setWrapT (GL_CLAMP_TO_EDGE ); newBufTex->setWrapR (GL_CLAMP_TO_EDGE ); newBufTex->setScale (false ); newBufTex->setInternalFormat(GL_DEPTH_COMPONENT24 ); newBufTex->setExternalFormat(GL_DEPTH_COMPONENT ); newBufTex->setCompareMode (GL_COMPARE_R_TO_TEXTURE); newBufTex->setCompareFunc (GL_LESS ); newBufTex->setDepthMode (GL_LUMINANCE ); data->setShadowTexChunk(newBufTex); this->setShadowTexChunk(newBufTex); } }