Jump to content

  • Log In with Google      Sign In   
  • Create Account


JaMeZwHiTe

Member Since 28 Nov 2009
Offline Last Active Jun 15 2012 08:05 AM

Topics I've Started

Issues when rendering sprites using D3DX10_SPRITE

27 May 2012 - 12:48 PM

Hi all,

I have implemented 2D sprites using the D3DX10_SPRITE and ID3DX10Sprite method. The image renders correctly positioned, scaled, etc. The issue I am having is that the physical image is incorrect, see screenshot below:

Posted Image

The image should be the letter 'G' with a transparent background. At this stage, I am pointing the finger at the Alpha blending description (see bottom of device creation code).

Here is my code (pastebin) for creating the device along with my blend states plus more: http://pastebin.com/TBYrjG3x

Can anyone help me with this? You will get a virtual cookie Posted Image

Many thanks,

- Jamie.

2D Sprite Rendering

13 January 2010 - 11:31 AM

Hi all, I am developing a 2D sprite game for my university coursework using DirectX 10 and C++. I have spent a lot of time and late nights making this game and i just cannot get my head round rendering the sprites in a specific order. I mean every sprite in the class has their own Z axis value and the render class is called in order of when i want my sprites to appear but i just cannot figure out why they keep overlapping each other in different orders... The most irritating part is the background image appearing right at the front.... everytime i compile the render order is different every time.... Does anyone have any theories on this ? Jamie

Directx Text Problem

10 January 2010 - 12:38 AM

Hi all, I am trying to create a game for University Coursework and i am having some problems getting the text to work properly. I have created the text and have a render function which updates the text, my problem is it will not render properly. In other words, when the function is called, the text is rendered then disappears so quick you don't even see it. I tried calling the render function every loop round but then it only renders the text ignoring everything else and just the text is displayed but you can see the text "flashing" like its being rendered on top of itself thousands of times... I hope this makes some sort of sense? Here is my code: In the "Resources Function": l_hr=D3DX10CreateFont(g_pD3D,20,0,FW_BOLD,1,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,"Arial",&pFont); And here is the draw Function: void UpdateText() { RECT r = {400,300,0,0}; sprintf(t,"%d",Score); pFont->DrawText(NULL,t,-1,&r,DT_CALCRECT|DT_LEFT,D3DXCOLOR(1.0f,1.0f,1.0f,1.0f)); pFont->DrawText(NULL,t,-1,&r,DT_LEFT,D3DXCOLOR(1.0f,1.0f,1.0f,1.0f)); } I call the UpdateText() every time the text needs updating and you don't see it, and if i call it every loop round i have the text flashing issue. Does anyone have any idea? Much help is appreciated :-) Jamie.

Sprite Help

28 November 2009 - 04:40 AM

Hi all, i am new to this forum needing some help as my programming tutor is away from uni at the moment. I am creating a DirectX Game for my coursework with certain requirements and i need help with rendering my sprites.... My sprites render, and i have coded it to render the things i want in order although sometimes when i run the program the sprites render in different positions (i.e. the games crosshair the player uses to aim with renders above the bullet sprite so the bullet shot is not visible and vice versa). Is there a way to set the Z Position on each sprite to render in the order they should all the time ? Also, as my sprites are .pngs, is there a way to set the transparency correctly? i.e the crosshair is in a black square despite being a red cirlce shape. Many Thanks in advance JaMeZwHiTe

PARTNERS