Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


let there be lights

This topic is 6173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

g_pD3D = Direct3DCreate8( D3D_SDK_VERSION ); g_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ); ZeroMemory( &d3dpp, sizeof(d3dpp) d3dpp.Windowed = FALSE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.BackBufferWidth = windowsheight; d3dpp.BackBufferHeight = windowswidth;. g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp, &g_pd3dDevice ); g_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); g_pd3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE); ZeroMemory(&Light, sizeof(D3DLIGHT8)); ZeroMemory(&Material, sizeof(D3DMATERIAL8)); Light.Type=D3DLIGHT_POINT; Light.Diffuse.r=1.0f; Light.Diffuse.g=1.0f; Light.Diffuse.b=1.0f; Light.Position=D3DXVECTOR3(0,0,-10); Light.Range=10.0f; g_pd3dDevice->SetLight(0,&Light); g_pd3dDevice->LightEnable(0,TRUE); Material.Diffuse.r=1.0f; Material.Diffuse.g=0.0f; Material.Diffuse.b=0.0f; Material.Diffuse.a=1.0f; Material.Ambient.r=1.0f; Material.Ambient.g=1.0f; Material.Ambient.b=0.0f; Material.Ambient.a=1.0f; g_pd3dDevice->SetMaterial(&Material); g_pd3dDevice->CreateVertexBuffer( 30*sizeof(CUSTOMVERTEX), D3DUSAGE_DYNAMIC, D3DFVF_CUSTOMVERTEX,D3DPOOL_DEFAULT,&g_pVertexBuffer1 ); g_pd3dDevice->CreateVertexBuffer( 30*sizeof(CUSTOMVERTEX),D3DUSAGE_DYNAMIC, D3DFVF_CUSTOMVERTEX,D3DPOOL_DEFAULT, &g_pVertexBuffer2 ); ----------------------------------------- CUSTOMVERTEX g_Vertices[] = { { 0.0f,0.0f, 0.0f,D3DCOLOR_XRGB(0,255,0) }, // x,y,z,color { 1.0f,0.0f, 0.0f,D3DCOLOR_XRGB(0,0,255) }, { 1.0f,1.0f, 0.0f,D3DCOLOR_XRGB(255,255,0) }, { 0.0f,1.0f, 0.0f,D3DCOLOR_XRGB(0,255,0) }, { 0.0f,0.0f, 0.0f,D3DCOLOR_XRGB(255,0,0) }, { 0.0f,0.0f, -1.0f,D3DCOLOR_XRGB(0,0,255) }, // x,y,z,color { 1.0f,0.0f, -1.0f,D3DCOLOR_XRGB(255,255,0) }, { 1.0f,1.0f, -1.0f,D3DCOLOR_XRGB(0,255,255) }, { 0.0f,1.0f, -1.0f,D3DCOLOR_XRGB(255,0,0) }, { 0.0f,0.0f, -1.0f,D3DCOLOR_XRGB(255,255,0) }, }; CUSTOMVERTEX g_Triangeln[] = { { 0.0f,0.0f, 0.0f,D3DCOLOR_XRGB(0,255,0) }, // x,y,z,color { -1.0f,-1.0f, 0.0f,D3DCOLOR_XRGB(0,0,255) }, { 1.0f,-1.0f, 0.0f,D3DCOLOR_XRGB(0,255,0) }, }; ----------------------------------- have i forgotten something here because i got a black screen. and what's up with the normals?, do i have to specify the normal for every single vertices?. thanks in advance Edited by - Funkodysse on November 23, 2001 9:20:13 AM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!