网页私服论坛

 找回密码
 立即注册
搜索
查看: 77117|回复: 0

渲染图标问题,求解决

[复制链接]

1

主题

5

帖子

42

积分

新手上路

Rank: 1

积分
42
发表于 2015-10-17 20:24:21 | 显示全部楼层 |阅读模式
我想渲染47*47的图标,原图是TGA 96*96,但是渲染出来是32*32,好诡异啊,求解决方法:

渲染代码:
g_pd3dDevice->SetTexture(0,pTexture);
if(_dwColor)
{
g_pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR,_dwColor);
g_pd3dDevice->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_TEXTURE);
g_pd3dDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG2);
g_pd3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE2X);
g_pd3dDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_TFACTOR);
}
VERTEX_XYZUV Vertices[] =
{
{ ((float)_rcDraw.left-0.5f),  -((float)_rcDraw.top-0.5f),    0,  0.0f,  0.0f },
{ ((float)_rcDraw.right-0.5f), -((float)_rcDraw.top-0.5f),    0,  1.0f,  0.0f },
{ ((float)_rcDraw.left-0.5f),  -((float)_rcDraw.bottom-0.5f), 0,  0.0f,  1.0f },
{ ((float)_rcDraw.right-0.5f), -((float)_rcDraw.bottom-0.5f), 0,  1.0f,  1.0f },
};
VERTEX_XYZUV* pVertices = NULL;
m_pVB->Lock( 0, sizeof(Vertices), (void**)&pVertices, D3DLOCK_DISCARD );
memcpy( pVertices,Vertices, sizeof(Vertices) );
m_pVB->Unlock();
g_pd3dDevice->SetStreamSource( 0, m_pVB, 0, SIZE_XYZUV );   // SIZE_XYZUV  = 50
g_pd3dDevice->SetFVF(FVF_XYZUV); // FVF_XYZUV =  258
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
if(_dwColor)
{
g_pd3dDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1 );
g_pd3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1);
}

创建顶点缓冲代码:
if( FAILED( g_pd3dDevice->CreateVertexBuffer(8*sizeof(VERTEX_XYZUV),
D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC,
D3DFVF_XYZ | D3DFVF_TEX1,        
D3DPOOL_DEFAULT,
&m_pVB, NULL ) ) )
{//创建空间所用的顶点缓冲区,最多8个点
return false;
}

谢大神帮忙,在线等很急的

网页游戏私服论坛 http://www.c14.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|网页私服论坛  

GMT+8, 2017-9-20 20:57 , Processed in 0.064717 second(s), 24 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表