D3D9Max2D driver inconsistencies/omissions?
Archives Forums/BlitzMax Bug Reports/D3D9Max2D driver inconsistencies/omissions?
| ||
Hi Mark, The DX9 Max2D driver is very much appreciated, so I hope you don't mind if I bring a couple of *tiny* omissions and inconsistencies with the other Max2D Drivers to your attention... 1) There's no TD3D9GraphicsDriver.Direct3DDevice9() and I couldn't see a way to easily retrieve the DX9Device. 2) There's no TD3D9Max2DDriver.ToString() defined. 3) Could TD3D9GraphicsDriver.GetDirect3D() be renamed to TD3D9GraphicsDriver.Direct3D9 for the sake of consistency with the D3D7Max2D Driver. I hope you can find your way to adding these in the near future. The TD3D9GraphicsDriver.Direct3DDevice9() is particularly useful, if not essential, for extending Max2D's capabilities. Cheers, |
| ||
How do you get the device? the method doesnt seem to work. |
| ||
Iain please use BlitzMax Module Tweaks " A private forum for sharing source code modifications to the official BRL modules ". |
| ||
Doh...Apologies, I wasn't thinking. :o/ The code isn't even necessary as it's a trivial amount (<10 lines) that's pretty obvious from the explanation above. Not really sure why I posted it in the first place, TBH. :o/ |
| ||
Hi, 1) There's no TD3D9GraphicsDriver.Direct3DDevice9() and I couldn't see a way to easily retrieve the DX9Device. The device is associated with the graphics object, not the graphics driver. 2) There's no TD3D9Max2DDriver.ToString() defined. Should there be? Will add one, but recommend you use GetGraphicsDriver() to test 'current' driver etc. 3) Could TD3D9GraphicsDriver.GetDirect3D() be renamed to TD3D9GraphicsDriver.Direct3D9 for the sake of consistency with the D3D7Max2D Driver. Nope - live with it! |
| ||
Hmmmmmm... is it just me or are the xyzuv#[24] replaced by _fverts[24]? Not sure if its related but the DrawImageArea function I use to draw my maps just went nuts. Actually,it was a reference to a null object which turns out to be a reference to missing code. I must have had the wrong compiler running. It uses the TD3D9ImageFrame to set the UV's through xyzuv# to draw a specific area of the screen. I want to add this functionality to the DX9 driver but I thought I should point it out here too! |
| ||
I noticed that too for my singlesurface mod. there's no SetUV method like there is for the dx7 driver. Easy enough to implement manually though, my draw method now looks like - Method Draw(x:Float, y:Float, width:Float, height:Float, frame:Int = 0) ?Win32 If TD3D7Max2DDriver(_max2dDriver) <> Null dxVer = 7 EndIf If TD3D9Max2DDriver(_max2dDriver) <> Null dxVer = 9 EndIf Select dxVer Case 7 DX7Frame = TD3D7ImageFrame (image.frame(0)) DX7Frame.setUV(u0[frame], v0[frame], u1[frame], v1[frame]) Case 9 DX9Frame = TD3D9ImageFrame (image.frame(0)) dx9frame._fverts[4] = u0[frame] dx9frame._fverts[5] = v0[frame] dx9frame._fverts[10] = u1[frame] dx9frame._fverts[11] = v0[frame] dx9frame._fverts[16] = u1[frame] dx9frame._fverts[17] = v1[frame] dx9frame._fverts[22] = u0[frame] dx9frame._fverts[23] = v1[frame] Default ? GLFrame = TGLImageFrame(image.frame(0)) GLFrame.u0 = u0[frame] GLFrame.u1 = u1[frame] GLFrame.v0 = v0[frame] GLFrame.v1 = v1[frame] ?Win32 End Select ? DrawImageRect(Self.Image, x, y, width, height) End Method Looks like I should use GetGraphicsDriver() as well now, to simplify more though :) |
| ||
Pete, does that actually work with the DX9 driver. I noticed that the TD3D9ImageFrame.Draw method now modifies the UV coordinates. In the DX7 and OGL drivers, the draw() method makes and uses a copy of the uv coordinates. This makes direct access to the UV coordinates fail. For my mod, I am having to override the Draw method to get it to use UV's different than 0,0 and 1,1. I am wondering if this change was done on purpose, because the way the D3D9 driver handles and draws it is different than the DX7 and OGL drivers. Edit: Actually, after looking at this a bit more, the routine does not modify the UV coords. It just doesn't make the call back to the driver from the TImageFrame, it does the work itself. I will have to look into this a bit more to see why my mod is not drawing correctly. But something is definitely different. Edit 2: I have found that my problem isn't a drawing problem. My bug is related to the GrabImage issue that Mark says he has fixed. |
| ||
The device is associated with the graphics object, not the graphics driver. I was just following your lead with the DX7 graphics module, TBH I don't care *where* it is, as long as I can get at it. ;o)I'm probably being a bit thick here as I've lost touch with BMax's internals over the last couple of years. How else do I retrieve the DX9 device? With the DX7 stuff, it was as easy as... d3d7device:IDirect3DDevice7 = D3D7GraphicsDriver().Direct3DDevice7() ...or... d3d7device:IDirect3DDevice7 = TD3D7Max2DDriver(_max2dDriver).deviceWhat's the equivalent for DX9? Should there be? Will add one, but recommend you use GetGraphicsDriver() to test 'current' driver etc. Thanks! Not really important, it's just nice to have a standardised string ID floating around. Nope - live with it! LOL...Yeah, kinda expected that. I'm a martyr to my own pedantry at times. ;o)Cheers, |
| ||
I was trying to figure that out too Yan, I cant seem to find a way to get the device, it was so simple in dx7 http://www.blitzbasic.com/Community/posts.php?topic=87901 |
| ||
Okay...It appears I was being a complete retard and overlooked TD3D9Graphics.GetDirect3DDevice(). :o/ Slightly more convoluted than the DX7 solution but perfectly usable. |