• 纹理


    //声明纹理接口
    IDirect3DTexture9* Tex  = 0;
    
    //载入纹理
    D3DXCreateTextureFromFile(
    	Device,
    	"dx5_logo.bmp",
    	&Tex);
    
    //设置纹理
    Device->SetTexture(0, Tex);
    
    //设置纹理参数,将缩小过滤器和放大过滤器设置为线性过滤模式,并将渐进纹理过滤器设为D3DTEXF_POINT
    Device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
    Device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
    Device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
    
    //关闭光照
    Device->SetRenderState(D3DRS_LIGHTING, false);
    
    //设置寻址模式
    //wrap address mode
    if( ::GetAsyncKeyState('W') & 0x8000f )
    {
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
    }
    
    //border color address mode
    if( ::GetAsyncKeyState('B') & 0x8000f )
    {
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
    	Device->SetSamplerState(0,  D3DSAMP_BORDERCOLOR, 0x000000ff);
    }
    
    //clamp address mode
    if( ::GetAsyncKeyState('C') & 0x8000f )
    {
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
    }
    
    //mirror address mode
    if( ::GetAsyncKeyState('M') & 0x8000f )
    {
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_MIRROR);
    	Device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_MIRROR);
    }	
    
    //绘制
    ...
    
    
  • 相关阅读:
    解決 Android Studio 不停 Indexing 的問題(Updating Indices: Indexing paused due to batch update)
    通过某个关键字排序一个字典列表
    django cmes 后台管理
    python 处理音视频
    python 加密
    PyEngine3D
    获取单词列表出现频率最高的单词
    django 上传文件
    python之MD5加密
    切片对象的demo
  • 原文地址:https://www.cnblogs.com/sifenkesi/p/1772564.html
Copyright © 2020-2023  润新知