AntiAlias? There is a solution!

Blitz3D Forums/Blitz3D Programming/AntiAlias? There is a solution!

Play(Posted 2004) [#1]
As we know AntiAlias function doesn't work well in Blitz. Some of us get it work but some don't:
look http://www.blitzbasic.com/Community/posts.php?topic=36903

So, I came up with an idea that we can set AntiAlias in DirectX manually.

If we use Graphics3D function, Blitz creates 'IDirect3D8 interface' (personally I think that, it's IDirect3D7 or 9, but it does not matter

now) and then creates IDirect3DDevice8.

Hm, what about reseting D3DDevice with new parameter set? We cannot do that directly in BlitzBasic but there is no problem to do that in

c++. We have to make dll library which do that and then wrap it.

All we need is handle to IDirect3D8D and IDirect3DDevice8. Easy to say but worse to get.

First of all we have to call Graphics3D() to initialise engine (Blitz will create d3ddevice). Then, we have to get handle of the blitzwindow.

If we got it we can use GetIDirect3D8 and GetIDirect3DDevice8 (I don't know if these names of the d3dfunctions are correct). So we have got

three handles: to the blitzwindow (actually we need it only to get GetIDirect3D8), to IDirect3D and to IDirect3DDevice.

What next?

Let's make present parameter set which we'll use for reseting d3ddevice. Set like this below turns on antialiasing:

D3DPRESENT_PARAMETER d3dPP
ZeroMemory( &d3dPP, sizeof( d3dPP ) );
d3dPP.Windowed = FALSE
d3dPP.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dPP.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;

And there is one more thing to do:

Direct3DDevice8->Reset( D3DPRESENT_PARAMETERS* pPresentationParameters [d3dPP in my example]);

And that's all! I'm sure that will work!

I know it all may sound rather strange, so I give you a link where it's explained much better:

http://msdn.microsoft.com/archive/en-us/dx81_c/directx_cpp/Graphics/ProgrammersGuide/AdvancedTopics/Antialias/FullSceneAntialiasing.asp


Someone wanna try??? I would try it myself, if I had some spare time. I'm wondering if it is possible to turn on Anisotropic Filtering in

similar way.


If someone get antialias work, please let me know! :lopacki@...


Dreamora(Posted 2004) [#2]
If we had this handle, expanding the whole engine with stuff like DDS textures etc wouldn't be a large problem ...
But we don't have it and I don't think we will get it :(

I don't think that multisample etc existed back with DX7 as shader stuff was first implemented and supported in DX8


Klaas(Posted 2004) [#3]
cant find any command "GetIDirect3D8" there is only a "GetDirect3D8" wich needs a IDirect3D8 Handle.
So there is no way to get the IDirect3D8 handle with the handle of the Blitzwindow.

maybe the handle could be found somewhere in the memory(blitzhack) ... but thats a needle in a haystack