本文整理汇总了C++中IDirect3DTexture9::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DTexture9::Release方法的具体用法?C++ IDirect3DTexture9::Release怎么用?C++ IDirect3DTexture9::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DTexture9
的用法示例。
在下文中一共展示了IDirect3DTexture9::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TerminateDevice
HRESULT _stdcall TerminateDevice(DWORD_PTR dwID) {
if(ptex) {
ptex->Release();
ptex=NULL;
}
if(surface) {
surface->Release();
surface=NULL;
}
if(tex) {
tex->Release();
tex=NULL;
}
return S_OK;
}
示例2: error
IDirect3DTexture9 *Blit::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect)
{
egl::Display *display = getDisplay();
IDirect3DDevice9 *device = getDevice();
D3DSURFACE_DESC sourceDesc;
surface->GetDesc(&sourceDesc);
// Copy the render target into a texture
IDirect3DTexture9 *texture;
HRESULT result = device->CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
IDirect3DSurface9 *textureSurface;
result = texture->GetSurfaceLevel(0, &textureSurface);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
texture->Release();
return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
RECT d3dSourceRect;
d3dSourceRect.left = sourceRect.left;
d3dSourceRect.right = sourceRect.right;
d3dSourceRect.top = sourceRect.top;
d3dSourceRect.bottom = sourceRect.bottom;
display->endScene();
result = device->StretchRect(surface, &d3dSourceRect, textureSurface, NULL, D3DTEXF_NONE);
textureSurface->Release();
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
texture->Release();
return error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
return texture;
}
示例3: onRender
void CeguiTextureImage::onRender(const ::bootes::lib::framework::GameTime* gt)
{
if (_pSceneSeq == NULL) {
IStageManager* p = g_pGame->getStageManager();
if (p) { _pSceneSeq = p->getSceneSequencer(); }
}
if (_pSceneSeq == NULL) { return; }
{
Scene scene = _pSceneSeq->getScene(true);
if (! scene.isValid()) { return; }
IDirect3DTexture9* pTex = scene.refTexture();
_size.d_width = (float)scene.videoinfo().width;
_size.d_height = (float)scene.videoinfo().height;
_time = scene.clock().clock;
_pCeguiTex->setDirect3D9Texture(pTex);
_pCeguiTex->setOriginalDataSize(_size);
if (pTex) {
pTex->Release();
}
}
CEGUI::Point zero(0,0);
CEGUI::Imageset& is = CEGUI::ImagesetManager::getSingleton().get(_is_name.c_str());
t_items::iterator i;
for (i = _items.begin(); i != _items.end(); ++i) {
Item* pi = i->second;
is.undefineImage(pi->im_name.c_str());
is.defineImage(pi->im_name.c_str(), zero, _size, zero);
}
}
示例4: MFTexture_DestroyPlatformSpecific
void MFTexture_DestroyPlatformSpecific(MFTexture *pTexture)
{
MFCALLSTACK;
IDirect3DTexture9 *pTex = (IDirect3DTexture9*)pTexture->pInternalData;
pTex->Release();
}
示例5: boxFilter
bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source));
if (!texture)
{
return false;
}
IDirect3DDevice9 *device = getDevice();
saveState();
device->SetTexture(0, texture);
device->SetRenderTarget(0, dest);
setVertexShader(SHADER_VS_STANDARD);
setPixelShader(SHADER_PS_PASSTHROUGH);
setCommonBlitState();
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
setViewport(getSurfaceRect(dest), 0, 0);
render();
texture->Release();
restoreState();
return true;
}
示例6: DoLimbo
void RSManager::DoLimbo()
{
if (!(mainRT && zSurf && doLimbo && limbo)) return;
IDirect3DSurface9 *oldRenderTarget;
d3ddev->GetRenderTarget(0, &oldRenderTarget);
if (oldRenderTarget == mainRT) {
// final renderbuffer has to be from texture, just making sure here
if (IDirect3DTexture9* tex = getSurfTexture(oldRenderTarget)) {
// check size just to make even more sure
D3DSURFACE_DESC desc;
oldRenderTarget->GetDesc(&desc);
if (desc.Width == Settings::get().getRenderWidth() && desc.Height == Settings::get().getRenderHeight()) {
IDirect3DTexture9 *zTex = getSurfTexture(zSurf);
storeRenderState();
d3ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
d3ddev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE);
/// Draw zbuffer
limbo->go(zTex, oldRenderTarget, limboZNear, limboZFar);
SDLOG(0, "ZNear: %g, ZFar: %g\n", limboZNear, limboZFar);
//d3ddev->StretchRect(zSurf, NULL, oldRenderTarget, NULL, D3DTEXF_NONE);
restoreRenderState();
zTex->Release();
}
tex->Release();
}
}
oldRenderTarget->Release();
}
示例7: formatConvert
bool Blit::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect);
if (!texture)
{
return false;
}
IDirect3DDevice9 *device = getDevice();
saveState();
device->SetTexture(0, texture);
device->SetRenderTarget(0, dest);
setViewport(sourceRect, xoffset, yoffset);
setCommonBlitState();
if (setFormatConvertShaders(destFormat))
{
render();
}
texture->Release();
restoreState();
return true;
}
示例8:
/**
*
* @author Jade Abbott
*
*/
bool
CRadialMenu::CreateFinalTexture()
{
assert(m_pRenderer);
IDirect3DTexture9* pTexture = 0;
if (FAILED(m_pRenderer->GetSurfaceManager().CreateTexture(m_uiDiameter,
m_uiDiameter,
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED,
&pTexture)))
{
return false;
}
CTextureManager& rTextureManager = m_pRenderer->GetTextureManager();
if (m_iFinalTextureID != Utility::INVALID_ID)
{
rTextureManager.RemoveTexture(m_iFinalTextureID);
}
m_iFinalTextureID = rTextureManager.LoadTextureMemory(pTexture);
if (m_iFinalTextureID == Utility::INVALID_ID)
{
pTexture->Release();
return false;
}
return true;
}
示例9: Unload
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void TextureLoader::Unload( void* data )
{
if( data != NULL )
{
IDirect3DTexture9* texture = (IDirect3DTexture9*)data;
texture->Release();
}
}
示例10:
void DirectX9::FreeTexture( Gwen::Texture* pTexture )
{
IDirect3DTexture9* pImage = ( IDirect3DTexture9* ) pTexture->data;
if ( !pImage ) { return; }
pImage->Release();
pTexture->data = NULL;
return;
}
示例11:
void RageDisplay_D3D::DeleteTexture( unsigned uTexHandle )
{
IDirect3DTexture9* pTex = (IDirect3DTexture9*) uTexHandle;
pTex->Release();
// Delete palette (if any)
if( g_TexResourceToPaletteIndex.find(uTexHandle) != g_TexResourceToPaletteIndex.end() )
g_TexResourceToPaletteIndex.erase( g_TexResourceToPaletteIndex.find(uTexHandle) );
if( g_TexResourceToTexturePalette.find(uTexHandle) != g_TexResourceToTexturePalette.end() )
g_TexResourceToTexturePalette.erase( g_TexResourceToTexturePalette.find(uTexHandle) );
}
示例12: initialize
void Console::initialize(IDirect3DDevice9* device, int w, int h) {
SDLOG(0, "Initializing Console on device %p\n", device);
width = w;
height = h;
this->device = device;
// Create font
SDLOG(2, " - creating console font\n");
SAFERELEASE(fontTex);
FILE* ff = fopen(getAssetFileName("font.ttf").c_str(), "rb");
unsigned char* ttf_buffer = new unsigned char[1<<20];
unsigned char* temp_bitmap = new unsigned char[BMPSIZE*BMPSIZE];
fread(ttf_buffer, 1, 1<<20, ff);
fclose(ff);
stbtt_BakeFontBitmap(ttf_buffer, 0, 40.0, temp_bitmap, BMPSIZE, BMPSIZE, 32, 96, cdata); // no guarantee this fits!
device->CreateTexture(BMPSIZE, BMPSIZE, 0, D3DUSAGE_AUTOGENMIPMAP, D3DFMT_A8, D3DPOOL_DEFAULT, &fontTex, NULL);
IDirect3DTexture9 *tempTex;
device->CreateTexture(BMPSIZE, BMPSIZE, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8, D3DPOOL_SYSTEMMEM, &tempTex, NULL);
D3DLOCKED_RECT rect;
tempTex->LockRect(0, &rect, NULL, 0);
memcpy(rect.pBits, temp_bitmap, BMPSIZE*BMPSIZE);
tempTex->UnlockRect(0);
device->UpdateTexture(tempTex, fontTex);
tempTex->Release();
delete ttf_buffer;
delete temp_bitmap;
// Create vertex decl
SDLOG(2, " - creating console vertex decl\n");
SAFERELEASE(vertexDeclaration);
device->CreateVertexDeclaration(vertexElements , &vertexDeclaration);
// Load effect from file
SDLOG(2, " - loading console effect file\n");
SAFERELEASE(effect);
vector<D3DXMACRO> defines;
std::stringstream s;
D3DXMACRO null = { NULL, NULL };
defines.push_back(null);
DWORD flags = D3DXFX_NOT_CLONEABLE | D3DXSHADER_OPTIMIZATION_LEVEL3;
SDLOG(2, " - actually load effect\n");
ID3DXBuffer* errors;
HRESULT hr = D3DXCreateEffectFromFile(device, getAssetFileName("console.fx").c_str(), &defines.front(), NULL, flags, NULL, &effect, &errors);
if(hr != D3D_OK) SDLOG(0, "ERRORS:\n %s\n", errors->GetBufferPointer());
// get handles
rectColorHandle = effect->GetParameterByName(NULL, "rectColor");
textTex2DHandle = effect->GetParameterByName(NULL, "textTex2D");
SDLOG(0, " - done\n");
}
示例13: onRender
void RootViewPlay::onRender(const ::bootes::lib::framework::GameTime* gt)
{
HRESULT hr;
::bootes::lib::util::Timer timer;
int dt[10];
int ti = 0;
IDirect3DDevice9* pDev = g_pFnd->getD3D9Device();
if (pDev == NULL) { return; }
hr = pDev->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1, 0 );
timer.start();
_pGameView->onRender(gt);
timer.get(NULL, &dt[ti++]);
timer.start();
do {
//IDirect3DTexture9* pTex = scene.refTexture(); //test
Scene scene = _pGameView->getScene(true);
IDirect3DTexture9* pTex = scene.refTexture();
if (pTex == NULL) { break; }
IDirect3DSurface9* pSrc;
pTex->GetSurfaceLevel(0, &pSrc);
IDirect3DSurface9* pDst;
hr = pDev->GetRenderTarget(0, &pDst);
//hr = pDev->StretchRect(pSrc, NULL, pDst, NULL, D3DTEXF_NONE); //D3DPOOL_DEFUALT
hr = pDev->UpdateSurface(pSrc, NULL, pDst, NULL); //D3DPOOL_SYSTEM
if (hr == D3DERR_INVALIDCALL) {
DbgBreak("");
}
pDst->Release();
pSrc->Release();
pTex->Release();
} while(0);
pDev->EndScene();
/*
do {
ID3DXLine* pLine;
D3DXCreateLine(pDev, &pLine);
D3DXVECTOR2 points[] = {
D3DXVECTOR2(0,0), D3DXVECTOR2(100,100),
};
pLine->Begin();
pLine->Draw(points, 2, D3DCOLOR_ARGB(255,255,255,255));
pLine->End();
} while(0);
*/
timer.reset();
}
示例14:
HRESULT APIENTRY hkIDirect3DDevice9::SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture) {
RSManager::setLatest(rsMan);
SDLOG(6, "setTexture %d, %p\n", Stage, pTexture);
if(Settings::get().getLogLevel() > 10 && pTexture) {
IDirect3DTexture9 *tex;
if(pTexture->QueryInterface(IID_IDirect3DTexture9, (void**)&tex) == S_OK) {
D3DSURFACE_DESC desc;
tex->GetLevelDesc(0, &desc);
SDLOG(10, " -- size: %dx%d RT? %s\n", desc.Width, desc.Height, (desc.Usage & D3DUSAGE_RENDERTARGET) ? "true" : "false");
tex->Release();
}
}
return m_pD3Ddev->SetTexture(Stage, pTexture);
}
示例15: MFTexture_DestroyPlatformSpecific
void MFTexture_DestroyPlatformSpecific(MFTexture *pTexture)
{
MFCALLSTACK;
if(pTexture->flags & TEX_RenderTarget)
{
IDirect3DSurface9 *pSurface = (IDirect3DSurface9*)(size_t)pTexture->pSurfaces[0].platformData;
pSurface->Release();
}
if(pTexture->pInternalData)
{
IDirect3DTexture9 *pTex = (IDirect3DTexture9*)pTexture->pInternalData;
pTex->Release();
}
}