Dark Bit Factory & Gravity

GENERAL => Projects => Topic started by: TinDragon on August 03, 2009

Title: D3D9 test in bmax
Post by: TinDragon on August 03, 2009
Hi all, I have been having a go at using directx9 and more specific d3d9 in blitzmax, I converted a example from C/C++ I found on the net and after several failed attempts and some hunting around I finally got the same result as the c++ code gave me in VC++. What I really want to know is it the exe runs on other peoples systems, so if you wouldnt mind testing it, I would be grateful.

I am not to sure how much more I will be able to do but it's been an interesting experience so far and I think messing with the dx Vertex buffers has made me think about vertex arrays and VBO's in GL, something I havent done yet :)

Anyway a screenie and the exe.

Cheers
Jon
Title: Re: D3D9 test in bmax
Post by: zawran on August 03, 2009
On my computer with Vista it renders just like your image shows it. And if you look closely you will notice that the color gradient doesn't show completely fluently (most noticeable between the red and green). But on my computer with Windows7, it renders just perfect.
Title: Re: D3D9 test in bmax
Post by: TinDragon on August 03, 2009
I am not sure what you meant about the gradient, I am only setting the color for the corners and dx is doing the rest like in gl, perhaps it's due to it being in a window, it based it's colors of the desktop were as fullscreen i set it to 32bit. Or it could just be video drivers. Need a few more peoples responses to see if it's something I might need to look into. Mind I really need to work out a better way to get the window, atm I am making a standard bmax dx7 one then creating a d3d9 interface to it which might not be the best method  ;D
Title: Re: D3D9 test in bmax
Post by: Clyde on August 03, 2009
On XP works just fine, and looks as per your screenshot. And Ive latest DX.
Title: Re: D3D9 test in bmax
Post by: Shockwave on August 03, 2009
Works fine here too, I get a nice gourad triangle on a blue background just like your screenshot.
Title: Re: D3D9 test in bmax
Post by: zawran on August 03, 2009
In fullscreen it works fine on Vista, but if you look at your screen shot a little to the right of the center between red and green, it looks to me like the gradient doesn't change fluently, and its a bit the same between the red and blue, but its somewhat vague, but not there in full screen and not there on Windows7. Its probably not something that is worth spending too much time figuring out why its doing it, because it could well be something driver related, which you won't be able to fix anyways.

I must say that I think opengl seems much easier to work with than dx9, at least from just the quick look at the code I just had. I think you will find VBO in opengl fairly easy to get the hang of.
Title: Re: D3D9 test in bmax
Post by: Jim on August 03, 2009
Works fine here.
Jim
Title: Re: D3D9 test in bmax
Post by: zawran on August 03, 2009
Here is a screen shot of paint where I have magnified the area where the gradient doesn't match up quite right.

(http://zac-interactive.dk/temp/gradient_error.png)
Title: Re: D3D9 test in bmax
Post by: TinDragon on August 03, 2009
Thanks for testing, it's good to see it working, I must have got it fairly right :D

@zawran. Strange it looks fine to me windowed or fullscreen. I agree that opengl seems easier, biggest problem I had with this dx code is getting the vertex info from bmax to d3d, in C you can make a struct that takes the 4 floats for vertex and a dword for the color and you can make an array of that struct, I though you could do the same with a bmax type but it doesnt seem to store the info as one long chain in memory but pads it with bmx object info so it dont work right, had to just load it all into a bank since that was only method didnt look completely ugly  ::)

I should really look and see how there handling it in that module but it's probably not going to be easy to follow as it's tied into the whole bmax graphics driver system  ???
Title: Re: D3D9 test in bmax
Post by: va!n on August 03, 2009
works fine on Win7 x64... how to change to fullscreen mode?
Title: Re: D3D9 test in bmax
Post by: TinDragon on August 03, 2009
You cant change the one up the top to download to fullscreen, I sent zawran the code so he could compile it in fullscreen mode  ;)
Title: Re: D3D9 test in bmax
Post by: va!n on August 03, 2009
ah okay...
maybe you can add a simple API call at the beginning to select fullscreen / windowedmode...

Code: [Select]
Win32 API:

Result = MessageBox( 0, "Text", "Caption", MB_YESNO )

MB_YESNO = Run FullscreeN? Yes / No
MB_YESNOCANCEL = Run Fullscreen? Yes / No / Cancel

Some infos about this API can be found here: http://msdn.microsoft.com/en-us/library/ms645505%28VS.85%29.aspx (http://msdn.microsoft.com/en-us/library/ms645505%28VS.85%29.aspx)
Title: Re: D3D9 test in bmax
Post by: Rbz on August 04, 2009
Works fine here too.
Title: Re: D3D9 test in bmax
Post by: Shockwave on August 04, 2009
The gradient looks ok to me?!
Title: Re: D3D9 test in bmax
Post by: zawran on August 04, 2009
I have framed the areas where the gradient problem is and re-uploaded the image. Its there when I run the program on Vista in a window, not when run in full screen, and its not there when run in a window on Windows7. But I don't think its anything Jon needs to worry too much about since I am the only one seeing it.
Title: Re: D3D9 test in bmax
Post by: TinDragon on August 04, 2009
I got to be honest, I cant see anything in that image that looks wrong either  ???

As for making it an option for window/fullscreen, I can do that fairly easy but I will hold off doing another exe till i can atleast make it more interesting, even if its only getting it rotating :P
Title: Re: D3D9 test in bmax
Post by: va!n on August 04, 2009
@zawran:
i dont see any problems even with the updated gradient image... it looks totally okay here...
btw what should there be wrong? could you explain please?
do you have an TFT-Monitor? Possible their is/are small background lighhting problems with your TFT? Have you tried to move the screenshot window on your screen and are the problems still visible even when position the window to a new pos?
Title: Re: D3D9 test in bmax
Post by: Clyde on August 04, 2009
I think you may have quite a sharp monitor - maybe it's Hi Def, that you can notice what look like percularities which aren't.

I have zoomed in on that screenshot, and all that I can see is that it's using rectangles to draw the interpolated colours. In the highlighted areas, it looks the same as the rest of the pattern.
Title: Re: D3D9 test in bmax
Post by: Shockwave on August 04, 2009
It's totally unnoticeable here, even with the rectangles drawn on I can't see it sorry.

Seeing as it's probably using directx to draw the triangle I think it might be as clyde says, and something thats only visible on your monitor, or maybe you just have very good eyesight :)
Title: Re: D3D9 test in bmax
Post by: mind on August 14, 2009
yeah what everyone else says.. works just fine here.. i'd go as far as to say that the problem is on your end zawran..
Title: Re: D3D9 test in bmax
Post by: ferris on August 19, 2009
Works great :) Keep it comin!