本文整理汇总了C++中CTexture::UpdateData方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::UpdateData方法的具体用法?C++ CTexture::UpdateData怎么用?C++ CTexture::UpdateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::UpdateData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
bool __fastcall CRenderer::Initialize()
{
static bool s_bInitalized = FALSE;
if (!s_bInitalized)
{
Renderer_ppModels = (const CModel**)CMemory::Aligned16Allocate(CRendererSettings::MaxModels() * sizeof(const CModel*));
Renderer_ppModelsShadow = (const CModel**)CMemory::Aligned16Allocate(CRendererSettings::MaxModels() * sizeof(const CModel*));
Renderer_ppLights = (const CLight**)CMemory::Aligned16Allocate(CRendererSettings::MaxLights() * sizeof(const CLight*));
//Prepare depth map textures & framebuffer
{
UINT uiShadowMapResolution = CRendererSettings::MaxShadowMapResolution();
for (UINT i = 0; i < LOD_LEVELS; i++)
{
for (UINT j = 0; j < 2; j++)
{
CTexture* pTexture = new CTexture(GL_TEXTURE_2D);
pTexture->Minification(GL_LINEAR);
pTexture->Minification(GL_LINEAR);
pTexture->CoordClamp (GL_CLAMP);
pTexture->MaxAnisotropy(1);
pTexture->Size(uiShadowMapResolution, uiShadowMapResolution);
pTexture->FormatInternal(GL_DEPTH_COMPONENT);
pTexture->Format (GL_DEPTH_COMPONENT);
pTexture->DataType (GL_FLOAT);
pTexture->UpdateProperties();
pTexture->UpdateData(NULL);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
Renderer_paShadowMaps[i][j] = pTexture;
}
uiShadowMapResolution >>= 1;
}
glGenFramebuffersEXT(1, &Renderer_uiShadowMapBuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Renderer_uiShadowMapBuffer);
{
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, Renderer_paShadowMaps[0][0]->GLID(), 0);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
switch (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT))
{
case GL_FRAMEBUFFER_COMPLETE_EXT: { break; }
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
default:
{
SCFError(ErrorHardwareUnsupported);
return FALSE;
}
}
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
//Prepare depth map shader
{
CGPUProgram* pShadowMap = new CGPUProgram();
pShadowMap->ShaderVertex (STRING("\\Common\\Shaders\\ShadowMap.vs"));
pShadowMap->ShaderFragment(STRING("\\Common\\Shaders\\ShadowMap.fs"));
pShadowMap->CompileAndLink();
Renderer_pShadowMapProgram = pShadowMap;
}
GPUProgram_State.Last.hProgram = NULL;
GPUProgram_State.Last.uiAttributesCount = 0;
return TRUE;
}