firefly28

Member
  • Content count

    42
  • Joined

  • Last visited

Community Reputation

126 Neutral

About firefly28

  • Rank
    Member
  1. Beginner -

    Hi BB , Yeah thats the last thing I would want to do(In hindsight perhaps I should have posted another thread ) , the reason I posted is because many of the questions you have asked are things Ive either just read about(Still learning) or would like to be sure Im understanding 100% , I think you have the right idea if you want to be sure your understanding stuff as well as possible before marching on :) [Im the same]. Anyway I posted just to try and help you get your most recent question answered , maybe post the code in full thats giving you the problem and one of the coders on here may see why your getting the issue you described (Maybe you did this but just thinking here that its best to have it on the final reply) Heres BBs question Guys/ladies: --------------------------------------------- I use -z to reverse the view but this created problems with the z axis and fixed the ones with x and y :) But currently there are other things that are more important that I must know. Like, when you're creating a light you also set the material. What is a material exactly and how does it work? Thanks. ---------------------------------------------- If this is incorrect update your post with a reply BB and then put your code in and such.
  2. Beginner -

    Quote:Original post by pcbrainbuster I'm getting on great to :) But its just those questions above that are hard for me to understand. As far as your question goes the up value I believe is the rotation of the scene you're looking at, for example have a look at the example posted in this thread by a member, he said something about how when you're looking at something you too can rotate your head to the left or right for a different view, this rotation is the up value. But I'm not sure :) (Question still apply) Thanks. Thanks guys :) I did see that part of the thread but I couldnt envisage what he was saying relating to the up value. Thank for that final post foxhunter , I was messing with the up value and did end up with my polygons upside down :) so it seems to make sense to me the post, the way Im thinking of it now is like a guy holding a camera if the up postion is say 1 then hes standing as one normally stands with a camera if its -1 hes standing upside down with the camera lol[balanced on head] (Kinda weird picture I have here hehe but whatever helps I guess :) ) He could be just turning the camera upside down I guess though :) I wont post anymore in brainbusters thread(Thanks for your help as well BB :) ) but I think it was this thread a com hyperlink was provided by MFD and just to say thats a brilliant link , Ive only had a quick look but its really well explained.
  3. Big THANKS for checking that out steve :)) , I meant to say in the thread but ive been busy with RL stuff a couple of days . Actually rated you as much as I could for this as I actually reckon many more people must be experiancing this bug and just not realising. Since it defaults to whats supposed to be software mode but runs in hardware mode so most people probably wont need to go in and change anything [Edited by - firefly28 on March 2, 2008 5:21:12 PM]
  4. Beginner -

    Hi I seem to be getting on okay with directx , I at least think Im fine where the lookat values are concerned and the other stuff :) . What Ive never been sure about is why we need an up value? its just position your lookat position for the viewer and it points to an area , I know it will be vital but its just for a good portion of the guide the author doesnt seem to change the up value so Ive never seen a practical use of it. (Also correct me if Im wrong but to me it seemed like in that guide the author had the camera looking at 0 [approx, cant remeber the exact number but if x0 was the start it was aiming at that area within a few coords] and I came to the conclusion that means the when Im using numbers to move graphics about I was having to do the inverse of what I would do if the viewpoint was comming from a traditional angle looking at cartesian coords?) One thing I found really useful in this thread was regarding triangle strips , I managed to do the tutorial end of lesson exercises but made some mistakes but It was probably because I wasnt sticking to CW , CCW order when drawing the triangle strips. Obviously prioritise what the original poster has asked but I just figured I should ask my question here as what Im needing to know is very basic and it keeps everything in the one place. Ive enjoyed doing that guide but Im glad I have a book to referance if needed :)
  5. Actually theres a "Windows SDK for Windows 2008 server" thats supposed to be compatible with MS VS Express 2008 Im not sure whether to go that route or just stick with MS VS 2005 and get the platform sdk r2? (Ok forget that aspect, just noticed text which seems to indicate we need to wait on the march dx sdk for 2008) EDIT: Bad news :( , the same thing happens on a fresh install - this must be a bug. If anyone knows a workaround or possibilitys of a fix feel free to add, but Im extremely reluctantly giving up with trying to get "Allow Hardware Acceleration" to work with the nov2007 SDK , do you think it would be worth trying an ealier sdk? It cant be anything to do with code since I havent coded anything on this install and the sdk keeps disabling direct3d in dxdiag and I know for a fact my card can run direct3d games. edit: ah ha! , Ok Im not building my hopes up too much but this time I ditched the nov2007 sdk and installed the august 2007 sdk and "Allow HW Accel" in DirectXSDK Cpanel----->DirectX3D9 Tab was correctly ticked by default, I unticked it that disabled direct3d in dxdiag then ticked it again and it correctly enables direct3d in Dxdiag I just hope Im not majorly missing out by using the august 2007 sdk(I got some warning during install about audio something or other that was advisable to update) as opposed to the nov2007 sdk but I have a sneaky suspicion the aforementioned code wont fall over via a null pointer but I will have to check first. Either way it seems to be behaving correctly now , i.e selecting hardware accel enables direct3d not the opposite way about. I wander whats casuing it , a bug with GTs and the nov2007 sdk? (I dont know but I have 2 other computers - one with a geforce 4 mx and another with an ati radeon x800 so maybe I will try the nov2007 sdk on those) Kinda weird though dont you think? Edit----------------------- Well I have hardware acceleration with the august 2007 sdk :))) , just as I suspected in the end there , all the recent code I have been having problems with now works fine with hardware acceleration on. The reason Ive kept updating the post is because I have seen others on the web with this problem and no solution and its been a headache. I was starting to think something was up with my card but considering I play high end games every few days my better sense made me think otherwise. Anyway hopefully this post saves people some major headaches, I have 2 other PCs in my house with differant cards from the GTs and I was going to try and see if I get the same problem with the nov 2007 sdk but I will probably just leave it. If anyone who has an Nvidia 8600GT and manages to get hardware acceleration working with the latest nov2007 sdk on xp please let me know, even PM me. Im really pleased to have things working but going back to the august SDK Im worried that later this may lead to other problems, how stable is the august SDK , does it lack anything substantial? <note to self ......give up more often lol> [Edited by - firefly28 on February 27, 2008 1:40:25 PM]
  6. Hi thanks for letting me know about your experiance with a similiar issue :) Heres the thing though , Im actually using windows xp professional. I will be honest with you folks though, the computer in question has been acting a bit weird, bot blue screens or anything but being unable to connect to gamedev and other sites some of the time and last night none of the time.(I can connect easily on another PC in the same house) Add to that the fact I had remnants of a MS VS beta version and was an error saying I couldnt uninstall because it cant find a valid ordering. I also had VS 6 and VS 2005 express on , I realise your not supposed to do that but this problem I was getting was happening irrespective of having these apps opened. Im sure it wont make a differance but theres a spare partition on the machine in question which has gentoo on it so Im formatting that and Im going to just put on VS Express on and keep that partition purely for coding.(You see my main partition has been running for over 6 months as I maintain it quite a bit - although I have a feeling I may have some spyware on that the detectorss arent picking up, hence starting afresh) Heres the order Im going to install stuff in , if anyone sees a flaw in my ordering feel free to chime in :) Winfast N570SM2AA chipset drivers Nvidia 8600GT Graphics Card Drivers DirectX (Would I be better installing that before graphics card drivers?) MS VS Express 2005
  7. Hiya , Thanks for your reply .......I tried differant code from the guys guide all to the same result - however I think I know whats causing the problem you see when I goto directXsdk----->directxUtilities----->DirectX control panel and turn "Allow hardware Acceleration Off" The code works. I actually thought I had this fixed as discussed in another thread but when I turn "Allow Hardware Acceleration" on it disables Direct3D in DXdiag display tab.......Is this supposed to happen?. Next when I turn direct3d back on in the dxdiag display tab by clicking enable all tests are passed then it turns of allow hardware acceleration in the directx control panel (See a pattern here hehe) Im just wandering whats causing this because its stopping me having hardware acceleration , here is the full code which works fine in software mode with the debug runtimes (Is there something I have to setup in my code for hardware acceleration? Its just Im thinking thats a bug that "Allow hardware acceleration" in dx control panel disables direct 3d? #if defined(DEBUG) || defined(_DEBUG) #ifndef D3D_DEBUG_INFO #define D3D_DEBUG_INFO #endif #endif // include the basic windows header files and the Direct3D header file #include <windows.h> #include <windowsx.h> //must be included before d3d9.h // include the basic windows header files and the Direct3D header file #include <d3d9.h> #include <d3dx9.h> // define the screen resolution and keyboard macros #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) #define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1) // include the Direct3D Library files #pragma comment (lib, "d3d9.lib") #pragma comment (lib, "d3dx9.lib") // global declarations LPDIRECT3D9 d3d; // the pointer to our Direct3D interface LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class LPDIRECT3DVERTEXBUFFER9 t_buffer = NULL; // the pointer to the vertex buffer // texture declarations LPDIRECT3DTEXTURE9 texture_1; // our first texture // function prototypes void initD3D(HWND hWnd); // sets up and initializes Direct3D void render_frame(void); // renders a single frame void cleanD3D(void); // closes Direct3D and releases memory void init_graphics(void); // 3D declarations struct CUSTOMVERTEX {FLOAT X, Y, Z; DWORD COLOR; FLOAT U, V;}; #define CUSTOMFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1) // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hWnd; WNDCLASSEX wc; ZeroMemory(&wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.lpszClassName = L"WindowClass"; RegisterClassEx(&wc); hWnd = CreateWindowEx(NULL, L"WindowClass", L"Our Direct3D Program", WS_EX_TOPMOST | WS_POPUP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow); // set up and initialize Direct3D initD3D(hWnd); // enter the main loop: MSG msg; while(TRUE) { DWORD starting_point = GetTickCount(); if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } render_frame(); // check the 'escape' key if(KEY_DOWN(VK_ESCAPE)) PostMessage(hWnd, WM_DESTROY, 0, 0); while ((GetTickCount() - starting_point) < 25); } // clean up DirectX and COM cleanD3D(); return msg.wParam; } // this is the main message handler for the program LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); return 0; } break; } return DefWindowProc (hWnd, message, wParam, lParam); } // this function initializes and prepares Direct3D for use void initD3D(HWND hWnd) { d3d = Direct3DCreate9(D3D_SDK_VERSION); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = FALSE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = hWnd; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.BackBufferWidth = SCREEN_WIDTH; d3dpp.BackBufferHeight = SCREEN_HEIGHT; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; // create a device class using this information and the info from the d3dpp stuct d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev); init_graphics(); // call the function to initialize the square d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE); // turn off the 3D lighting d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); // turn on the z-buffer return; } // this is the function used to render a single frame void render_frame(void) { int x = 1; d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->BeginScene(); // select which vertex format we are using d3ddev->SetFVF(CUSTOMFVF); // set the view transform D3DXMATRIX matView; // the view transform matrix D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3 (0.0f, 8.0f, 25.0f), // the camera position &D3DXVECTOR3 (0.0f, 0.0f, 0.0f), // the look-at position &D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); // the up direction d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the view transform to matView // set the projection transform D3DXMATRIX matProjection; // the projection transform matrix D3DXMatrixPerspectiveFovLH(&matProjection, D3DXToRadian(45), // the horizontal field of view (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio 1.0f, // the near view-plane 100.0f); // the far view-plane d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection); // set the projection // set the world transform static float index = 0.0f; index+=0.03f; // an ever-increasing float value D3DXMATRIX matRotateY; // a matrix to store the rotation for each triangle D3DXMatrixRotationY(&matRotateY, index); // the rotation matrix d3ddev->SetTransform(D3DTS_WORLD, &(matRotateY)); // set the world transform // select the vertex buffer to display d3ddev->SetStreamSource(0, t_buffer, 0, sizeof(CUSTOMVERTEX)); // set the texture d3ddev->SetTexture(0, texture_1); // draw the textured square d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); d3ddev->EndScene(); d3ddev->Present(NULL, NULL, NULL, NULL); return; } // this is the function that cleans up Direct3D and COM void cleanD3D(void) { t_buffer->Release(); // close and release the vertex buffer texture_1->Release(); // close and release the texture d3ddev->Release(); // close and release the 3D device d3d->Release(); // close and release Direct3D return; } // this is the function that puts the 3D models into video RAM void init_graphics(void) { // load the texture we will use D3DXCreateTextureFromFile(d3ddev, L"Wood.png", &texture_1); // create the vertices using the CUSTOMVERTEX struct CUSTOMVERTEX t_vert[] = { {5, 0, -5, 0xffffffff, 1, 0,}, {-5, 0, -5, 0xffffffff, 0, 0,}, {5, 0, 5, 0xffffffff, 1, 1,}, {-5, 0, 5, 0xffffffff, 0, 1,}, }; // create a vertex buffer interface called t_buffer d3ddev->CreateVertexBuffer(4*sizeof(CUSTOMVERTEX), 0, CUSTOMFVF, D3DPOOL_MANAGED, &t_buffer, NULL); VOID* pVoid; // a void pointer // lock t_buffer and load the vertices into it t_buffer->Lock(0, 0, (void**)&pVoid, 0); memcpy(pVoid, t_vert, sizeof(t_vert)); t_buffer->Unlock(); return; } [/souce] Any help on this is appreciated as its strange behaviour and Im starting to think it may not be the code if the control panel keeps disabling direct3d in dxdiag ----edit the weird thing is I have checked a good thread that Steve pointed me too but unlike that guy If I dont mess with the SDK Allow Hardware acceleration my dxdiag shows that Direct3d acceleration is enabled . My card is an nvidia 8600GT Sli capable, ow and I also checked the Caps part and HAL is there. This is very strange? Ok I had to do a few searches but looks like one of the people on another forum is getting the same problem but no solution Weird problem> edit: This is weird Ive updated to the latest nvidia driver and the same thing happens :( Could someone verify whether this is a bug or not when they have the time ? [Edited by - firefly28 on February 26, 2008 9:31:30 AM]
  8. Hi I have been doing a good bit of google searching and I it seems I no longer get the message binary not built with debug info, anyway now when I go to debug its like its going to setup break points then I get so far in my code and get the following error: ((*(IUnknown*)(&*(d3ddev)))).__vfptr CXX0030: Error: expression cannot be evaluated heres it written another way __vfptr CXX0030: Error: expression cannot be evaluated Heres a majorly cut down version of the code to show the problem line(At end of code) // include the basic windows header files and the Direct3D header file #include <windows.h> #include <windowsx.h> //must be included before d3d9.h #if defined(DEBUG) || defined(_DEBUG) #ifndef D3D_DEBUG_INFO #define D3D_DEBUG_INFO #endif #endif #include <d3d9.h> #include <d3dx9.h> #include <stdio.h> // include the Direct3D Library files # pragma comment(lib, "d3dx9.lib") # pragma comment (lib, "d3d9.lib") // define the screen resolution and keyboard macros #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) #define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1) // global declarations LPDIRECT3D9 d3d; // the pointer to our Direct3D interface LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class LPDIRECT3DVERTEXBUFFER9 t_buffer = NULL; // the pointer to the vertex buffer //ok skip to the problem fucntion void render_frame(void) { d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); //rest of code } I just want to get my debugging so I can use breakpoints and watches , to check values and other stuff. I think Im close but really need help on whats causing this issue? I have been reading 2 or 3 directX faqs and have gotten further but after changing all the linker settings and various optimisation flags to off Im getting this new error which there is many google results for . [Edited by - firefly28 on February 27, 2008 1:41:52 PM]
  9. eek that was a copy and paste job from the online tutorial Im reading well apart from dome defines and 2 changes to float values. Thanks for the tip though :) The next guide I use I will try and find one that codes like you suggest. Also the book Im waiting on has code that is done with the macros you mention. In saying that this code is just to help me understand whats needed(In that sense it is shaky test code) but I definatly want to use those macros sooner rather than later. I will see if the writer starts using them during the meshes chapter and if not I may look for some other guides. Thanks for the input Im sure that will help me with testing in the future :) edit: Im actually trying to use those macros in the following code i.e if((hr = SUCCEEDED(d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev)))){ printf("HR is %d \n",hr); init_graphics(); // call the function to initialize the square d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE); // turn off the 3D lighting d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); // turn on the z-buffer } else { //an error } Im not sure if this is correct but Im trying to test hr well first I just want to printf the numerical value of hr but I see no text printed from printf, how can I get it so I can test and view things with printf? [Edited by - firefly28 on February 25, 2008 3:33:27 PM]
  10. Hiya I have 2 Nvidia 8600GTs that are SLI capable but Im running in non sli mode . Im not sure if thats anything to do with it. In directX controlpanel------>utils------>Direct3d9 tab I just turned of hardware acceleration and the thing works? Thats weird though since I can run HL 2, the witcher , crysis and pretty much all high end games at decent performance (Even though the GTs are budget cards ) Im using an NVIDIA driver maybe 2 down from the latest one, do you think updating will help? I havent updated in a while since the NVIDIA sli drivers are a state and some of the older ones give better performance. Thanks for the help steve :) , Im actually going to check dxdiag since I may have hardware acceleration down for torment , but Im pretty certain I changed it back . (Checking wont do any harm , whatever happens it would be nice to get hardware acceleration working :) ) I will check the linked thread as well Cheers :) [in regards to this: D3DX: pDevice pointer is invalid I noticed that as well heres a copy and paste of the code from the tutorial site // include the basic windows header files and the Direct3D header file #include <windows.h> #include <windowsx.h> #include <d3d9.h> #include <d3dx9.h> // include the Direct3D Library files #ifdef _DEBUG # pragma comment(lib, "d3dx9d.lib") #else # pragma comment(lib, "d3dx9.lib") # pragma comment (lib, "d3d9.lib") #endif // define the screen resolution and keyboard macros #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0) #define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1) // global declarations LPDIRECT3D9 d3d; // the pointer to our Direct3D interface LPDIRECT3DDEVICE9 d3ddev; // the pointer to the device class LPDIRECT3DVERTEXBUFFER9 t_buffer = NULL; // the pointer to the vertex buffer // texture declarations LPDIRECT3DTEXTURE9 texture_1; // our first texture // function prototypes void initD3D(HWND hWnd); // sets up and initializes Direct3D void render_frame(void); // renders a single frame void cleanD3D(void); // closes Direct3D and releases memory void init_graphics(void); // 3D declarations struct CUSTOMVERTEX {FLOAT X, Y, Z; DWORD COLOR; FLOAT U, V;}; #define CUSTOMFVF (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1) // the WindowProc function prototype LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hWnd; WNDCLASSEX wc; ZeroMemory(&wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.lpszClassName = L"WindowClass"; RegisterClassEx(&wc); hWnd = CreateWindowEx(NULL, L"WindowClass", L"Our Direct3D Program", WS_EX_TOPMOST | WS_POPUP, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow); // set up and initialize Direct3D initD3D(hWnd); // enter the main loop: MSG msg; while(TRUE) { DWORD starting_point = GetTickCount(); if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } render_frame(); // check the 'escape' key if(KEY_DOWN(VK_ESCAPE)) PostMessage(hWnd, WM_DESTROY, 0, 0); while ((GetTickCount() - starting_point) < 25); } // clean up DirectX and COM cleanD3D(); return msg.wParam; } // this is the main message handler for the program LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); return 0; } break; } return DefWindowProc (hWnd, message, wParam, lParam); } // this function initializes and prepares Direct3D for use void initD3D(HWND hWnd) { d3d = Direct3DCreate9(D3D_SDK_VERSION); D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = FALSE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.hDeviceWindow = hWnd; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.BackBufferWidth = SCREEN_WIDTH; d3dpp.BackBufferHeight = SCREEN_HEIGHT; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; // create a device class using this information and the info from the d3dpp stuct d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3ddev); init_graphics(); // call the function to initialize the square d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE); // turn off the 3D lighting d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE); // turn on the z-buffer return; } // this is the function used to render a single frame void render_frame(void) { d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); d3ddev->BeginScene(); // select which vertex format we are using d3ddev->SetFVF(CUSTOMFVF); // set the view transform D3DXMATRIX matView; // the view transform matrix D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3 (0.0f, 8.0f, 25.0f), // the camera position &D3DXVECTOR3 (0.0f, 0.0f, 0.0f), // the look-at position &D3DXVECTOR3 (0.0f, 1.0f, 0.0f)); // the up direction d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the view transform to matView // set the projection transform D3DXMATRIX matProjection; // the projection transform matrix D3DXMatrixPerspectiveFovLH(&matProjection, D3DXToRadian(45), // the horizontal field of view (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio 1.0f, // the near view-plane 100.0f); // the far view-plane d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection); // set the projection // set the world transform static float index = 0.0f; index+=0.3f; // an ever-increasing float value D3DXMATRIX matRotateY; // a matrix to store the rotation for each triangle D3DXMatrixRotationY(&matRotateY, index); // the rotation matrix d3ddev->SetTransform(D3DTS_WORLD, &(matRotateY)); // set the world transform // select the vertex buffer to display d3ddev->SetStreamSource(0, t_buffer, 0, sizeof(CUSTOMVERTEX)); // set the texture d3ddev->SetTexture(0, texture_1); // draw the textured square d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); d3ddev->EndScene(); d3ddev->Present(NULL, NULL, NULL, NULL); return; } // this is the function that cleans up Direct3D and COM void cleanD3D(void) { t_buffer->Release(); // close and release the vertex buffer texture_1->Release(); // close and release the texture d3ddev->Release(); // close and release the 3D device d3d->Release(); // close and release Direct3D return; } // this is the function that puts the 3D models into video RAM void init_graphics(void) { // load the texture we will use D3DXCreateTextureFromFile(d3ddev, L"Wood.png", &texture_1); // create the vertices using the CUSTOMVERTEX struct CUSTOMVERTEX t_vert[] = { {5, 0, -5, 0xffffffff, 1, 0,}, {-5, 0, -5, 0xffffffff, 0, 0,}, {5, 0, 5, 0xffffffff, 1, 1,}, {-5, 0, 5, 0xffffffff, 0, 1,}, }; // create a vertex buffer interface called t_buffer d3ddev->CreateVertexBuffer(4*sizeof(CUSTOMVERTEX), 0, CUSTOMFVF, D3DPOOL_MANAGED, &t_buffer, NULL); VOID* pVoid; // a void pointer // lock t_buffer and load the vertices into it t_buffer->Lock(0, 0, (void**)&pVoid, 0); memcpy(pVoid, t_vert, sizeof(t_vert)); t_buffer->Unlock(); return; } When I clicked on the error It didnt take me to the line it thought was causing the problem which is a shame , will take some getting used to but its good to know I nearly have them setup :) Wow actually no pointer error in software mode? could that mean its a driver issue as opposed to a code issue? Then again Ive most likely done something wrong with adding the defines? See that above code if you have time . EDIT:: haha what an idiot I was there , I went into DXdiag and directDraw was enabled, direct3d was not lol - I enabled direct3d and no pointer errors or nothing. Checking that thread you linked , I saw the guy going through various checks so I did the same :) Thanks very much! [Edited by - firefly28 on February 25, 2008 12:46:46 PM]
  11. Im having some trouble getting the DirectX9 Debug runtimes working. I get the following error when running code from a directx tutorial: Lesson2.exe': Loaded 'C:\Documents and Settings\daveyw\My Documents\Visual Studio 2005\Projects\Lesson1\debug\Lesson2.exe', Binary was not built with debug information. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\D3DX9d_36.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\d3d9d.dll', No symbols loaded. 'Lesson2.exe': Loaded 'C:\WINDOWS\system32\d3dx9d_33.dll', No symbols loaded. Direct3D9: :====> ENTER: DLLMAIN(00dbe6e0): Process Attach: 00000f64, tid=00000d5c Direct3D9: :====> EXIT: DLLMAIN(00dbe6e0): Process Attach: 00000f64 Direct3D9: (INFO) :Direct3D9 Debug Runtime selected. D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO Direct3D9: (WARN) :HW device not available. GetAdapterCaps fails. D3DX: pDevice pointer is invalid First-chance exception at 0x0040127a in Lesson2.exe: 0xC0000005: Access violation reading location 0x00000000. Unhandled exception at 0x0040127a in Lesson2.exe: 0xC0000005: Access violation reading location 0x00000000. The program '[3940] Lesson2.exe: Native' has exited with code 0 (0x0). Also Im following a guide which talks about the debug runtimes at the following page but I cant find exactly where the "Enable unmanaged debugging" part is? Im using VS2005 express. DX DEBUG RUNTIMES Heres the a Link to the code Im using from a guide: Direct X Tutorial I can get the code working without the debug runtimes but I think it would be a bad idea to go any further until I get them setup and see where Im going wrong with them. Thanks :) [Edited by - firefly28 on February 25, 2008 12:09:10 PM]
  12. Just checking back - Im installing those debug runtimes right now. A week ago I was doing a guide where in parts of the code the guy uses a function to convert various numbers into degrees and I was getting confused when he used radians in another part of the code but Ive managed to get through all that and I just got a spinning 3d prism built so Im getting there :) Just before moving onto meshes Im messing about with the early lessons code and those debug runtimes would be handy now! Im glad I found this post again :) (Still waiting on my book though :( , it got sent from the US and there was some botch at customs![Someone could read the address? who knows hehe] Hopefully I will finally get the book soon)
  13. Scratch alot of what I was saying :) I think I see what your getting at now but I was altering the Y value of the camera position , thats what I was doing although at the time I may have submitted botched code where I had altered the camera look at point. What I essentially did was kept the lookat point the same so the camera stayed fixed on the same point and physically moved the camera down while it maintained the same lookat point. (Probably bad practice :) but was just to help understanding , I think I see what you are saying about rotation now ......so what does the unit increments on the lookat point represent , is it radians? Also the division you do that would give the current point of rotation each frame ? [is this correct] Im messing with actual camera panning now , so some of it is gradually making more sense. [Edited by - firefly28 on February 25, 2008 11:51:18 AM]
  14. I used to have dialup and steve is very correct. When I first got my PC I was on dialup a while and believe it or not I did numerous downloading on it. It actually took me 30days to get a file once so I feel for ya man. Also Ive had multiple files corrupted on dial up from downloading. If your on dialup and downloading do it when you have nothing else running and dont even do so much as browse pages when your downloading - do the downloads while you are asleep. Whats really annoying though is I used to be with AOL and they would cut me of every 30 mins and that was supposed to be on their unlimited package, I would phone them up going nuts and they would fix it then 2 weeks later it would be back to 30 min or 45min cutoffs. By this time I was sick of dialup and got boroadband, If/When you can afford it get broadband , even 512 broadband will do you and its very cheap now.
  15. Well still not sure if I have the correct idea here but I got it working as I wanted visually. I ditched the really badly done if condition in render frame and on the view cam Y axis did cview=cview+0.05f cview on the first iteration was 0.0f and +0.05f thereafter, the 0.05f figure was the Y axis rotation movement so since that run smoothly I used that for the view cam Y axis movement. I'm going to have to get to grips with doing calculations based on time and fps again. Being a newbie to game programming thats what stung me bad when I did my pong game (My first attempt at a game seriously) edit------- Although I got it working , Im not to happy with the menthod I used . I was did some searching on gamdev and came up with the following link that may be off some use to people experiancing animations running to fast or slow : Animations and Time Im still pleased that Im managing the exercises to some degree and I will try some of the methods discussed in the linked topic tommorow :) [Edited by - firefly28 on February 21, 2008 6:09:10 PM]