Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

161 Neutral

About rukiruki

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. rukiruki

    2D Coloured Lights

    Just tried this and I get a similar result to before SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); Thanks for the advice, I'll be going ahead with the shader route, thanks!
  2. rukiruki

    2D Coloured Lights

    Thank you for your reply L. Spiro I really appreciate your time.   I tried your suggested solution: SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); SetRenderState(D3DRS_DESTBLEND, D3DBLEND_DESTCOLOR); SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); And I got the following result I then tried all different combinations of texture stage settings for color/alpha whilst keeping those blending operations constant, but nothing looked any better that the above picture. I really can't get my head around this for some reason. Just to point something out which may be important, the original blue gradiant texture is blue on a transparant background, not a white background. Should I try blue on a white background? Edit Just tried the following SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);And I got this result: I also tried a blue graident on a white background for my source image but that just really didn't work so I'm back to a blue gradient on a transparent background Final Edit: I think I'm starting to give up on blending states for this, It'd be more practical to use a shader for this right? I think I could probably get the effect I want using some shader code... right? :|
  3. I want to add "coloured lights" to my game, and I want to do this by rendering an oval gradient of colour (blue for example) onto my current scene, and let blending states take care of it. Here is the gradient texture: When I do this in photoshop and set the blend mode to "Color", I get the desired effect, where all colour gets a blue tint and black remains black: However, when I do this in game, I can't achieve it no matter what render states I set. I get lot's of different things but the closest I got was this, which is wrong because the black turns blue, I want it to stay black!   That's with DirectX9 and SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); SetRenderState(D3DRS_DESTBLEND, D3DBLEND_DESTALPHA); I tried all combinations of render states... maybe.. Any help? :/
  4. Thanks hplus0603, I read that article last night annd it was a good read. Just a quick question- if you successfully do the NAT punch-through with UDP, can you then successfully connect with TCP without the need of using TCP NAt punch-through?
  5. I want to be able to create a game which lets users become the server, and their friends connect to it. I do not want to provide a permanent host myself, but i will do if this resolves the following issue: The problem I'm having is that it requires the host guy to forward/unblock their ports. This isn't very ideal since some people don't know how to do this. I suppose I could use a "public port"? such as 8080, but wont that affect other programs using that port? I'm using TCP/IP winsock 2 in c++ I know that some games get away without requiring port forwarding, how on earth do they do this? I have read the FAQ posted here and the only idea I could get from it was some sort of NAT punch through, but I'm not too sure what that is
  6. My rendering seems great and fine so far, except when I try to render a texture to a polygon (typically 4 vertices as a triangle list). The texture is a very simple colourful rectangle: [attachment=15788:001.png] The above image is saved inside a 1024x1024 texture, so the Power of 2 is not an issue. I render to a quad with an elongated bottom, and the centre of the texture get's a bit biased and wonky towards the left hand side, shown in the following image: [attachment=15789:result.jpg] I need the texture to be rendered evenly throughout the polygon, I need the following photoshopped picture as a result: [attachment=15790:desiredresult.jpg] I looked at PIX of the frame and the triangles are being rendered with the correct UV and vertices values [attachment=15791:pix.jpg] So I don't really know why it is skewing slightly to the left down the centre. Is it because of the triangle split down the diagonal of the polygon? Do I need to enable a blending method or something?
  7. rukiruki

    Combining alpha testing and blending

    Don't suppose setting these render states will help at all?  
  8. OH WOW. It was the rhw value. It's never set for any vertices. I set every vertex rhw value to 1.0 and now it's working in every build. Thank you so much Jason, if you didn't suggest PIX and comparing the two I never would have spotted this. I'm not sure how the reputation thing works but I tried to add some rep for you. Thanks again, I think it's fully solved now
  9. I ran the working build in PIX and grabbed two screenshots. https://dl.dropbox.com/u/15579799/dxscreens/working_pix1.jpg https://dl.dropbox.com/u/15579799/dxscreens/working_pix2.jpg   I'm not familiar with PIX but I can't really spot any differences between the builds. *edit* err, actually- on the working build, what on earth is that 4th position value (-4310602xxxx)? I grabbed my graphics card's latest drivers yesterday. it didn't work on my friends PC (ATI gfx card) but the error does not occur on my other friend's PC (nvidia). There is a possibility that im rendering the triangle list in the wrong order. I render a rectangle in this order: // 0 - bottom left // 1 - top left // 2 - top right   // 3 - bottom left // 4 - top right // 5 - bottom right I did have backface culling disabled // Disable backfaces d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); I switched to // Disable backfaces     d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); But noticed no difference. Thanks Jason for your help
  10. Jason, do you mean this? https://dl.dropbox.com/u/15579799/dxscreens/pix2.jpg It says post vertex shading disabled. I'm going to try a working version in PIX now
  11. Hi Jason, thanks for you reply. I'm loading textures from a DAT file, using my own error checking I can see that the DAT file IS found and textures are loaded from it. This is the function: https://dl.dropbox.com/u/15579799/dxscreens/loadtext.JPG   I have new information on this issue. I loaded up my newest engine which has some simple d3d render calls, again in 2D. It works from the IDE in debug mode, but NOT in release mode. The generated .exe from the debug mode WORKS, but the generated .exe from the release mode doesn't work. After some googling I found out it was the /MDd to /MD flag in Project Properties->c++->code generation, as outlined in this post: http://stackoverflow.com/questions/10526566/directx-release-build-works-through-vs2010-but-not-exe   On further reading it may be due to some directx things not being initialised in Release mode, where they are automatically initialised in debug mode, but I have no idea what that could be, even after cross referencing with a few directx tutorials~ I can't see anything I may have missed. Here are some pics of the current issue regarding debug and release mode: https://dl.dropbox.com/u/15579799/dxscreens/c1.jpg https://dl.dropbox.com/u/15579799/dxscreens/c2.jpg   The problems ONLY occur with textured triangle lists. The NULL textured triangle lists (such as the white rectangle in the background) are fine. In this engine, fonts are rendered using textured triangle lists. Thanks for suggesting PIX, I never used it before but it provided some cool information, but nothing that I could work out why the error was happening. If we isolate to the first rendered triangle list, the left 'panel' graphic, pix shows this as the current rendered image: https://dl.dropbox.com/u/15579799/dxscreens/pix1.jpg It shows the following location and UV coorindates, which I have checked match up with the screen dimensions and texture: https://dl.dropbox.com/u/15579799/dxscreens/pix2.jpg And this is the texture it is setting, showing correctly in PIX, which I assume means it loaded correctly: https://dl.dropbox.com/u/15579799/dxscreens/pix3.jpg So, I've learned a lot, but still no idea how on earth to fix this, I must be missing something... I can confirm that the release build in IDE DOES WORK if I set /MDd flag, and the generated .exe also WORKS with that flag set. When changed to /MD neither work.   Any tips? Have I missed a step in the frame calls?  
  12. rukiruki

    Bitmap font engine problem

    I'm glad you got it working! I'm confused as to why you're using  "letter_end - letter_start + 1" and "803 - 795 + 1 = 9", the +1 seems to be wrong to me. If start pixel is 795 and width is 9, you should be passing 795 and 795 + 9 (which is 804) into the UV equation. u1 = 795 / 1899 u2 = 804 / 1899   And hopefully you then dont have to bother with the 0.5 texel offsets, and it should be pixel perfect   But your way may be fine anyway, it's just the way I've gotten used to. Good luck :)
  13. rukiruki

    Bitmap font engine problem

    Can you post the formula you're using to calculate UV?     803 - 795 is not 9 pixels wide Here's mine i use to achieve pixel perfect precision float cRenderBuffer::convertUVDX( int pixelValIn ) { // Return return (float)( pixelValIn ) / (float)( currentTexture->baseDimension - 1 ); } so 795 should equate to 0.4186413902053712 and 804 should equate to 0.4233807266982622 What you posted seems to be placing a 8 pixel wide uv onto a 9 pixel wide quad, unless I misread!
  14. I'm using relative paths to the DAT folder, ie. "data\\datfile", the .exe does find it and load from that file correctly (along with sound effects which work). I've tried it in all possible folders   thanks
  15. Hi Seabolt, yes I have tried running the .exe in the Release folder (no assets get loaded, no fonts or textures). I have tried running it in an isolated folder with identical assets, and the main project folder which uses the exact same assets as the VS-ran build. I get the same behaviour all the time, the .exe never renders textures properly.   I do error check my texture loads, they are being found in the DAT buffer and loaded fine. I don't understand how it can be any different than running it in VS :/
  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!