• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Focusrite

  • Rank
  1. Hello Gamedev, I'm working on a 2d shadow system (by drawing to an alpha layer texture, which blends the world accordingly) and require a stencil test to make multiple light sources to work propperly. However, there's an issue with the stencil test when it passes through the shader, it still renders. The "algorithm" used is:[list=1] [*]Draw point light onto stencil. [*]Apply shadow (ie. remove the drawn light where it does not reach, behind walls etc) [*]Render the point light to the alpha layer where stencil allows (ie. where shadows haven't removed) [/list] The render, step 3, has to pass through the shader and isn't blocked by the stencil, and it's completely rendered onto the alpha layer, is there any way you can make the shader too be blocked by the stencil test? Regards Focusrite [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  2. DirectX polygons

    Ah sorry should mention that, yeah other types of rendering works, graphics renders rectangles, textures, lines etc without any issues at all, it's just this one giving me a headache. And no, afraid it's not the shaders as they're as of yet to be added to the project.. hm. I haven't heard of that PIX, what kind of tool is it? Google seemed not so helpful when searching for it.
  3. DirectX polygons

    Hey Gamedev! I need to render 2d polygons and thus came up with this solution: [code] if(FAILED(gd3dDevice->CreateVertexBuffer(sizeof(RectVertex) *32, D3DUSAGE_DYNAMIC, 0, D3DPOOL_DEFAULT, &mVB_Rect, NULL))) MessageBox(0, "Error creating RectVertex buffer", 0, 0); //Slightly misleading name, it's a vertexdefiniton containing just position and color //---------- void Graphics::drawPolygon(cPolygon* shape, D3DCOLOR color, bool filled) { if(shape->requireTriangulation()) shape->triangulate(); //Triangulates the polygon if not already done - stores in "shape->triangles" // Set vertex declaration and stream source gd3dDevice->SetVertexDeclaration(RectVertex::Decl); gd3dDevice->SetStreamSource(0, mVB_Rect, 0, sizeof(RectVertex)); // Lock and set the vertices position and texture coordinates RectVertex *vertices = 0; mVB_texture->Lock(0, 0, (void**)&vertices, 0); for(int i = 0; i<shape->getTriangles().size()/3; i++) { vertices[i*3+0].color = color; vertices[i*3+0].pos.x = shape->getTriangles()[i*3+0].x + shape->getPos().x; //Due to triangles beeing in local coordinates vertices[i*3+0].pos.y = shape->getTriangles()[i*3+0].y + shape->getPos().y; vertices[i*3+0].pos.z = 0.0f; vertices[i*3+1].color = color; vertices[i*3+1].pos.x = shape->getTriangles()[i*3+1].x + shape->getPos().x; vertices[i*3+1].pos.y = shape->getTriangles()[i*3+1].y + shape->getPos().y; vertices[i*3+1].pos.z = 0.0f; vertices[i*3+2].color = color; vertices[i*3+2].pos.x = shape->getTriangles()[i*3+2].x + shape->getPos().x; vertices[i*3+2].pos.y = shape->getTriangles()[i*3+2].y + shape->getPos().y; vertices[i*3+2].pos.z = 0.0f; } // Unlock the vertex buffer mVB_texture->Unlock(); if(filled) gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); else gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME); // Draw image gd3dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, shape->getTriangles().size()/3); } [/code] But it doesn't render at all! If i debug, it's ran, and the shape has the values it is supposed to have. I do not believe the triangulation is the issue, it was not originally written by me, and on debug it gives *very* plausable results. The (only slightly modded) triangulation technique here: [url="http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml"]http://www.flipcode....ngulation.shtml[/url] Anyone have any clue on why it does not work? Thanks in advance! - Focusrite
  4. Setup, DXTrace and other fun stuff

    It was a linking error all right. Bizarrely enough, selecting the same lib directory that was already set up (x86... on an x64 machine) once again did the trick. And it was the same, no typos Thanks for the help, finally can get to actually code on this machine!
  5. Setup, DXTrace and other fun stuff

    ~48h bump It's a friggin' strange error.. really hope someone here might have a clue on what to do
  6. Hey GameDev, as a first time poster I figured another of those pesky problems could be in order! I recently upgraded to windows 7/VC10 from my ol' buddy XP and getting directX was in order. Everything was installed and a test project was created (Frank Luna's "Hello World!" App), libraries/includes set up et al. (Libraries: d3d9.lib, d3dx9d.lib, dxguid.lib, DxErr.lib, dinput8.lib). Onwards to compiling were things doesn't exactly go very well - DXTrace is apparently an unresolved external! I've figured this is due to the character set used (Multi-byte) but changing this causes problems elsewhere in the project due to wrong the wrong character set. At some places things can be fixed with that _T macro (when using Unicode) but at some places I can't seem to sort it out without causing new problems and errors. Google was to little help, not many seems to have had this problem. Thanks in advance Focusrite [quote name="Error list"]Error 2 error LNK2019: unresolved external symbol _DXTraceA@20 referenced in function "public: virtual void __thiscall D3DApp::initDirect3D(void)" (?initDirect3D@D3DApp@@UAEXXZ) D:\Dokument\Viktor\VC\Projects\Nyctophobia\Nyctophobia\d3dApp.obj Error 4 error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: virtual void __thiscall D3DApp::initDirect3D(void)" (?initDirect3D@D3DApp@@UAEXXZ) D:\Dokument\Viktor\VC\Projects\Nyctophobia\Nyctophobia\d3dApp.obj Error 5 error LNK2019: unresolved external symbol _D3DXCreateFontIndirectA@12 referenced in function "public: __thiscall HelloD3DApp::HelloD3DApp(struct HINSTANCE__ *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,enum _D3DDEVTYPE,unsigned long)" (??0HelloD3DApp@@QAE@PAUHINSTANCE__@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4_D3DDEVTYPE@@K@Z) D:\Dokument\Viktor\VC\Projects\Nyctophobia\Nyctophobia\HelloDirect3D.obj Error 3 error LNK2001: unresolved external symbol _DXTraceA@20 D:\Dokument\Viktor\VC\Projects\Nyctophobia\Nyctophobia\HelloDirect3D.obj Error 6 error LNK1120: 3 unresolved externals D:\Dokument\Viktor\VC\Projects\Nyctophobia\Debug\Nyctophobia.exe [/quote] PS: It's DX9 btw, since the book by Luna is written for 9c (It's the "a shaders approach" edition). Why I really want to get this to work is because the whole book is based on this framwork! (The framework can be read here: [url="http://www.dreamincode.net/forums/topic/45066-introduction-to-directx-part-ii/"]http://www.dreaminco...irectx-part-ii/[/url]) DS Edit: Might be worth noting that I've had it up and running previously on XP/VC08.
  • Advertisement