Jump to content
  • Advertisement

EGD Eric

Member
  • Content Count

    213
  • Joined

  • Last visited

Community Reputation

106 Neutral

About EGD Eric

  • Rank
    Member
  1. I'm trying to draw 2 rows of 4 quads, one on top of the other, using indexed triangle strips, but for some reason, it stops rendering at the 18th index, when there's supposed to be 23 indices in all. as you can see here. I'm starting from the bottom left, working my way right, then placing 2 extra indices on vertex 9, to create degenerate triangles, then moving up and working right to left and stopping on vertex 10 10---11---12---13---14 5----6----7----8----9 0----1----2----3----4 I'm trying to figure out why this could be, any ideas? Here's where I initialize the vertex and index buffers HRESULT InitGeometry() { USHORT *pIndex; // Create the vertex buffer. if( FAILED( g_pd3dDevice->CreateVertexBuffer( NUM_VERTICES * sizeof(Vertex), 0, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, D3DPOOL_DEFAULT, &g_pVB, NULL ) ) ) { return E_FAIL; } // Fill the vertex buffer. Vertex* pVertices; if( FAILED( g_pVB->Lock( 0, sizeof(Vertex) * NUM_VERTICES, (void**)&pVertices, 0 ) ) ) return E_FAIL; //4 squares on each row //bottom row *pVertices++ = Vertex(-10, -5, 0, RGB(0, 230, 0)); *pVertices++ = Vertex(-5, -5, 0, RGB(0, 230, 0)); *pVertices++ = Vertex(0, -5, 0, RGB(0, 230, 0)); *pVertices++ = Vertex(5, -5, 0, RGB(0, 230, 0)); *pVertices++ = Vertex(10, -5, 0, RGB(0, 230, 0)); //middle row for(int i=0; i < 5; i++) *pVertices++ = Vertex(-10 + (i * 5), 0, 0, RGB(0, 120, 200)); //top row for(int i=0; i < 5; i++) *pVertices++ = Vertex(-10 + (i * 5), 5, 0, RGB(0, 120, 200)); g_pVB->Unlock(); //create the index buffer if(FAILED(g_pd3dDevice->CreateIndexBuffer(sizeof(USHORT) * NUM_INDICES, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &g_pIB, NULL))) return E_FAIL; g_pIB->Lock(0, sizeof(USHORT) * NUM_INDICES, (void **)&pIndex, 0); //set indices *pIndex++ = 0; *pIndex++ = 5; *pIndex++ = 1; *pIndex++ = 6; *pIndex++ = 2; *pIndex++ = 7; *pIndex++ = 3; *pIndex++ = 8; *pIndex++ = 4; *pIndex++ = 9; *pIndex++ = 9; *pIndex++ = 9; *pIndex++ = 14; *pIndex++ = 8; *pIndex++ = 13; *pIndex++ = 7; *pIndex++ = 12; *pIndex++ = 6; *pIndex++ = 11; *pIndex++ = 5; *pIndex++ = 10; g_pIB->Unlock(); return S_OK; } and here's the rendering code VOID Render() { // Clear the backbuffer and the zbuffer g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 ); // Begin the scene if( SUCCEEDED( g_pd3dDevice->BeginScene() ) ) { // Setup the world, view, and projection matrices SetupMatrices(); // Render the vertex buffer contents g_pd3dDevice->SetStreamSource( 0, g_pVB, 0, sizeof(Vertex) ); g_pd3dDevice->SetFVF( FVF_CUSTOMVERTEX ); g_pd3dDevice->SetIndices(g_pIB); g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, 0, NUM_VERTICES, 0, 16); // End the scene g_pd3dDevice->EndScene(); } // Present the backbuffer contents to the display g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); } thanks in advance for anyone who can enlighten me on this subject.
  2. Yeah, I basically wanted to write my own driver. Do I need to know assembler for that? Or is there a language specific to drivers? C/C++ is what I know... From what I can tell, there's really 2 types of controllers: DirectInput controllers (like logitechs and all the other ones) & XBox controllers. XBox controllers use XInput. If my controller can act as a DirectInput controller, then all DirectInput code should work for that one, right? XInput code wouldn't work, but that's OK. Thanks for the responses, Does anyone know of any good books on writing drivers for game controllers?
  3. Spider-Man 3, Spider-Man: Friend or foe, to name 2. Any game that's a port of a console game will probably have it. There's plenty of PC game controllers with rumble, I assume they didn't equip them with motors for nothing. What is rumble code? Its like, when you're playing Spider-Man 3, and you jump off a building, land on the ground, you feel rumble. They must have had some code somewhere that said: when he lands, do a little vibration scaled to how hard he landed (how high he jumped from). pController->Rumble(magnitude) something like that. And it would be universal. DirectInput has functions you can call that will work on any game controller out there. There's no way these developers are writing code separately for each and every controller on the market. What I want to know is: How can I get my controller to respond to DirectInput rumble calls. I'd need to write that into its driver somehow, right? Of course, I should probably find out how to write a game controller's driver to begin with, so if anyone knows any good books on that, that'd be great, but I'm especially interested in the part about getting it to respond to DirectInput rumble. PS: I know C/C++, but no assembler.
  4. Say I were making a game controller, and I stuck a motor in it, and I wanted that controller to respond to any existing PC game's rumble code? Is this possible? I don't know anything about driver programming, so does anyone know of any good books or articles I can read about this - to help me get started - thanks!
  5. neat stuff, might come in handy. Question: What exactly is a "top level window"? how does that differ from any other window?
  6. OK, here's the problem: I've got a .dll, and the source code to said .dll. I don't have the source code to the main game, but the dll contains most of the game's logic, just none of the rendering code. I want to add some functions to this dll, but some of them require a handle to the window, and the application (a HWND & a HINSTANCE). I thought maybe some of you more knowledgeable (esp. with dlls) might have a clue as to how to get the window & application handles. PS, if anyone's wondering what I'm doing, I'm using the Quake 4 SDK. It comes with a project. You can modify the code to this project, and build a new dll, which the main game's exe supposedly calls functions from. Thanks in advance for any advice someone gives, even if its to tell me that this isn't possible!
  7. EGD Eric

    Quake 4 SDK: what's the source code for?

    thanks, that clears that up a bit. Another question: I need a copy of Quake 4 to use this, right? Dumb question, I know, but I have to ask & make sure.
  8. How does the Quake 4 SDK work? Is it for scripters/modders, or is it for programmers? both? I ask because I downloaded the Quake 4 SDK, and it comes with a visual studio solution file. I opened it, built it, only to find that the output file is a .dll, not a .exe. What is this dll for? Another question: with the scripting language for Quake 4, is it possible to call functions that are in a dll? Not the dll that was generated, but say: I made a .dll with some functions embedded in them, then called them from Quake 4's scripting language.
  9. I'm handling lost devices in our Direct3D game. I put a breakpoint just before I call device->reset and when I use call reset, I see this error : "The Pipe State is Invalid" in the watch window. (Just to clarify, if you enter the text: "$err, hr" in the watch window, you will see the last returned error code, and a formatted string for it: That's what I did) Anyways, I'm wondering what this error message could mean, and if it has anything to do with the fact that I can't see anything on the screen afterwards, or maybe its just a red-herring attributed to the fact that I was debugging. A couple of google searches haven't returned any relevant results. I'm using a Nvidia GeForce 7300 LE, and I have 2 monitors plugged in. One by a DVI cable, the other by a VGA cable. The application is running in the monitor with the VGA cable. Both my desktops are running at 1280x1024x32, but the game itself is running at 800x600x32. here's my code <code> // Release our ressources list ReleaseRessources(); _pD3DDevice->Reset(&mPresentParameters); //sort the list so that the surface resources are at the end,so they'll be restored AFTER the textures are re-initialized RestoreRessources(_pD3DDevice); gameAltTabbed = false; ASSERT( (_pD3DDevice->TestCooperativeLevel() == D3D_OK) && "The device was not reset sucessfully"); </code> here's a log of my messages. (I got these by: running the game, alt-tabbing, coming back in, then alt-tabbing again to exit the app) <code> FontManager: Warning, failed to find font 0x45650a46 Direct3D9: :WM_SYSKEYUP: wParam=00000009 lParam=a00f0001 Direct3D9: :Hot key pressed, switching away from app Direct3D9: :WM_ACTIVATEAPP: BEGIN Deactivating app pid=000019d0, tid=000019d4 Direct3D9: :DoneExclusiveMode Direct3D9: :INACTIVE: 000019d0: Restoring original mode (1280x1024x22x60) at adapter index 0 Direct3D9: :WM_DISPLAYCHANGE: 1280x1024x32 Direct3D9: :*** Active state changing Direct3D9: :WM_ACTIVATEAPP: DONE Deactivating app pid=000019d0, tid=000019d4 Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: :WM_SYSKEYUP: wParam=00000012 lParam=c0380001 Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: :WM_ACTIVATEAPP: BEGIN Deactivating app pid=000019d0, tid=000019d4 Direct3D9: :*** Already deactivated Direct3D9: :WM_ACTIVATEAPP: DONE Deactivating app pid=000019d0, tid=000019d4 Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: :WM_ACTIVATEAPP: Ignoring while minimized Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: :WM_SIZE hWnd=50085E wp=0000, lp=0224031A dwFlags=00000001 Direct3D9: :WM_SIZE: Window restored, sending WM_ACTIVATEAPP Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: :WM_ACTIVATEAPP: BEGIN Activating app pid=000019d0, tid=000019d4 Direct3D9: :*** Active state changing Direct3D9: :WM_ACTIVATEAPP: DONE Activating app pid=000019d0, tid=000019d4 Direct3D9: :StartExclusiveMode Direct3D9: :WM_DISPLAYCHANGE: 800x600x32 D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.58456e+029f. This is ok. Direct3D9: (WARN) :Vertexbuffer created with POOL_DEFAULT but WRITEONLY not set. Performance penalty could be severe. Direct3D9: (WARN) :Ignoring redundant SetRenderState - 15 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 16 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 17 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 18 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29 Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30 Direct3D9: (WARN) :Ignoring redundant SetRenderState - 19 Direct3D9: (WARN) :Ignoring redundant SetRenderState - 20 Direct3D9: :WM_SYSKEYUP: wParam=00000012 lParam=c0380001 Direct3D9: :WM_SYSKEYUP: wParam=00000012 lParam=c0380001 Direct3D9: :Window 0155009e is on top of us!! Direct3D9: :Window 0155009e is on top of us!! Direct3D9: :Window 0155009e is on top of us!! Direct3D9: :WM_ACTIVATEAPP: BEGIN Deactivating app pid=000019d0, tid=000019d4 Direct3D9: :DoneExclusiveMode Direct3D9: :INACTIVE: 000019d0: Restoring original mode (1280x1024x22x60) at adapter index 0 Direct3D9: :WM_DISPLAYCHANGE: 1280x1024x32 Direct3D9: :*** Active state changing Direct3D9: :WM_ACTIVATEAPP: DONE Deactivating app pid=000019d0, tid=000019d4 Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails The program '[6608] debug.exe: Native' has exited with code 0 (0x0). </code> Thanks in advance to anyone who might have an idea about this. [Edited by - EGD Eric on May 9, 2007 4:31:29 PM]
  10. woah! that's awesome! thanks!
  11. Thanks for the offer, that would be a really usefull script! yeah, at the beginnning of the file. I know SOME python, I may be able to cook something up if pointed in the right direction. I found something here, on the documentation for python: import fileinput for line in fileinput.input(): process(line) I don't know if that's related, but I got if from here: http://docs.python.org/lib/module-fileinput.html
  12. Anyone know a python script that would be useful for this? For a really, really large project, I'd like to be able to add a #include statement to each .cpp file inside of all the folders/subfolders. Any python wizards out there?
  13. EGD Eric

    can someone explain to me std::find?

    that's a good explanation guys, thanks!
  14. according to the STL pocket reference: Quote: Inp find(Inp first, Inp last, const T& value) finds the first occurence of value in the range [first, last] and returns an iterator that points to the value. if value is not found, last is returned I don't get this. Presumably you're looking in a container for the first thing between these two iterators. If you've got an iterator to the first, and an iterator to the last, then by calling find, aren't you looking for the FIRST value between those two? i.e.: either first itself or the second one. What's the point of this? Can't you just get the second object in the list yourself? Its just that whenever I see this code being used (so far) they always enter container.first() & container.end() into the first & last values. I really don't get the point, maybe someone can explain this to me?
  • 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!