本文整理汇总了C++中IDirect3DDevice9::GetViewport方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::GetViewport方法的具体用法?C++ IDirect3DDevice9::GetViewport怎么用?C++ IDirect3DDevice9::GetViewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::GetViewport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCleanState
void DevState::createCleanState() {
if (dwMyThread != 0) {
ods("D3D9: CreateCleanState from other thread.");
}
Stash<DWORD> stashThread(&dwMyThread, GetCurrentThreadId());
if (pSB)
pSB->Release();
pSB = NULL;
IDirect3DStateBlock9* pStateBlock = NULL;
dev->CreateStateBlock(D3DSBT_ALL, &pStateBlock);
if (! pStateBlock)
return;
pStateBlock->Capture();
dev->CreateStateBlock(D3DSBT_ALL, &pSB);
if (! pSB) {
pStateBlock->Release();
return;
}
D3DVIEWPORT9 vp;
dev->GetViewport(&vp);
dev->SetVertexShader(NULL);
dev->SetPixelShader(NULL);
dev->SetFVF(D3DFVF_TLVERTEX);
dev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
dev->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // 0x16
dev->SetRenderState(D3DRS_WRAP0, FALSE); // 0x80
dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
dev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
dev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
dev->SetRenderState(D3DRS_ZENABLE, FALSE);
dev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
dev->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
dev->SetRenderState(D3DRS_COLORVERTEX, FALSE);
dev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
dev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
dev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
dev->SetRenderState(D3DRS_LIGHTING, FALSE);
pSB->Capture();
pStateBlock->Apply();
pStateBlock->Release();
}
示例2: Save
void CState::Save()
{
// viewport
m_D3DDev->GetViewport(&m_Vp);
// render states
m_D3DDev->GetRenderState(D3DRS_ZENABLE, &m_Z);
m_D3DDev->GetRenderState(D3DRS_CULLMODE, &m_CullMode);
m_D3DDev->GetRenderState(D3DRS_ALPHATESTENABLE, &m_AlphaTest);
m_D3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &m_AlphaBlend);
m_D3DDev->GetRenderState(D3DRS_BLENDOP, &m_BlendOp);
m_D3DDev->GetRenderState(D3DRS_SRCBLEND, &m_SrcBlend);
m_D3DDev->GetRenderState(D3DRS_DESTBLEND, &m_DstBlend);
m_D3DDev->GetRenderState(D3DRS_CLIPPLANEENABLE, &m_ClipPlane);
m_D3DDev->GetRenderState(D3DRS_FILLMODE, &m_FillMode);
m_D3DDev->GetRenderState(D3DRS_LASTPIXEL, &m_LastPixel);
m_D3DDev->GetRenderState(D3DRS_FOGENABLE, &m_Fog);
m_D3DDev->GetRenderState(D3DRS_STENCILENABLE, &m_Stencil);
m_D3DDev->GetRenderState(D3DRS_COLORWRITEENABLE, &m_ColorWrite);
m_D3DDev->GetRenderState(D3DRS_SCISSORTESTENABLE, &m_Scissor);
if( m_Caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND )
m_D3DDev->GetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, &m_SeparateAlphaBlend);
//if( m_Caps.LineCaps & D3DLINECAPS_ANTIALIAS )
m_D3DDev->GetRenderState(D3DRS_ANTIALIASEDLINEENABLE, &m_AntiAliasedLine);
// primitive
m_D3DDev->GetFVF(&m_FVF);
m_D3DDev->GetStreamSource(0, &m_StreamData, &m_StreamOffset, &m_StreamStride);
m_D3DDev->GetVertexShader(&m_VertexShader);
// texture
m_D3DDev->GetTexture(0, &m_Tex);
m_D3DDev->GetPixelShader(&m_PixelShader);
// texture stage states
m_D3DDev->GetTextureStageState(0, D3DTSS_COLOROP, &m_ColorOp);
m_D3DDev->GetTextureStageState(0, D3DTSS_COLORARG1, &m_ColorArg1);
m_D3DDev->GetTextureStageState(0, D3DTSS_COLORARG2, &m_ColorArg2);
m_D3DDev->GetTextureStageState(0, D3DTSS_ALPHAOP, &m_AlphaOp);
m_D3DDev->GetTextureStageState(0, D3DTSS_ALPHAARG1, &m_AlphaArg1);
m_D3DDev->GetTextureStageState(0, D3DTSS_TEXCOORDINDEX, &m_TexCoordIndex);
m_D3DDev->GetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, &m_TexTransfFlags);
m_D3DDev->GetSamplerState(0, D3DSAMP_ADDRESSU, &m_AddressU);
m_D3DDev->GetSamplerState(0, D3DSAMP_ADDRESSV, &m_AddressV);
m_D3DDev->GetSamplerState(0, D3DSAMP_MAGFILTER, &m_MagFilter);
m_D3DDev->GetSamplerState(0, D3DSAMP_MINFILTER, &m_MinFilter);
m_D3DDev->GetSamplerState(0, D3DSAMP_MIPFILTER, &m_MipFilter);
}
示例3: draw
void DevState::draw() {
clock_t t = clock();
float elapsed = static_cast<float>(t - timeT) / CLOCKS_PER_SEC;
++frameCount;
if (elapsed > OVERLAY_FPS_INTERVAL) {
OverlayMsg om;
om.omh.uiMagic = OVERLAY_MAGIC_NUMBER;
om.omh.uiType = OVERLAY_MSGTYPE_FPS;
om.omh.iLength = sizeof(OverlayMsgFps);
om.omf.fps = frameCount / elapsed;
sendMessage(om);
frameCount = 0;
timeT = t;
}
D3DVIEWPORT9 vp;
dev->GetViewport(&vp);
checkMessage(vp.Width, vp.Height);
if (! a_ucTexture || (uiLeft == uiRight))
return;
if (! texTexture) {
unsigned int l, r, t, b;
l = uiLeft;
r = uiRight;
t = uiTop;
b = uiBottom;
newTexture(uiWidth, uiHeight);
blit(0, 0, uiWidth, uiHeight);
uiLeft = l;
uiRight = r;
uiTop = t;
uiBottom = b;
setRect();
}
dev->SetTexture(0, texTexture);
dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, vertices, sizeof(D3DTLVERTEX));
}