常用d3d操作

2023-11-11 00:18
文章标签 操作 常用 d3d

本文主要是介绍常用d3d操作,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 使用ALPHA混合使用ALPHA测试 使用点精灵使用雾设置距阵(坐标转换)使用索引缓冲使用深度缓冲使用光照 --------------------------------------------------有关纹理的操作:---------------------------------------------- 纹理提交模式: D3DTSS_ADDRESSU,D3DTSS_ADDRESSV D3DTADDRESS_WRAP,CLAM,MIRROR,BORDER 纹理过滤方式: D3DTSS_MAG,FILTER,D3DTSS_MINFILTER,D3DTSS_MIPFILTER D3DTEXF_LINEAR,D3DTEXF_POINT 纹理混合方法: -颜色混合方法: D3DTSS_COLORARG1,D3DTSS_COLORARG2,COLOROP D3DTA_CURRENT,D3DTA_DIFFUSE,D3DTA_TEXTURE;D3DTOP_SELECTARG1,D3DTOP_SELECTARG2,D3DTOP_MODULATE,D3DTOP_SUBTRACT,D3DTOP_ADD -透明混合: D3DTSS_ALPHAARG1,D3DTSS_ALPHAARG2,D3DTSS_ALPHAOP 纹理透明方法:纹理透明属于设置RenderState的ALPHA测试,通过比较ALPHA值,决定是否透明 D3DRS_ALPHATESTENABLE,D3DRS_ALPHAREF,D3DRS_ALPHAFUNC TRUE,FALSE,0X00000000-0X000000ff,D3DCMP_GREATEREQUAL,D3DCMP_LESS ALPHA混合方法:ALPHA混合属于设置RenderState的ALPHA混合参数,通过参数的计算决定最终显示的点颜色 D3DRS_ALPHABLENDENABLE,D3DRS_SRCBLEND,D3DRS_DESTBLEND TRUE,FALSE,D3DBLEND_SRCALPHA,D3DBLEND_DESTALPHA,D3DBLEND_INVDESTALPHA,D3DBLEND_INVSRCALPHA 纹理动画:通过改变纹理的顶点坐标值来实现动画 ---------------------------------------------------------------------------------------------------------------- able,mode density ------------------------------------------雨、雾、雪------------------------------------------------------------ 雾: d3ddev->SetRender(D3DRS_FOGENABLE,TRUE); deddev->SetRender(D3DRS_FOGCOLOR,D3DCOLOR(255,255,255)); d3ddev->SetRender(D3DRS_FOGTABLEMODE,D3DFOG_LINEAR); d3ddev->SetRender(D3DRS_FOGSTART,FtoDW(0.1f)); d3ddev->SetRender(D3DRS_FOGEND,FtoDw(1.0f)); d3ddev->SetRender(D3DRS_FOGTABLEMODE,D3DFOG_EXP); d3ddev->SetRender(D3DRS_FOGDENSITY,FtoDW(1.0f)); d3ddev->SetRender(D3DRS_FOGVERTEXMODE,D3DFOG_LINEAR); 雨: d3ddev->SetRender(D3DRS_POINTSPRITEENABLE,TRUE); //d3ddev->SetRender(D3DRS_RANGERPOINTENABLE,TURE); d3ddev->SetRender(D3DRS_POINTSIZE,FtoDW(0.1f)); d3ddev->SetRender(D3DRS_POINTSCALENABLE,TRUE); d3ddev->SetRender(D3DRS_POINTSCAL_A,FtoDW(1.0f)); d3ddev->SetRender(D3DRS_POINT_MIN,FtoDW(1.0f)); d3ddev->SetRender(D3DRS_POINT_MAX,FtoDW(1.0f)); d3ddev->SetVertexShader(); d3ddev->SetStreamSource(); d3ddev->DrawPrimitive(D3DPT_POINTLIST,0,X); 雪:使用顶点精灵...... d3ddev->SetTexture(0,m_texture); d3ddev->SetRender(D3DRS_ALPHABLENENABLE,TURE); d3ddev->SetRender(D3DRS_SRCALPHA,D3DBLEN_SRCALPHA); d3ddev->SetRender(D3DRS_DESTALPHA,D3DBLEN_INVSRCALPHA); d3ddev->SetRender(D3DRS_ALPHATEXTENABLE,TURE); d3ddev->SetRender(D3DRS_ALPHAREC,0x0f); d3ddev->SetRender(D3DRS_ALPHAFUNC,D3DCMP_GREATEREQUAL); d3ddev->SetVertexShader(); d3ddev->SetStreamSource(); d3ddev->DrawPrimitive(); ----------------------------------------------------------------------------------------------------------------- ---------------------------------使用模型------------------------------------------------------------------------ D3DXMESH mesh; D3DMATERIAL8* material; LPDIRECT3DTEXTURE8* texture; D3DXBUFFER appbuffer; D3DXBUFFER materialbuffer; PWOD nummaterial; if(FAILED(D3DXLoadMeshFromFilex("mesh.x",D3DXMESH_SYSTEMMEN,d3ddev,NULL,&nummaterial,&appbuffer,&materialbuffer,&mesh))){ return E_FAIL; } D3DXMATERIAL* materials=(D3DMATERIAL*)materialbuffer->GerBufferPoint(); material=new D3DMATERIAL8[nummaterial]; texture=new LPDIRECT3DTEXTURE8[nummaterial]; for(int i=0;iSetMaterial(&material[i]); d3ddev->SetTexture(0,texture[i]); mesh->DrawSubset(i); } ----------------------------------------------------------------------------------------------------------------- --------------------------------------------------使用材质与灯光------------------------------------------------- D3DMATERIAL8 material; D3DLIGHT8 light; light.Type=D3DLIGHT_POINT;//SPOT,DIRECTION light.Diffuse.r=1.0f;//g,b,a light.Ambient.r=1.0f;//g,b,a light.Specular.r=1.0f;//g,b,a light.Position=D3DXVECTOR3(1.0f.20.0f,20.0f);//Direction light.Range=2.0f;//Theta,Phi material.Diffuse.r=1.0f;//g,b material.Ambient.r=1.0f;//g,b material.Specular.r=1.0f;//g,b material.Power=10; material.Emssive=1.0f; d3ddev->SetMaterial(&material); d3ddev->SetLight(0,&light); d3ddev->LightEnable(0,TRUE); d3ddev->SetRenderState(D3DRS_LIGHT,TRUE); ------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------------------------------------------------- ------------------------------------------------------- LPDIRECT3D8 m_d3d; LPDIRECT3DDEVICE8 m_d3ddev; LPDIRECT3DVERTEXBUFFER8 m_verbuf; struct COUSTOMVERTEX{ float x,y,z; DWORD color; }; #define D3DFVF_COUSTOMVERTEX(D3DFVF_XYZ|D3DFVF_DIFFUSE) HRESULT Initial(HWND HWnd){ D3DDISPLAYMODE dismode; m_d3d=Direct3DCreate8(D3D_SDK_VERSION); if(m_d3d==NULL) return E_FAIL; m_d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&dismode) D3DPRESENT_PARAMETERS m_parameters; ZeroMemory(&m_parameters,sizeof(m_parameters)); m_parameters.Windowed=TRUE; m_parameters.SwapEffect=D3DSWAPEFFECT_COPY_VSYNC;//DISCARD,FILP, m_parameters.BackBufferFormat=dismode.Format; if(FAILED(m_d3d.CreateDeviec(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,HWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&m_parameters,&m_d3ddev)))///MIXED,HARDWARE { return E_FAIL; } return S_OK; } m_d3d->CreateVertexBuffer(18*sizeof(CUSTOMVERTEX),0,D3DFVF_CUSTOMVERTEX,D3DPOOL_DEFAULT,&m_verbuf); VOID* void; m_verbuf->Lock(0,sizeof(数组名),(BYTE**)&m_void,0); memcpy(m_verbuf,数组名,sizeof(数组名)); m_verbuf->Unlock(); m_d3ddev->BeginScene(); m_d3ddev->SetStreamSource(m_verbuf); m_d3ddev->SetVertextShader(D3DFVF_COUSTOMVERTEX); m_d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST,0,2); m_d3ddev->EndScene(); m_d3ddev->Present(NULL,NULL,NULL,NULL); m_d3ddev->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW); m_deddev->SetRenderState(D3DRS_LIGHTING,FALSE); D3DXMATRIX m_matworld,m_matworldx,m_matworldy,m_matworldz; D3DXMatrixRotationX(&m_matworldx,34.0f); D3DXMatrixRotationY(&m_matworldy,34.0f); D3DXMatrixRotationZ(&m_matworldz,34.0f); D3DXMatrixMultiply(&m_matworld,&m_matworldx,&m_matworldy); D3DXMatrixMultiply(&m_matworld,&m_matworld,&m_matworldz); m_d3ddev->SetTransform(D3DTS_WORLD,&m_matworld); D3DXMatrixLookAtLH(&m_view,D3DXVECTOR3(0,0f,0,0f,20.0f),D3DXVECTOR(),D3DXVECTOR()); D3DXMatrixPerspectiveFovLH(&m_matproj,D3DPI/4,1.0f,1.0f,500.0f);// m_d3ddev->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1.0f,0); D3DPT_TRIANGLESTRIP Direct3DCreate8(); GetAdapterDisplayMode(); ZeroMemory(); CreateDevice(); SetRenderState(); D3DCOLOR_XRGB(); CreateVertexBuffer(); Lock(); memcpy(); D3DXMatrixRotationX(); D3DXMatrixMultiply(); SetTransform(); D3DXMatrixLookAtLH(); D3DXVECTOR3 D3DXMatrixPerspectiveFovLH(); Clear(); SetStreamSource(); SetVertexShader(); DrawPrimitive(); Present(); AutoDepthStencilFormat ,EnableAutoDepthStencil,// SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); FullScreen_RefreshRateInHz,FullScreen_PresentationInterval// GetAdapterModeCount(),EnumAdapterModes() D3DXMatrixRotationAxis() D3DXMatrixScaling() D3DXCreateTextureFromFile() SetTexture() SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);// SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);// D3DLIGHT8 Diffuse,Ambient,Specular,Position,Attenuation,Range, SetLight() LightEnable()// m_pD3DDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(32, 32, 32)); D3DMATERIAL8,D3DCOLORVALUE,Diffuse,Ambient,Specular,Emissive,Power SetMaterial()// D3DXVec3Subtract(),D3DXVec3Cross(),D3DXVec3Normalize()// m_pD3DDevice->SetIndices(m_pIndexBuffer, 0); m_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, m_dwNumOfVertices, 0, m_dwNumOfPolygons);//参数意义? LPDIRECT3DINDEXBUFFER8 CreateIndexBuffer() D3DFMT_INDEX16,D3DPOOL_MANAGED,DWORD,WORD//WORDHE和DWORDY有什么区别 如何使用索引缓冲:创建-锁定-拷贝-解锁-设置设备的缓冲-渲染索引原始 LPDIRECT3DINDEXBUFFER IndexBuffer; DWORD NumIndex; WORD Vertex[]={0,1,2,1,0 ......}; D3ddev->CreateIndexBuffer(NumIndex*sizeof(WORD),0,D3DFMT_INDEX16,D3DPOOL_MANAGED,&IndexBuffer); IndexBuffer->Lock(0,NumIndex*sizeof(WORD),(BYTE**)&pvertex,0); memcpy(pvertex,Vextex,3*sizeof(DWORD)); IndexBuffer->UnLock(); D3ddev->SetIndices(&IndexBuffer,0); 索引缓冲没有和顶点缓冲关联,渲染索引缓冲中的顶点时,为什么索引缓冲可以直接从某个顶点缓冲中找到顶点 D3ddev->DrawIndexPrimitive(D3DPT_TRANGLELIST,0,,0,); 如何加载模型:创建Mesh-得到缓冲指针-New数组-提取指针中的数据(提取MatD3D-设置Ambient-创建Textrue)-计算Normals-一各个设置Material和Texture-渲染子集-释放Material数组-一各个释放Texture-释放Texture数组-释放Mesh D3DXCloneMesh(),D3DXComputeNormals();// m_pD3DDevice->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); 2D渲染:// 字体常量:FW_NORMAL,FW_BOLD,DT_CALCRECT,DT_LEFT CreateFont(nHeight, 0, 0, 0, nWeight, dwItalic, dwUnderlined, 0,ANSI_CHARSET, 0, 0, 0, 0, pFontFace); LPD3DXFont RECT D3DCreateFont() Begin(),DrawTextA(),End() D3DXMatrixOrthoLH(&matOrtho, (float)m_nScreenWidth, (float)m_nScreenHeight,0.0f, 1.0f);// D3DXMatrixIdentity() 设置距阵,禁止深度缓冲,禁止灯光构造2D对象:创建顶点缓冲-锁定并且写入顶点坐标,纹理坐标,颜色值-创建纹理-设置渲染的数据来源,设置顶点格式,设置纹理,设置纹理舞台状态 m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE)-// m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);(激活alpha blen,设置SRC blen,DEST blen)-渲染 D3DXCreateTextureFromFileEx(),D3DX_DEFAULT ----------- lpDD->SetCooperativeLevel( hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN );// 雾: d3ddev->SetRender(D3DRS_FOGENABLE,TRUE); deddev->SetRender(D3DRS_FOGCOLOR,D3DCOLOR(255,255,255)); d3ddev->SetRender(D3DRS_FOGTABLEMODE,D3DFOG_LINEAR); d3ddev->SetRender(D3DRS_FOGSTART,FtoDW(0.1f)); d3ddev->SetRender(D3DRS_FOGEND,FtoDw(1.0f)); d3ddev->SetRender(D3DRS_FOGTABLEMODE,D3DFOG_EXP); d3ddev->SetRender(D3DRS_FOGDENSITY,FtoDW(1.0f)); d3ddev->SetRender(D3DRS_FOGVETEXMODE,D3DFOG_LINEAR); 雨: d3ddev->SetRender(D3DRS_POINTSPRITEENABLE,TRUE); //d3ddev->SetRender(D3DRS_RANGERPOINTENABLE,TURE); d3ddev->SetRender(D3DRS_POINTSIZE,FtoDW(0.1f)); d3ddev->SetRender(D3DRS_POINTSCALENABLE,TRUE); d3ddev->SetRender(D3DRS_POINTSCAL_A,FtoDW(1.0f)); d3ddev->SetRender(D3DRS_POINT_MIN,FtoDW(1.0f)); d3ddev->SetRender(D3DRS_POINT_MAX,FtoDW(1.0f)); d3ddev->SetVertexShader(); d3ddev->SetStreamSource(); d3ddev->DrawPrimitive(D3DPT_POINTLIST,0,X); 雪:使用顶点精灵...... d3ddev->SetTexture(0,m_texture); d3ddev->SetRender(D3DRS_ALPHABLENENABLE,TURE); d3ddev->SetRender(D3DRS_SRCALPHA,D3DBLEN_SRCALPHA); d3ddev->SetRender(D3DRS_DESTALPHA,D3DBLEN_INVSRCALPHA); d3ddev->SetRender(D3DRS_ALPHATEXTENABLE,TURE); d3ddev->SetRender(D3DRS_ALPHAREC,0x0f); d3ddev->SetRender(D3DRS_ALPHAFUNC,D3DCMP_CREATEREQUAL); d3ddev->SetVertexShader(); d3ddev->SetStreamSource(); d3ddev->DrawPrimitive(); ----------------------------------------------------------------- -------------------------------------------------------------------- ------------------------------------------------------------------------ LPD3DXLIGHT D3dlight;//D3DLIGHT //D3dlight.Type=D3DLIGHT_POINT; D3dlight.Diffuse.r=23;//23.0f ...... D3dlight.Specular.r=23;//23.0f ...... D3dlight.Ambient.r=23;//23.0f ...... D3dlight.Attenuation0=1.0f;// ...... D3dlight.Range=200;//200.0f D3dlight.Position.x=0.0f; ...... D3d->SetLight(0,&D3dlight);//****** D3d->LightEnable(0,TRUE);//******* D3d->SetRenderState(D3DRS_LIGHTING,TRUE); D3d->SetRenderState(D3DRS_AMBINT,D3DCOLOR_XRGB(32,32,32));//XRGB D3DXMATERICAL D3dMaterial; D3dMaterical.Diffuse=D3DCOLORVALUE(0,0,0); D3dMaterical.Ambient=D3DCOLORVALUE(0,0,0); D3dMaterical.Specular=D3DCOLORVALUE(0,0,0); D3dMaterical.Power=0; D3dMaterical.Emissive=D3DCOLORVALUE(0,0,0); D3d->SetMaterial(&D3dMaterial); VecArray//顶点数组 D3DXVECTOR3 Vec1,VecTemp1; D3DXVECTOR3 Vec2,VecTemp2; D3DXVERTOR3 VecNormal; for(int i=0;i<顶点总数;i+=3){ Vec1=D3DXVECTOR3(VecArray[i].x,VecArray[i].y,VecArray[i].z); Vec2=D3DXVERTOR3(VecArray[i+1].x,VecArray [i+1].y,VecArray[i+1].z); Vec2=D3DXVERTOR3(VecArray[i+2].x,VecArray[i+2].y,VecArray[i+2].z); D3DXVec3Subtract(&VecTemp1,Vec2,Vec1); D3DXVec3Subtract(&VecTemp2,Vec3,Vec1); D3DXVec3Cross(&VecNormal,&VecTemp1,&VecTemp2); D3DXVec3Normalize(&VecNormal,&VecNormal); VecArray[i].nx=VecNormal.x; VecArray[i].ny=VecNormal.y; VecArray[i].nz=VecNormal.z; VecArray[i+1].nx=VecNormal.x; VecArray[i+1].ny=VecNormal.y; VecArray[i+1].nz=VecNormal.z; VecArray[i+2].nx=VecNormal.x; VecArray[i+2].ny=VecNormal.y; VecArray[i+2].nz=VecNormal.z; } --------- d3ddev-SetTextureStageState(纹理层号,状态类型,状态值); 0,D3DTSS_ADDRESSU,D3DTADDRESS_WRAP 0,D3DTSS_ADDRESSV,D3DTADDRESS_CLAMP 0,D3DTSS_ADDRESSU,D3DTADDRESS_MIRROR D3DTSS_ADDRESSU,D3DTSS_ADDRESSV WRAP,CLAMP,MIRROR ---- 0,D3DTSS_MAGFILTER,D3DTEXF_LINEAR 0,D3DTSS_MINFILTER,D3DTEXF_LINEAR 0,D3DTSS_MIPFILTER,D3DTEXF_LINEAR 0,D3DTSS_MIPFILTER,D3DTEXF_POINT ---- 0,D3DTSS_COLORARG1,D3DTA_CURRENT 0,D3DTSS_COLORARG2,D3DTA_DIFFUSE 0,D3DTSS_COLORARG1,D3DTA_TEXTURE 0,D3DTSS_COLOROP,D3DTOP_ADD 0,D3DTSS_COLOROP,D3DTOP_LESS 0,D3DTSS_COLOROP,D3DTOP_MODULATE 0,D3DTSS_COLOROP,D3DTOP_SELECTARG1 0,D3DTSS_COLOROP,D3DTOP_SELECTARG2 ---- 0,D3DTSS_ALPHAARG1,0x00 0,D3DTSS_ALPHAARG2,0x0f 0,D3DTSS_ALPHAOP,D3DTOP_MODULATE ---- d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE,TRUE); d3ddev->SetRenderState(D3DRS_ALPHAREF,0xff); d3ddev->SetRenderState(D3DRS_ALPHAFUNC,D3DCMP_GREATEREQUAL); ---- d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE); d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTALPHA); --------- -------------------------DX全面练习-------------------- LPDIRECT3D8 d3d; LPDIRECT3DDEVICE d3ddev; D3DDISPLAYMODE dismode; LPPRESENT_PARAMETERS present; d3d=CreateDirect3D(D3D_SDK_VESION); d3d->GetAdapaterDisplayMode(D3DADAPATER_DEFAULT,&dismode); present.Windowed=True; present.SwapEffect=dismode.Format; present.BackBufferFormat=dismode.Format; d3ddev->DrawPrimitive(D3DPT_POINTLIST,0,1);//D3DPT_POINTSTRIP,D3DPT_TRANGLELIST,D3DPT_TRANGLESTRIP,D3DPT_LINELIST,D3DPT_LINESTRIP,D3DPT_TRANGLEFAN//S d3ddev->Clear(0,D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,1.0f,0); d3ddev->BeginScene(); d3ddev->EndScene(); d3ddev->Present(NULL,NULL,NULL,NULL); D3DXMetrixPespective(&d3dxmetrix,D3DX_PI/4,1.0f,1.0f,100.0f,0); d3ddev->SetRenderState(D3DRS_PROJECTION,&d3dxmetrix); D3DXMetrixLookAtFovLH(&d3dxmetrix,x,y,z); d3ddev->SetRenderState(D3DRS_VIEW,&d3dmetrix); D3DXMetrixTranslation(&d3dxmetrix,x,y,z); D3DXMetrixRotationX(&d3dxmetrix,45.0f); D3DXMetrixRotationY(&d3dxmetrix,45.0f); D3DXMetrixRotationZ(&d3dxmetrix,45.0f); D3dXMetrixRotationAsny(&d3dxmetrix,45.0f);// d3ddev->SetRenderState(D3DRS_WORD,&d3dmetrix); present.FullScreen_RefreshRateInHz=D3DPT_RATE_DEFAULT; present.FullScreen_ReresentationInterval=D3DPT_INTERVAL_ONE; present.Windwoed=FALSE; present.BackBufferWidth=800; present.BackBufferHeight=600; LPDirct3DTexture8 texture; type struct COSTUMVERTEX{ float x,y,z; DWORD color; float ux,vx; }; d3ddev->SetTextureStageState(D3DTSS_ADDRESSU,D3DTADDRESS_WRAP);//MIRROR,CLAMP d3ddev->SetTextureStageState(D3DTSS_MAGFILTER,D3DTEXF_LINEAR); d3ddev->SetRenderState(D3DRS_COLORARG1,D3DTA_DIFFUSE);//CURRENT,TEXTURE d3ddev->SetRenderState(D3DRS_COLORARG2.D3DTA_DIFFUSE);// d3ddev->SetRenderState(D3DRS_COLOROP,D3DOP_MODULATE);//ADD,LESS,SUBSTRACT// d3ddev->SetRenderState(D3DRS_ALPHAARG1,D3DTA_DIFFUSE);//CURRENT,TEXTURE// d3ddev->SetRenderState(D3DRS_ALPHAARG2,D3DTA_DIFFUSE);// d3ddev->SetRenderState(D3DRS_ALPHAOP,D3DOP_MODULATE);//ADD,LESS,SUBSTRACT// d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE,TRUE); d3ddev->SetRenderState(D3DRS_ALPHAREC,0x0f); d3ddev->SetRenderState(D3DRS_ALPHAOP,D3DCMP_GREATEREQUAIL); d3ddev->SetRenderState(D3DRS_ALPHATESTENABLE,TRUE); d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE); d3ddev->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SCRALPHA); d3ddev->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTALPHA); d3ddev->SetTextureStageState(D3DTSS_MIPFILTER,D3DTEXF_POINT);

这篇关于常用d3d操作的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/386246

相关文章

使用MongoDB进行数据存储的操作流程

《使用MongoDB进行数据存储的操作流程》在现代应用开发中,数据存储是一个至关重要的部分,随着数据量的增大和复杂性的增加,传统的关系型数据库有时难以应对高并发和大数据量的处理需求,MongoDB作为... 目录什么是MongoDB?MongoDB的优势使用MongoDB进行数据存储1. 安装MongoDB

Linux使用fdisk进行磁盘的相关操作

《Linux使用fdisk进行磁盘的相关操作》fdisk命令是Linux中用于管理磁盘分区的强大文本实用程序,这篇文章主要为大家详细介绍了如何使用fdisk进行磁盘的相关操作,需要的可以了解下... 目录简介基本语法示例用法列出所有分区查看指定磁盘的区分管理指定的磁盘进入交互式模式创建一个新的分区删除一个存

Golang操作DuckDB实战案例分享

《Golang操作DuckDB实战案例分享》DuckDB是一个嵌入式SQL数据库引擎,它与众所周知的SQLite非常相似,但它是为olap风格的工作负载设计的,DuckDB支持各种数据类型和SQL特性... 目录DuckDB的主要优点环境准备初始化表和数据查询单行或多行错误处理和事务完整代码最后总结Duck

Java 字符数组转字符串的常用方法

《Java字符数组转字符串的常用方法》文章总结了在Java中将字符数组转换为字符串的几种常用方法,包括使用String构造函数、String.valueOf()方法、StringBuilder以及A... 目录1. 使用String构造函数1.1 基本转换方法1.2 注意事项2. 使用String.valu

C# 读写ini文件操作实现

《C#读写ini文件操作实现》本文主要介绍了C#读写ini文件操作实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录一、INI文件结构二、读取INI文件中的数据在C#应用程序中,常将INI文件作为配置文件,用于存储应用程序的

Python使用qrcode库实现生成二维码的操作指南

《Python使用qrcode库实现生成二维码的操作指南》二维码是一种广泛使用的二维条码,因其高效的数据存储能力和易于扫描的特点,广泛应用于支付、身份验证、营销推广等领域,Pythonqrcode库是... 目录一、安装 python qrcode 库二、基本使用方法1. 生成简单二维码2. 生成带 Log

Java操作ElasticSearch的实例详解

《Java操作ElasticSearch的实例详解》Elasticsearch是一个分布式的搜索和分析引擎,广泛用于全文搜索、日志分析等场景,本文将介绍如何在Java应用中使用Elastics... 目录简介环境准备1. 安装 Elasticsearch2. 添加依赖连接 Elasticsearch1. 创

java Stream操作转换方法

《javaStream操作转换方法》文章总结了Java8中流(Stream)API的多种常用方法,包括创建流、过滤、遍历、分组、排序、去重、查找、匹配、转换、归约、打印日志、最大最小值、统计、连接、... 目录流创建1、list 转 map2、filter()过滤3、foreach遍历4、groupingB

Java操作PDF文件实现签订电子合同详细教程

《Java操作PDF文件实现签订电子合同详细教程》:本文主要介绍如何在PDF中加入电子签章与电子签名的过程,包括编写Word文件、生成PDF、为PDF格式做表单、为表单赋值、生成文档以及上传到OB... 目录前言:先看效果:1.编写word文件1.2然后生成PDF格式进行保存1.3我这里是将文件保存到本地后

VUE动态绑定class类的三种常用方式及适用场景详解

《VUE动态绑定class类的三种常用方式及适用场景详解》文章介绍了在实际开发中动态绑定class的三种常见情况及其解决方案,包括根据不同的返回值渲染不同的class样式、给模块添加基础样式以及根据设... 目录前言1.动态选择class样式(对象添加:情景一)2.动态添加一个class样式(字符串添加:情