• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Lakshmi Narayan

Members
  • Content count

    12
  • Joined

  • Last visited

Community Reputation

131 Neutral

About Lakshmi Narayan

  • Rank
    Member
  1. Thanks a lot for sparing your time on this and for editing my code. Now the code works after making some changes. Also, one of the problems with the earlier one was i missed a call statement to drawscene() but not able to understand why "the device not initialized" error occurred because even in the earlier code ,the device initialization was done in graphics class and i just called a function from game class passing HWND parameter. Thanks again i really appreciate it, spent almost two weeks trying to figure out.
  2. Thanks for ur response
  3. Hello I was trying to set up a basic game frame work using directx with c++ and i get a run time error of not able to initialize direct 3d device. It would be great if some one tells me where i am going wrong.The code actually works properly before splitting it up into classes [source lang="cpp"]Defines.h #ifndef __DEFINES_H_INCLUDED__ #define __DEFINES_H_INCLUDED__ #include<d3d9.h> #include<d3dx9.h> #endif Camera.h #ifndef __CAMERA_H_INCLUDED__ #define __CAMERA_H_INCLUDED__ #include "defines.h" class Camera { public: Camera(); //~Camera(); void SetUpCamera(LPDIRECT3DDEVICE9 ); }; #endif Graphics.h #ifndef __GRAPHICS_H_INCLUDED__ #define __GRAPHICS_H_INCLUDED__ #include "defines.h" class Graphics { public: Graphics(); //~Graphics(); LPDIRECT3DDEVICE9 InitializeDevice(HWND ); LPDIRECT3DVERTEXBUFFER9 FillVertices(HWND , LPDIRECT3DDEVICE9 ); struct OURCUSTOMVERTEX { float x,y,z; DWORD color; }; private: LPDIRECT3D9 p_dx_Object;//HWND hWnd LPDIRECT3DDEVICE9 p_dx_Device; OURCUSTOMVERTEX cv_Vertices[3]; LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer; /*IDirect3D9* pDirect3D; IDirect3DDevice9* pDevice; IDirect3DSurface9* pBackBuffer;*/ }; #endif Renderer.h #ifndef __RENDERER_H_INCLUDED__ #define __RENDERER_H_INCLUDED__ #include "defines.h" #include "Graphics.h" class Renderer:Graphics { public: Renderer(); //~Renderer(); void DrawScene(LPDIRECT3DDEVICE9 , LPDIRECT3DVERTEXBUFFER9 ); private: //Graphics g; }; #endif Windows.cpp #include<Windows.h> #include"Game.h" int run =5; LRESULT CALLBACK OurWindowProcedure(HWND han_Wind,UINT uint_Message,WPARAM parameter1,LPARAM parameter2) { switch(uint_Message) { case WM_KEYDOWN: { run=0; break; } break; } return DefWindowProc(han_Wind,uint_Message,parameter1,parameter2); } HWND NewWindow(LPCTSTR str_Title,int int_XPos, int int_YPos, int int_Width, int int_Height) { WNDCLASSEX wnd_Structure; wnd_Structure.cbSize = sizeof(WNDCLASSEX); wnd_Structure.style = CS_HREDRAW | CS_VREDRAW; wnd_Structure.lpfnWndProc = OurWindowProcedure; wnd_Structure.cbClsExtra = 0; wnd_Structure.cbWndExtra = 0; wnd_Structure.hInstance = GetModuleHandle(NULL); wnd_Structure.hIcon = NULL; wnd_Structure.hCursor = NULL; wnd_Structure.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); wnd_Structure.lpszMenuName = NULL; wnd_Structure.lpszClassName = L"WindowClassName"; wnd_Structure.hIconSm = LoadIcon(NULL,IDI_APPLICATION); RegisterClassEx(&wnd_Structure); return CreateWindowEx(WS_EX_CONTROLPARENT, L"WindowClassName", str_Title, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, int_XPos, int_YPos, int_Width, int_Height, NULL, NULL, GetModuleHandle(NULL), NULL); } int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreviousInstance,LPSTR lpcmdline,int nCmdShow) { MSG msg_Message; HWND han_Window = NewWindow(L"DirectX C++ Tutorial",100,100,500,500); //LPDIRECT3DDEVICE9 p_Device = g.InitializeDevice(han_Window); //LPDIRECT3DVERTEXBUFFER9 p_dx_VB = g.FillVertices(han_Window, p_Device); //c.SetUpCamera(p_Device); Game gm; while(run) { if(PeekMessage(&msg_Message,han_Window,0,0,PM_REMOVE)) { DispatchMessage(&msg_Message); } else { gm.Play(han_Window); } } // p_Device->Release(); gm.Destroy(); DestroyWindow(han_Window); return 0; } Renderer.cpp #include"Renderer.h" Renderer::Renderer() { } void Renderer:: DrawScene(LPDIRECT3DDEVICE9 p_dx_Device, LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer) { p_dx_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(72,61,139), 1.0f, 0); p_dx_Device->BeginScene(); p_dx_Device->SetStreamSource(0, p_dx_VertexBuffer, 0, sizeof(OURCUSTOMVERTEX)); p_dx_Device->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE); p_dx_Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); p_dx_Device->EndScene(); p_dx_Device->Present(NULL, NULL, NULL, NULL); } Graphics.cpp #include"Graphics.h" #include<Windows.h> Graphics :: Graphics() { } LPDIRECT3DDEVICE9 Graphics :: InitializeDevice(HWND han_WindowToBindTo) { //LPDIRECT3D9 p_dx_Object; // LPDIRECT3DDEVICE9 p_dx_Device; p_dx_Object = Direct3DCreate9(D3D_SDK_VERSION); if (p_dx_Object == NULL) { MessageBox(han_WindowToBindTo,L"DirectX Runtime library not installed!",L"InitializeDevice()",MB_OK); } D3DPRESENT_PARAMETERS dx_PresParams; ZeroMemory( &dx_PresParams, sizeof(dx_PresParams) ); dx_PresParams.Windowed = TRUE; dx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD; dx_PresParams.BackBufferFormat = D3DFMT_UNKNOWN; if (FAILED(p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, han_WindowToBindTo, D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device))) { if (FAILED(p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, han_WindowToBindTo, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device))) { MessageBox(han_WindowToBindTo,L"Failed to create even the reference device!",L"InitializeDevice()",MB_OK); } } p_dx_Device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); p_dx_Device->SetRenderState(D3DRS_LIGHTING,false); return p_dx_Device; } LPDIRECT3DVERTEXBUFFER9 Graphics:: FillVertices(HWND han_Window, LPDIRECT3DDEVICE9 p_dx_Device) { // OURCUSTOMVERTEX cv_Vertices[3]; // LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer; cv_Vertices[0].x = 5.0f; cv_Vertices[0].y = 10.0f; cv_Vertices[0].z = 0.0f; cv_Vertices[0].color = 0xffff0000; cv_Vertices[1].x = 10.0f; cv_Vertices[1].y = 0.0f; cv_Vertices[1].z = 0.0f; cv_Vertices[1].color = 0xff00ff00; cv_Vertices[2].x = 0.0f; cv_Vertices[2].y = 0.0f; cv_Vertices[2].z = 0.0f; cv_Vertices[2].color = 0xff00ffff; if (FAILED(p_dx_Device->CreateVertexBuffer(3*sizeof(OURCUSTOMVERTEX), 0, D3DFVF_XYZ|D3DFVF_DIFFUSE, D3DPOOL_DEFAULT, &p_dx_VertexBuffer, NULL))) { MessageBox(han_Window,L"Error while creating VertexBuffer",L"FillVertices()",MB_OK); } VOID* p_Vertices; if (FAILED(p_dx_VertexBuffer->Lock(0, 3*sizeof(OURCUSTOMVERTEX), (void**)&p_Vertices, 0))) { MessageBox(han_Window,L"Error trying to lock",L"FillVertices()",MB_OK); }else{ memcpy(p_Vertices, cv_Vertices, 3*sizeof(OURCUSTOMVERTEX)); p_dx_VertexBuffer->Unlock(); } return p_dx_VertexBuffer; } Game.cpp #include"Game.h" Game::Game() { } void Game :: Play(HWND hWnd1) { // MSG msg_Message; //HWND han_Window = w.NewWindow(L"DirectX C++ Tutorial",100,100,500,500); p_Device = g.InitializeDevice(hWnd1); p_dx_VB = g.FillVertices(hWnd1, p_Device); c.SetUpCamera(p_Device); p_Device->Release(); } void Game :: Destroy() { p_Device->Release(); } Camera.cpp #include"Camera.h" Camera :: Camera () { } void Camera :: SetUpCamera(LPDIRECT3DDEVICE9 p_dx_Device) { D3DXVECTOR3 m_EyePos(0, 0, -30); D3DXVECTOR3 m_TargetPos(0, 0, 0); D3DXVECTOR3 m_UpVector(0, 1, 0); D3DXMATRIXA16 m_View; D3DXMatrixLookAtLH(&m_View, &m_EyePos, &m_TargetPos, &m_UpVector); p_dx_Device->SetTransform(D3DTS_VIEW, &m_View); D3DXMATRIX m_Projection; D3DXMatrixPerspectiveFovLH(&m_Projection, D3DX_PI/4, 500/500, 1, 50); p_dx_Device->SetTransform(D3DTS_PROJECTION, &m_Projection); } [/source]
  4. Hello I was trying to set up a basic game frame work using directx with c++ and i get a run time error of not able to initialize direct 3d device. It would be great if some one tells me where i am going wrong.The code actually works properly before splitting it up into classes. I am pasting the code below. Defines.h #ifndef __DEFINES_H_INCLUDED__ #define __DEFINES_H_INCLUDED__ #include<d3d9.h> #include<d3dx9.h> #endif Camera.h #ifndef __CAMERA_H_INCLUDED__ #define __CAMERA_H_INCLUDED__ #include "defines.h" class Camera { public: Camera(); //~Camera(); void SetUpCamera(LPDIRECT3DDEVICE9 ); }; #endif Graphics.h #ifndef __GRAPHICS_H_INCLUDED__ #define __GRAPHICS_H_INCLUDED__ #include "defines.h" class Graphics { public: Graphics(); //~Graphics(); LPDIRECT3DDEVICE9 InitializeDevice(HWND ); LPDIRECT3DVERTEXBUFFER9 FillVertices(HWND , LPDIRECT3DDEVICE9 ); struct OURCUSTOMVERTEX { float x,y,z; DWORD color; }; private: LPDIRECT3D9 p_dx_Object;//HWND hWnd LPDIRECT3DDEVICE9 p_dx_Device; OURCUSTOMVERTEX cv_Vertices[3]; LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer; /*IDirect3D9* pDirect3D; IDirect3DDevice9* pDevice; IDirect3DSurface9* pBackBuffer;*/ }; #endif Renderer.h #ifndef __RENDERER_H_INCLUDED__ #define __RENDERER_H_INCLUDED__ #include "defines.h" #include "Graphics.h" class Renderer:Graphics { public: Renderer(); //~Renderer(); void DrawScene(LPDIRECT3DDEVICE9 , LPDIRECT3DVERTEXBUFFER9 ); private: //Graphics g; }; #endif Windows.cpp #include<Windows.h> #include"Game.h" int run =5; LRESULT CALLBACK OurWindowProcedure(HWND han_Wind,UINT uint_Message,WPARAM parameter1,LPARAM parameter2) { switch(uint_Message) { case WM_KEYDOWN: { run=0; break; } break; } return DefWindowProc(han_Wind,uint_Message,parameter1,parameter2); } HWND NewWindow(LPCTSTR str_Title,int int_XPos, int int_YPos, int int_Width, int int_Height) { WNDCLASSEX wnd_Structure; wnd_Structure.cbSize = sizeof(WNDCLASSEX); wnd_Structure.style = CS_HREDRAW | CS_VREDRAW; wnd_Structure.lpfnWndProc = OurWindowProcedure; wnd_Structure.cbClsExtra = 0; wnd_Structure.cbWndExtra = 0; wnd_Structure.hInstance = GetModuleHandle(NULL); wnd_Structure.hIcon = NULL; wnd_Structure.hCursor = NULL; wnd_Structure.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); wnd_Structure.lpszMenuName = NULL; wnd_Structure.lpszClassName = L"WindowClassName"; wnd_Structure.hIconSm = LoadIcon(NULL,IDI_APPLICATION); RegisterClassEx(&wnd_Structure); return CreateWindowEx(WS_EX_CONTROLPARENT, L"WindowClassName", str_Title, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE, int_XPos, int_YPos, int_Width, int_Height, NULL, NULL, GetModuleHandle(NULL), NULL); } int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreviousInstance,LPSTR lpcmdline,int nCmdShow) { MSG msg_Message; HWND han_Window = NewWindow(L"DirectX C++ Tutorial",100,100,500,500); //LPDIRECT3DDEVICE9 p_Device = g.InitializeDevice(han_Window); //LPDIRECT3DVERTEXBUFFER9 p_dx_VB = g.FillVertices(han_Window, p_Device); //c.SetUpCamera(p_Device); Game gm; while(run) { if(PeekMessage(&msg_Message,han_Window,0,0,PM_REMOVE)) { DispatchMessage(&msg_Message); } else { gm.Play(han_Window); } } // p_Device->Release(); gm.Destroy(); DestroyWindow(han_Window); return 0; } Renderer.cpp #include"Renderer.h" Renderer::Renderer() { } void Renderer:: DrawScene(LPDIRECT3DDEVICE9 p_dx_Device, LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer) { p_dx_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(72,61,139), 1.0f, 0); p_dx_Device->BeginScene(); p_dx_Device->SetStreamSource(0, p_dx_VertexBuffer, 0, sizeof(OURCUSTOMVERTEX)); p_dx_Device->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE); p_dx_Device->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); p_dx_Device->EndScene(); p_dx_Device->Present(NULL, NULL, NULL, NULL); } Graphics.cpp #include"Graphics.h" #include<Windows.h> Graphics :: Graphics() { } LPDIRECT3DDEVICE9 Graphics :: InitializeDevice(HWND han_WindowToBindTo) { //LPDIRECT3D9 p_dx_Object; // LPDIRECT3DDEVICE9 p_dx_Device; p_dx_Object = Direct3DCreate9(D3D_SDK_VERSION); if (p_dx_Object == NULL) { MessageBox(han_WindowToBindTo,L"DirectX Runtime library not installed!",L"InitializeDevice()",MB_OK); } D3DPRESENT_PARAMETERS dx_PresParams; ZeroMemory( &dx_PresParams, sizeof(dx_PresParams) ); dx_PresParams.Windowed = TRUE; dx_PresParams.SwapEffect = D3DSWAPEFFECT_DISCARD; dx_PresParams.BackBufferFormat = D3DFMT_UNKNOWN; if (FAILED(p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, han_WindowToBindTo, D3DCREATE_HARDWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device))) { if (FAILED(p_dx_Object->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, han_WindowToBindTo, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &dx_PresParams, &p_dx_Device))) { MessageBox(han_WindowToBindTo,L"Failed to create even the reference device!",L"InitializeDevice()",MB_OK); } } p_dx_Device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); p_dx_Device->SetRenderState(D3DRS_LIGHTING,false); return p_dx_Device; } LPDIRECT3DVERTEXBUFFER9 Graphics:: FillVertices(HWND han_Window, LPDIRECT3DDEVICE9 p_dx_Device) { // OURCUSTOMVERTEX cv_Vertices[3]; // LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer; cv_Vertices[0].x = 5.0f; cv_Vertices[0].y = 10.0f; cv_Vertices[0].z = 0.0f; cv_Vertices[0].color = 0xffff0000; cv_Vertices[1].x = 10.0f; cv_Vertices[1].y = 0.0f; cv_Vertices[1].z = 0.0f; cv_Vertices[1].color = 0xff00ff00; cv_Vertices[2].x = 0.0f; cv_Vertices[2].y = 0.0f; cv_Vertices[2].z = 0.0f; cv_Vertices[2].color = 0xff00ffff; if (FAILED(p_dx_Device->CreateVertexBuffer(3*sizeof(OURCUSTOMVERTEX), 0, D3DFVF_XYZ|D3DFVF_DIFFUSE, D3DPOOL_DEFAULT, &p_dx_VertexBuffer, NULL))) { MessageBox(han_Window,L"Error while creating VertexBuffer",L"FillVertices()",MB_OK); } VOID* p_Vertices; if (FAILED(p_dx_VertexBuffer->Lock(0, 3*sizeof(OURCUSTOMVERTEX), (void**)&p_Vertices, 0))) { MessageBox(han_Window,L"Error trying to lock",L"FillVertices()",MB_OK); }else{ memcpy(p_Vertices, cv_Vertices, 3*sizeof(OURCUSTOMVERTEX)); p_dx_VertexBuffer->Unlock(); } return p_dx_VertexBuffer; } Game.cpp #include"Game.h" Game::Game() { } void Game :: Play(HWND hWnd1) { // MSG msg_Message; //HWND han_Window = w.NewWindow(L"DirectX C++ Tutorial",100,100,500,500); p_Device = g.InitializeDevice(hWnd1); p_dx_VB = g.FillVertices(hWnd1, p_Device); c.SetUpCamera(p_Device); p_Device->Release(); } void Game :: Destroy() { p_Device->Release(); } Camera.cpp #include"Camera.h" Camera :: Camera () { } void Camera :: SetUpCamera(LPDIRECT3DDEVICE9 p_dx_Device) { D3DXVECTOR3 m_EyePos(0, 0, -30); D3DXVECTOR3 m_TargetPos(0, 0, 0); D3DXVECTOR3 m_UpVector(0, 1, 0); D3DXMATRIXA16 m_View; D3DXMatrixLookAtLH(&m_View, &m_EyePos, &m_TargetPos, &m_UpVector); p_dx_Device->SetTransform(D3DTS_VIEW, &m_View); D3DXMATRIX m_Projection; D3DXMatrixPerspectiveFovLH(&m_Projection, D3DX_PI/4, 500/500, 1, 50); p_dx_Device->SetTransform(D3DTS_PROJECTION, &m_Projection); }
  5. i just need a simple book showing the way game is made from scratch
  6. hello i am planning to make a game from scratch using c++ with directx9 and i have experience making games using other's engine in directx. Can anyone suggest me a book or a way to start. I am looking for a book similar to Programming a Multiplayer FPS in DirectX but the problem with this book is the final code is directly given and executed. I am looking for a book which shows step by step building of an engine and then a game over it.
  7. [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]float4 Position : (POSITION0)?;[/background][/left][/size][/font][/color] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 ?[/background][/left][/size][/font][/color] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]so the above functions are used to [/background][/left][/size][/font][/color][left][background=rgb(250, 251, 252)][font="helvetica, arial, verdana, tahoma, sans-serif"][size="2"][color="#282828"]map vertex data to variables inside the shader but what is the vertex data in the above two lines of code. (can you elaborate)[/color][/size][/font][/background][/left] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=1][left][background=rgb(250, 251, 252)]Also suggest me a site or a tutorial where i can start learning to program shaders [/background][/left][/size][/font][/color]
  8. float4x4 World; float4x4 View;float4x4 Projection; float4 AmbientColor = float4(1, 1, 1, 1); float AmbientIntensity = 0.1; struct VertexShaderInput { float4 Position : POSITION0; }; struct VertexShaderOutput { float4 Position : POSITION0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; float4 worldPosition = mul(input.Position, World); float4 viewPosition = mul(worldPosition, View); output.Position = mul(viewPosition, Projection); return output; } float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { return AmbientColor * AmbientIntensity; } technique Ambient { pass Pass1 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } i am trying to learn how to use shaders with directx and i found this code over d net icould not understand the following thingsin above code float4 Position : (POSITION0)?; float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 ? Also how these function works technique Ambient { pass Pass1(wt is this) { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } Also, let me know if there is any video tutorial on shaders with directx.
  9. n;float4x4 World; float4x4 View;float4x4 World; float4x4 View; float4x4 Projectiofloat4x4 World; float4x4 View;float4x4 World; float4x4 View; float4x4 Projection; float4 AmbientColor = float4(1, 1, 1, 1); float AmbientIntensity = 0.1; struct VertexShaderInput { float4 Position : POSITION0; }; struct VertexShaderOutput { float4 Position : POSITION0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; float4 worldPosition = mul(input.Position, World); float4 viewPosition = mul(worldPosition, View); output.Position = mul(viewPosition, Projection); return output; } float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { return AmbientColor * AmbientIntensity; } technique Ambient { pass Pass1 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } }float4x4 Projection; float4 AmbientColor = float4(1, 1, 1, 1); float AmbientIntensity = 0.1; struct VertexShaderInput { float4 Position : POSITION0; }; struct VertexShaderOutput { float4 Position : POSITION0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; float4 worldPosition = mul(input.Position, World); float4 viewPosition = mul(worldPosition, View); output.Position = mul(viewPosition, Projection); return output; } float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { return AmbientColor * AmbientIntensity; } technique Ambient { pass Pass1 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } i am trying to learn how to use shaders with directx and i found this code over d net icould not understand the following thingsin above code float4 Position : (POSITION0)?; float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 ? Also how these function works technique Ambient { pass Pass1(wt is this) { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } Also, let me know if there is any video tutorial on shaders with directx.
  10. Thanks a lot for each one of your responses and i have decided first to make a game of my own then a engine.
  11. Thanks for the response but i have worked on two projects in my university course work where in i made games using directx 11 and directx 9 using our professor's game engine. Also, i have an idea how each module of a game engine works too but i don't know know how to start making it from the scratch.(or is it still to early for me to consider making a game engine)
  12. I am planning to build a game engine from scratch using c++ with directx 9. can some one tell me how to go about and also let me know if their is a book that shows step wise to make a game engine. Remember i m just a beginner and i have made games using some game engine and nothing more than that.