游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1307|回复: 2

我想?1?l?色的?,可是?s?示不出?

[复制链接]

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
发表于 2006-5-21 23:49:00 | 显示全部楼层 |阅读模式
我想?1?l?色的?,可是?s?示不出?
以下是我的source code

typedef struct {
        FLOAT x, y, z;     // 2-D coordinates
        FLOAT rhw;         // rhw
        DWORD color;        // The vertex color
} sVertexSelect;
#define VERTEXFVF_SELECT (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)

IDirect3DVertexBuffer9 *m_pVB_SelectRect;

void CAppDraw:rawSelectLine()
{
        BYTE *Ptr;

        COLORREF crRed=RGB(255,0,0);

        sVertexSelect Verts_Select[2]=
        {
                {1.0f,1.0f,1.0f,1.0f,crRed},
                {1.0f,100.0f,1.0f,1.0f,crRed},
        };

        m_pVB_SelectRect->Lock(0,0, (void**)&amptr, 0);
        memcpy(Ptr, Verts_Select, sizeof(Verts_Select));
        m_pVB_SelectRect->Unlock();

        m_pD3DDevice->SetTexture(0, NULL);
        m_pD3DDevice->SetStreamSource( 0, m_pVB_SelectRect,0, sizeof(sVertexSelect) );
        m_pD3DDevice->SetFVF( VERTEXFVF_SELECT );
        m_pD3DDevice->DrawPrimitive( D3DPT_LINELIST, 0, 1 );       
}

BOOL CAppDraw::DoFrame()
{
        // Clear device backbuffer
        m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET,                               D3DCOLOR_RGBA(0,64,128,255), 1.0f, 0);
       
        // Begin scene
        if(SUCCEEDED(m_pD3DDevice->BeginScene()))
        {
                DrawSelectLine();

                // End the scene
                m_pD3DDevice->EndScene();
        }

        // Display the scene
        m_pD3DDevice->Present(NULL, NULL, NULL, NULL);

        return TRUE;
}

5

主题

686

帖子

697

积分

高级会员

Rank: 4

积分
697
QQ
发表于 2006-5-22 18:18:00 | 显示全部楼层

Re:我想?1?l?色的?,可是?s?示不出?

顶点的Z值怎么能为1.0呢?设为0试试。另外检查纹理混合是否为Select D3DTA_Diffuse,并关闭光照。如果实在不行就用ID3DXLINE来画

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
 楼主| 发表于 2006-5-27 01:29:00 | 显示全部楼层

Re:我想?1?l?色的?,可是?s?示不出?

後?砦野l?是因?槲业?OLORREF crRed=RGB(255,0,0);?]有alpha值的??S
用?各就可以了D3DCOLOR_ARGB
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-24 14:07

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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