Jump to content
  • Advertisement

DOrmisher

Member
  • Content Count

    95
  • Joined

  • Last visited

Community Reputation

100 Neutral

About DOrmisher

  • Rank
    Member
  1. I have attempted to create a stand alone release version of a demo I have made. It works fine on my own computer but I don't want to send it off when I am applying for jobs unless I am sure it will work on other machines. I was trying to get it running on a friends laptop and was getting a dx.dll error upon program load but this was solved by installing the latest dx runtime. I have included this in the rar file for the demo. As I don't have access to any other machines really than my own I was wondering if anybody would mind downloading my demo from the link below and trying it out on their machine. It's only 10Mb. http://www.mediafire.com/file/dmzlkwunzdi/Warpath Distributable.rar Another thing, I tried it on another friends machine, but when I tried to load it I got one of them Microsoft error crashes where it asks to send an error report. Could that happen because his graphics card doesn't support the pixel shader version I am using (3.0)? Thanks
  2. thanks a lot man il get on it
  3. I'm wondering how you make a stand alone install. I have built a game in visual studio/directx and I'm not sure how to do it. I know visual studio has some sort of installer framework is that the best way to do it? Also if a program is built in release will the exe work on a machine without the DirectX SDK installed? Pretty basic questions I know but if you don't ask you never know.
  4. Quote:Original post by DariusBoone This would probably explain why your window is see through. I can not say for sure, without seeing your code, why your Window is see through beyond that. Maybe you are not swapping buffers? Your question is kind of vague and your code structure is confusing - why do you set up two message loops? Yeh I guess I don't need two message loops, I think that is where all the problems are coming from. I'm confident with a bit of structure tinkering it will be fine. Thanks for the reply.
  5. Yeh I can see what you mean, it does actually make more sense that way. Probably where I'm going wrong. Thanks!
  6. I'm having a bit of trouble implementing a front end. I have an almost completed game so I would like to add a front end. I thought before I started building the front end properly Id make sure I could get something happenign in the the main game loop. The code for my main windows method is below: // Windows main function INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT ) { // Register the window class (adding our own icon to this window) WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle(NULL), NULL, LoadCursor( NULL, IDC_ARROW ), NULL, NULL, "Warpath", NULL }; RegisterClassEx( &wc ); // Create the application's window HWND hWnd = CreateWindow( "Warpath", "Warpath", WS_OVERLAPPEDWINDOW/*WS_EX_TOPMOST | WS_POPUP*/, 300, 100, 1000, 800, NULL, NULL, wc.hInstance, NULL ); // Load the game manager CGameManager::Create(); GameManager = CGameManager::GetInstance(); // Load the d3d manager CD3DManager::Create( false ); d3dManager = CD3DManager::GetInstance(); // Initialize Direct3D if ( d3dManager->D3DSetup( hWnd ) ) { //////////////////////////////////////////////////////////// // Front End Setup and Game Loop if ( GameManager->FrontEndSetup( d3dManager ) ) { // Show the window ShowWindow( hWnd, SW_SHOWDEFAULT ); UpdateWindow( hWnd ); //Reset the timer Timer.Reset(); // Enter the message loop MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( msg.message != WM_QUIT ) { float updateTime = Timer.GetLapTime(); if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { // Render and update the scene GameManager->FrontEndRender( d3dManager, updateTime ); GameManager->FrontEndUpdate( d3dManager, updateTime ); // If user hits escape exit game if (KeyHeld( Key_Escape )) { break; } } } } // Shut down/ free up memory used by game GameManager->FrontEndShutdown(); //////////////////////////////////////////////////////////// // Main Game Setup and Game Loop if ( GameManager->GameSetup( d3dManager ) ) { // Show the window ShowWindow( hWnd, SW_SHOWDEFAULT ); UpdateWindow( hWnd ); //Reset the timer Timer.Reset(); // Enter the message loop MSG msg2; ZeroMemory( &msg2, sizeof(msg2) ); while( msg2.message != WM_QUIT ) { float updateTime = Timer.GetLapTime(); if( PeekMessage( &msg2, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg2 ); DispatchMessage( &msg2 ); } else { // Render and update the scene GameManager->GameRender( d3dManager, updateTime ); GameManager->GameUpdate( d3dManager, updateTime ); // If user hits escape exit game if (KeyHeld( Key_Escape )) { DestroyWindow( hWnd ); } } } } // Shut down/ free up memory used by game GameManager->GameShutdown(); // Destroy the game manager CGameManager::Destroy(); CD3DManager::Destroy(); } UnregisterClass( "Warpath", wc.hInstance ); return 0; } What is happening is when the front end is being updated and rendered, the window is see through, then when I hit escape it breaks from the front end loop ok and enters the main game loop. It is staying in the main game loop fine but the window remains see through. If I comment the front end loop out the main section of the game works fine. Anyone point me in the right direction? Thanks in advance
  7. Hi, I'm currently trying to draw some point sprites but I seem to be having a problem. This is the relevant code: // Vertex format and particle structure struct SParticleVertex { D3DXVECTOR3 m_Position; enum FVF { FVF_Flags = D3DFVF_XYZ|D3DFVF_DIFFUSE }; }; struct SParticle { D3DXVECTOR3 m_Position; }; const int MAX_PARTICLES = 2; SParticle g_particles[MAX_PARTICLES]; LPDIRECT3DVERTEXBUFFER9 VertexBuffer = NULL; LPDIRECT3DTEXTURE9 smokeTex; // Vertex buffer creation and point sprite setup D3DXCreateTextureFromFile( d3dManager->m_d3dDevice, "Smoke1.tga", &smokeTex ); d3dManager->m_d3dDevice->CreateVertexBuffer( MAX_PARTICLES * sizeof(SParticleVertex), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY | D3DUSAGE_POINTS, SParticleVertex::FVF_Flags, D3DPOOL_DEFAULT, &VertexBuffer, NULL ); for( int i = 0; i < MAX_PARTICLES; ++i ) { g_particles.m_Position = D3DXVECTOR3(0.0f,i,0.0f); } d3dManager->m_d3dDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE ); d3dManager->m_d3dDevice->SetRenderState( D3DRS_POINTSCALEENABLE, TRUE ); // Render point list SParticleVertex *pPointVertices; VertexBuffer->Lock( 0, MAX_PARTICLES * sizeof(SParticleVertex), (void**)&pPointVertices, D3DLOCK_DISCARD ); for( int i = 0; i < MAX_PARTICLES; ++i ) { pPointVertices->m_Position = g_particles.m_Position; pPointVertices++; } VertexBuffer->Unlock(); CRenderMethod* method = Renderer->GetMethod( Texture ); d3dManager->m_d3dDevice->SetVertexShader( method->m_vs->m_Shader ); d3dManager->m_d3dDevice->SetPixelShader( method->m_ps->m_Shader ); d3dManager->m_d3dDevice->SetTexture( 0, smokeTex ); d3dManager->m_d3dDevice->SetStreamSource( 0, VertexBuffer, 0, sizeof(SParticleVertex) ); d3dManager->m_d3dDevice->SetFVF( SParticleVertex::FVF_Flags ); d3dManager->m_d3dDevice->DrawPrimitive( D3DPT_POINTLIST, 0, MAX_PARTICLES ); The point sprite isn't being rendered but 1 pixel directly in the middle of the screen is lit up so I assume something is happening. Can anyone spot where I am going wrong?
  8. I've been messing around with this for a bit but I don't seem to be getting correct results. I'm pretty sure this fuction should work now, but my results are wrong. x = 1.0 / ( sqrt( 2.0f * 3.14f ) * StandardDeviation ) * exp( -pow( Distance, 2.0f ) / ( 2.0f * pow( StandardDeviation, 2.0f ) ) ); I assume that the reason I am getting incorrect results is that I am misunderstanding what standard deviation and distance mean. I am treating standard deviation as the number of pixels I wish to blur, so if the standard deviation is 5 then 4 pixels to the right and the left will be blurred. By distance I am assuming the distance away from the current center pixel, so a distance of 1 means the pixel next to the current pixel. The results of this function and another I tried were the same, after running through a loop and using an iterator as the distance variable and a constant standard deviation size, the result just seemed to decrease very very little each time. I also tried converting it to texel size rather than pixel size but the numbers just decreased far less due to the smaller number. Any ideas?
  9. ok thanks a lot, you've been a great help. il get on it now.
  10. OK take a look at this see if you think this is correct (it's just that I don't usually do stuff like this). G(x) = ( 1 / ( sqrt( 2*pi*kernelSize ) ) ) * e*-( (Kernel*2)/( (2*KernelSize)*2)); Think that looks ok? Probably not right I'm not used to doing this :D
  11. Quote:Original post by leet bix ? I'm sorry, but I don't understand how you would plan on bluring with out pixel offsets and weights either side of the sampled tex coord. Maybe I don't understand what you are asking? What I'm trying to say is, if you have a kernel size of 1, then the blending factor of the centre pixel must be 0.75, and the kernels to the left and right must be 0.25. This is how we get the falling off of the blurring the further away the pixel goes, which is the whole concept of Gaussian blur. What I want to know is a formula to calculate the value that the colour of each texture coordinate must be multiplied by to get the correct total sum that is not above 1.0f. Morrandir I have looked at the Gassian function on the wiki page. I dont understand what the 'e' in the function refers to. G(x) = ( 1 / ( sqrt( 2*pi*kernelSize ) ) )*e???? I dont understand the last part of the function either, does this mean 'to the inverse power of...'?
  12. I have created a Gaussian blur post processing effect but it only works with a set kernel size and set kernel weights. I have been looking around the net for the last hour trying to find a nice easy coded algorithm for calculating blur weight for a kernel but the only the thing I have found is the actual Gaussian algorithm, which I haven't got a clue how to code. Anybody know a nice easy way? Or know any links to somewhere that can help? Thanks
  13. DOrmisher

    Bizzare shader error

    I just solved the problem by making it a float4 and adding a couple of 1.0f's in the constructor and it seems to work. Don't really understand why though...
  14. DOrmisher

    Bizzare shader error

    Ok thanks for the reply I understand. I just looked up tex2Dlod on msdn, and it states that the second input parameter, i.e. the UV coords, should be a float4. How can there be 4 part coordinate for a texture UV??
  15. Hi, something strange is happening that I don't understand. This is the code for my shader that does a guassian blur: void main( in PS_Input i, out PS_Output o ) { float4 TotalColour = 0; float texelSize = float( 1.0f / TexWidth ); TotalColour += tex2D( Tex0, float2( i.TexCoord0.x, i.TexCoord0.y ) ) * ( KernelSize+1.0f ) / (100.0f/KernelSize); int limit = KernelSize; // Loop as many times as there are kernels for( int p=1; p <= KernelSize; p++ ) { TotalColour += tex2D( Tex0, float2( i.TexCoord0.x - ( p*texelSize ), i.TexCoord0.y) ) * (KernelSize+1 -p) / (100.0f/KernelSize); TotalColour += tex2D( Tex0, float2( i.TexCoord0.x + ( p*texelSize ), i.TexCoord0.y) ) * (KernelSize+1 -p) / (100.0f/KernelSize); } o.Colour.rgba = TotalColour; o.Colour.a = 0.3f; } When I try to compile I am getting an error and subsequent warning: warning X3553: Can't use gradient instructions in loops with break, forcing loop to unroll error X3511: Unable to unroll loop, loop does not appear to terminate in a timely manner (1024 iterations) However, if I change the loop parameter to an integer rather than the KernelSize constant it runs and works perfectly. This is the code with that one change: void main( in PS_Input i, out PS_Output o ) { float4 TotalColour = 0; float texelSize = float( 1.0f / TexWidth ); TotalColour += tex2D( Tex0, float2( i.TexCoord0.x, i.TexCoord0.y ) ) * ( KernelSize+1.0f ) / (100.0f/KernelSize); int limit = KernelSize; // Loop as many times as there are kernels for( int p=1; p <= 5; p++ ) { TotalColour += tex2D( Tex0, float2( i.TexCoord0.x - ( p*texelSize ), i.TexCoord0.y) ) * (KernelSize+1 -p) / (100.0f/KernelSize); TotalColour += tex2D( Tex0, float2( i.TexCoord0.x + ( p*texelSize ), i.TexCoord0.y) ) * (KernelSize+1 -p) / (100.0f/KernelSize); } o.Colour.rgba = TotalColour; o.Colour.a = 0.3f; } That is the only thing that is stopping the shader from working correctly, and without that, I can't have any sort of flexibility with the shader. Anybody any ideas why this is happening?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!