Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

109 Neutral

About RedRabbit

  • Rank
  1. RedRabbit

    Perfect squares

    Hey all, I have a program due in one of my classes in 2 days and I have a problem. I understand what a perfect square is and how to check for it mathematically but how can you check to see if the result of a square in C++ is an integer value? Thanks for the help :)
  2. RedRabbit

    texturing in directx

    Quote: float l_angle = l_time * ( 0 * D3DX_PI) / 5000.0f; how does multiplying pi by 0 work? If you comment out the translation do you even get a rotating mesh? I haven't tried compiling this but doesn't that deduce to 0/5000? Therefore the "angle" you are trying to create is undefined or always the y-axis is it not? If so that is useless computation. EDIT: Quote was screwy.
  3. I recently bought "Introduction to 3D Game Programming with DirectX 9.0" by Frank D. Luna. While I'm not done with it I'm getting there and was wondering where I should look next in terms of reading material for more advanced/practical applications of what I know. Luna's books are excellent and I'm sad there isn't an "Advanced 3D Programming with DirectX 9.0" by him. Anway...is it better to go off and just use tutorials after his book or to read another book by someone else? I'm really looking forward to starting a virtual world project where I can implement advanced techniques in world I create but the terrain generation in Luna's book is...let's say...sub par. It just looks crappy. I'm also interested in learning more about animation and modeling as Luna really only shows how to load a .X file I'd like to learn how to load and use a .X file that can animate (ie: a walking person). Thanks for the help in advance.
  4. RedRabbit

    Where to start?

    Quote: [can't remember the last time i actually got use out of sin and cos functions in a practical game application, and thats all that trig is really as far as games are concerned.] Not to troll or anything, but I disagree with you here. Your advice on not needing to know trig for game programming is a little to specific an answer for such a generalized subject. In the 3D game programming world Trig could make or break a game. Whether it comes to a simple head/gun "bobbing" motion that follows a sine/cosine line or drafting an algorithm that constantly draws pixels in random positions but the amount is inversely proportional to the distance from the center of the screen giving a spreading effect for some particle system. Anyway...my point is you can do a lot with a little bit of knowledge of trig (or any other level of math) in GAME programming. It really depends on what type of program your making and how efficient/qualitative you want your results to be.
  5. Hey guys, I'm starting a small new team of developers and artists. I am by no means an expert with C/C++ or a graphics API but I can say I have a fair share of knowledge in both areas. I'm looking for semi-casual artists and coders to begin development on a fully functional FPS. This is designed entirely as a learning exercise and I plan on use DirectX because of it's functionality (and my familiarity with it). If anyone is interested drop a reply in my post or e-mail me at redrabbit109@yahoo.com (my gmail account is broken atm but I'll repost because that's my main e-mail). A website is in the works but I've halted my work on it as I would like team input as to how it will be setup. This team will be completely democratic...those with more experience, however, will naturally weigh in more often than others and will probably have more to say. I plan on using ventrilo (or teamspeak I have two available servers) as a means of communication between everybody. Again if you're interested please contact me and I anticipate initiating this project asap!
  6. has any1 been able to convert this matrix transofrmation tutorial (http://www.andypike.com/tutorials/DirectX8/005.asp) from DX8 to DX9? I realize its probably not that hard but EnumAdapterModes and GetAdapterModeCount don't make sense to me. I know they have changed from DX8 to DX9 but I've never used DX8 so I don't understand exactly how to use the new funcs. Much thanks.
  7. RedRabbit

    Errors with DX9

    ah, k... so turn my CheckDisplayMode func into like GetDisplayMode and have enumadaptermodes = dm.Format;? (btw thanks for help)
  8. RedRabbit

    Errors with DX9

    Yes I've read that plenty of times, though I'm not quite sure what to do with the information given. Does it mean that the new parameter eliminates the need to check which display mode is the right one? If so how do I use it correctly? If not...what exactly is it's purpose. Sorry that SDK explanation just doesn't cut it for me :/
  9. RedRabbit

    C/C++ graphics

    Heh asking what you need for C/C++ graphics is analogous to asking what youll need if your going on vacation. This topic is a heated debate between many factions; ranging from the 3D game gurus to the SDL learners, you'll get many different opinions here. You pretty much have a lot of freedom but read up on what you think you can tackle next before proceeding. For 3D graphics your best bet is OpenGL or DirectX just because of the shear amount of help you'll receive via forum discussion and tutorials. 3D may, though, be a little bumpy, especially if your new still to C++ itself. For starters, try some 2D games...you'll most likely get a lot of SDL fans that will reply to this. I believe the site is www.sdl-lib.org or something. It's a very comprehensive and EXTREMELY accessible/easy interface for noobs like you and I to learn the basic mechanics of 2D games. Like I mentioned earlier take your time. No matter which realm you go into: wanting to create a spinning cube or a pong clone, your going to have to sit down and learn a lot of material. You also will not be learning either of these in a day. Have a positive outlook because game/graphics programming can be really frustrating, but youll see the rewards are well worth your hard spent time. Good luck buddy! And when you do go into 3D...go DirectX!!!! ITS THE BEST!!! (Haha, jk...you'll be able to decide when you're ready to.)
  10. RedRabbit

    Errors with DX9

    Hi all, im trying to convert a tutorial from DX8 to DX9. So far I've done it all but 2 function parameters are still putting up a fight. Heres the code snippet that gives me the following errors: D3DFORMAT CGame::CheckDisplayMode(UINT nWidth, UINT nHeight, UINT nDepth) { UINT x; D3DDISPLAYMODE dm; for(x = 0; x < m_pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT); x++) { m_pD3D->EnumAdapterModes(D3DADAPTER_DEFAULT, x, &dm); if(dm.Width == nWidth) { if(dm.Height == nHeight) { if((dm.Format == D3DFMT_R5G6B5) || (dm.Format == D3DFMT_X1R5G5B5) || (dm.Format == D3DFMT_X4R4G4B4)) { if(nDepth == 16) { return dm.Format; } } else if((dm.Format == D3DFMT_R8G8B8) || (dm.Format == D3DFMT_X8R8G8B8)) { if(nDepth == 32) { return dm.Format; } } } } } return D3DFMT_UNKNOWN; } Quote: 'IDirect3D9::EnumAdapterModes' : function does not take 3 arguments 'IDirect3D9::GetAdapterModeCount' : function does not take 1 arguments I've read the documentation but I still dont understand what I should put in the extra Format parameter. Does anyone know of a fix? (or do I have to create a whole new way to check display modes with DX9?) thanks in advance!
  11. RedRabbit

    WNDCLASSEX prob...

    wow am I ever retarded....its been one of those days >.< thanks man
  12. RedRabbit

    WNDCLASSEX prob...

    WNDCLASSEX wc = (sizeof(WNDCLASSEX), CS_CLASSDC, WinProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, "Cubes Rotate", NULL); yields me the error: Quote: error C2440: 'initializing' : cannot convert from 'int' to 'WNDCLASSEX' any ideas? this is for a Direct3D compilation....this is my last error but I have no clue where to begin with it...thanks guys EDIT: To clarify: I know the problem lies in the argument "sizeof(WNDCLASSEX)"... but what should I use instead of this? I've used it before (at least I think I have). thanks again
  13. RedRabbit

    Noob problem (rendering)

    thank you so much for the help!! one quick question tho... Quote: a quick look at the SDK docs tells me the parameters are: Quote: HRESULT SetStreamSource( UINT StreamNumber, IDirect3DVertexBuffer9 * pStreamData, UINT OffsetInBytes, UINT Stride ); so your Stride is NULL, and the OffsetInBytes is the size of a single vertex - oops! Fixing that makes it stop crashing, but I still don't see anything on screen... what should this be changed to? thanks again for all the excellent advice I'll start reading the SDK more often now!
  14. Im trying to get write a simple directx program but I dont want to just use the source code from one tutorial so I'm trying to learn from different sources different aspects of my prog and put them together. So far I'm stuck at drawing to the screen. I believe all the code is here but for some reason it's not rendering. Please some1 help! #include <d3d9.h> #include <d3dx9.h> //////////////////////////////// //Macros #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE) //////////////////////////////// //Globals IDirect3D9* pD3D9 = NULL; IDirect3DDevice9* pD3DDevice9 = NULL; LPDIRECT3DVERTEXBUFFER9 m_vb; ///////////////////////////////// //Prototypes void Render(void); void DestroyD3D(void); LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); HRESULT InitDirect3D(HWND hwnd, int width, int height, bool fullscreen); HRESULT InitVertexBuffer(); //////////////////////////////// //Structs and Stuff struct CUSTOMVERTEX { float x,y,z; //pos float color; //color }; /////////////////////////////// //Win Entry Point int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX windowClass; // window class HWND hWND = NULL; // fill out the window class structure windowClass.cbSize = sizeof(WNDCLASSEX); windowClass.style = CS_HREDRAW | CS_VREDRAW; windowClass.lpfnWndProc = WindowProc; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.hInstance = hInstance; windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); windowClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); windowClass.lpszMenuName = NULL; windowClass.lpszClassName = "window"; windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO); // register the windows class if (!RegisterClassEx(&windowClass)) return 0; hWND = CreateWindowEx(NULL, "window", "Simple Direct3D Program", WS_POPUP | WS_VISIBLE, 0, 0, 400, 400, NULL, NULL, hInstance, NULL); // check if window creation failed (hWND would equal NULL) if (!hWND) return 0; if (FAILED(InitDirect3D(hWND, 800, 600, false))) { DestroyD3D(); return 0; } InitVertexBuffer(); MSG msg; while (1) { PeekMessage(&msg, hWND, NULL, NULL, PM_REMOVE); if (msg.message == WM_QUIT) break; else { TranslateMessage(&msg); DispatchMessage(&msg); Render(); } } DestroyD3D(); UnregisterClass("window", hInstance); return (msg.wParam); } //////////////////////////////////////// //Render void Render(void) { pD3DDevice9->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); pD3DDevice9->BeginScene(); // Rendering the triangle pD3DDevice9->SetStreamSource(0, m_vb, sizeof(CUSTOMVERTEX), NULL); pD3DDevice9->SetFVF(D3DFVF_CUSTOMVERTEX); pD3DDevice9->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1); pD3DDevice9->EndScene(); pD3DDevice9->Present(NULL, NULL, NULL, NULL); } ////////////////////////////////////// //Destroy void DestroyD3D(void) { if (m_vb) { m_vb->Release(); m_vb = NULL; } if (pD3DDevice9) { pD3DDevice9->Release(); pD3DDevice9 = NULL; } if (pD3D9) { pD3D9->Release(); pD3D9 = NULL; } } ///////////////////////////// //Window Procedure LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_CREATE: return 0; break; case WM_KEYDOWN: switch( wParam ) { case VK_ESCAPE: PostQuitMessage(0); return 0; } break; case WM_CLOSE: // windows is closing PostQuitMessage(0); return 0; break; case WM_DESTROY: PostQuitMessage(0); return 0; break; default: break; } return (DefWindowProc(hwnd, message, wParam, lParam)); } /////////////////////////////// //D3D initialization HRESULT InitDirect3D(HWND hwnd, int width, int height, bool fullscreen) { pD3D9 = Direct3DCreate9(D3D_SDK_VERSION); if (pD3D9 == NULL) return E_FAIL; // get the display mode D3DDISPLAYMODE d3ddm; pD3D9->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); // set the presentation parameters D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.BackBufferWidth = width; d3dpp.BackBufferHeight = height; d3dpp.BackBufferCount = 1; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = fullscreen; d3dpp.EnableAutoDepthStencil = true; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // back in InitD3D if (FAILED(pD3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pD3DDevice9))) { return E_FAIL; } //InitVertexBuffer(); return S_OK; } HRESULT InitVertexBuffer() { VOID* pVerts; CUSTOMVERTEX cvVertices[] = { { 300.0f, 400.0f, 0.5f, D3DCOLOR_XRGB(255,0,0),}, { 400.0f, 200.0f, 0.5f, D3DCOLOR_XRGB(255,0,0),}, { 200.0f, 200.0f, 0.5f, D3DCOLOR_XRGB(255,0,0),}, }; if(FAILED(pD3DDevice9->CreateVertexBuffer(3*sizeof(CUSTOMVERTEX),0,D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &m_vb, NULL))) { return E_FAIL; } if(FAILED(m_vb->Lock(0, sizeof(cvVertices),&pVerts, 0))) { return E_FAIL; } memcpy(pVerts, cvVertices, sizeof(cvVertices)); m_vb->Unlock(); return S_OK; } EDIT: FYI the program opens as I want it to and I get no errors it simply wont render. Hope this helps.
  • 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!