Author |
Topic: DirectX9 tutorials for BB4W (Read 1088 times) |
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #20 on: Jul 28th, 2015, 4:03pm » |
|
Hi Richard,
List: yes, obviously the order is important - but both lists I found on MSDN gave them in alphabetical order, so I assumed that must be the vTable order, since I couldn't find a separate mention of the latter, which probably reflects my lack of familiarity with MSDN... That would explain it if they are different. If they are different, then your header (or at least a pointer to the vTable list) will DEFINITELY be useful!
124/4: OK, sloppily expressed! I meant I expected the gap to be 80 x 4, or maybe 80 x 2, since it was 80 places later in the alphabetical list. Of course, if the list isn't alphabetical, it could easily occur 31 places later... 
[defeatist] Maybe. Realist? 
Exciting 3D applications? Well, at least I enjoy playing with it - and actually, it's not all that hard when I concentrate...
Best wishes,
D
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #21 on: Jul 28th, 2015, 7:36pm » |
|
Hullo all,
I haven't read the topic in its entirety but I still get notified to updates to the thread. I will dig out these old files and see if they are of any use. Of note, the helper file contain a mass of structure definitions etc for DirectX9 so code like
Code:
SYS!(!pDevice%+228), pDevice%, 29, 1 : REM Enable specular
can be avoided completely. There is a lot of helpful stuff within the library which makes it a lot simpler to get a program up and running.
Can you give me a bit of time and I will see what I turn up. I will try and test them to see if they work in v6.00. I expect they will *but* will a structure variant now be a different size? I assume so, but I can't even remember if I used any or not. It has been a long time.
Give me a few days and I'll see what I have got left over.
Michael
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #22 on: Jul 28th, 2015, 9:10pm » |
|
I've dug around and found this - I'll have to use two separate posts...
Code:
REM *******************************************************************
REM
REM Introduction :
REM
REM *******************************************************************
REM
REM These tutorials are based on http://www.directxtutorial.com/ which
REM is an excellent site to learn about DirectX programming. These are
REM very in depth tutorials and I won't repeat what is said there,
REM rather I will show you the 'minimal' BB4W program which will
REM achieve the same effect as the tutorial. You can then go on to
REM modify them at your hearts desire!
REM
REM We will use DirectX9. Why? Well, DirectX8 is now officially
REM 'unsupported' although DirectX9 and 10 still maintain backward
REM compatibility. There is no BB4W library for DirectX9 and so it will
REM be useful to learn to create the functions we need from the ground
REM up. You will find that a lot of your programs are based around
REM the same shell.
REM
REM DirectX uses COM (Component Object Model), if you are not familiar
REM with COM then a quick read of :
REM
REM http://bb4w.wikispaces.com/Component+Object+Model+programming
REM
REM which will help with the basics. I will not try to explain it here.
REM
REM I have decided to use structures to call the different methods in
REM each interface see :
REM
REM http://bb4w.wikispaces.com/Calling+object+methods+using+structures
REM
REM Although it can seem tedious to type out the structures first time,
REM it does lead to more readable code than the more obfuscating
REM indirection method. This is especially useful when you come back to
REM the code after a long time.
REM
REM For instance reading :
REM
REM SYS IDirect3DDevice9.BeginScene%, IDirect3DDevice9%
REM
REM is a lot easier to reference than
REM
REM SYS !(!D%+164), D%
REM
REM There are some caveats to using structures. The first is that the
REM original memory allocated for the structure is wasted but this is
REM not really a big problem. Second, we have to use a tricky line of
REM code to redirect the structure to point to the interfaces despatch
REM table (we *must* remember to do this!) and third we could argue
REM that they are slightly slower to call than using indirection. All
REM in all, I think it is worthwhile doing for the readability of the
REM code.
REM
REM The only other thing to mention is the FNf() function. DirectX uses
REM 4 byte floating point values rather than BB4W's 5 or 8 byte float
REM (*FLOAT 40 and *FLOAT 64 respectively). Whenever you see a value
REM such as 1.0f or 0.5f mentioned in the tutorials we need to use
REM FNf(1.0) or FNf(0.5) instead, otherwise we will get some very funny
REM results. See :
REM
REM http://bb4w.wikispaces.com/Passing+floating-point+values+to+DLLs
REM
REM For further information.
REM *******************************************************************
REM
REM Programming DirectX9
REM Lesson 1
REM
REM *******************************************************************
REM Remember, this lesson shows you a lot of code which will later
REM be moved into a library. You could skip to lesson three which
REM shows you exactly the same program but with all the reusable
REM code put in a library.
REM Well, we should choose a screen mode.
REM MODE 8 is a good start. 640 x 512 pixels.
REM we'll also turn the cursor off.
REM Notice initialisation of the window is done for you by BB4W!
MODE 8
OFF
REM We should always make sure that we have a cleanup procedure.
REM This enables us to free up all the resources we create with DirectX
REM Remember, any object 'created' by you will stay there until you
REM free it. To prevent all your memory eventually being used up you
REM must free it.
ON ERROR PROC_Error : PROC_Cleanup : END
ON CLOSE PROC_Cleanup : QUIT
REM First we need to load in the D3D9.DLL. This 'Dynamic Linked
REM Library' contains all the goods to use DirectX. If you haven't,
REM install the latest DirectX SDK it would be a good reference
REM Otherwise, make sure you have DirectX9 installed.
SYS "LoadLibrary", "D3D9.DLL" TO D3D9DLL%
REM It is good practice to check the result of any Windows API call we
REM make just in case things rely on them later, but we won't always
REM do this.
IF D3D9DLL% = FALSE THEN
m$ = "Failed to load D3D9.DLL. " +CHR$13
m$+= "Please ensure you have DirectX9 installed."
ERROR 100, m$
ENDIF
REM The first function we need is 'Direct3DCreate9' so we will query
REM our dll loaded into memory and get its address.
SYS"GetProcAddress", D3D9DLL%, "Direct3DCreate9" TO Direct3DCreate9%
REM Again, check to see if we have found the address
IF Direct3DCreate9% = FALSE THEN
ERROR 100, "Could not locate Direct3DCreate9 function."
ENDIF
REM Now we will 'create' the DirectX9 'device'. This is an 'object'
REM which contains 'interfaces' and/or 'methods'. We can call these
REM methods to control DirectX.
REM
REM At first we will define constants etc as we need them, but later
REM we can move all definitions to a separate initialisation routine,
REM and later still, to a separate library.
REM First get the Direct3D9 interface pointer :
D3D_SDK_VERSION = 32 : REM DirectX 9c
SYS Direct3DCreate9%, D3D_SDK_VERSION TO IDirect3D9%
IF IDirect3D9% = FALSE THEN
ERROR 100, "Failed to Create Direct3D9 interface."
ENDIF
REM Now we need to define our first interface. We do this by defining
REM the following structure and then redirecting it to point to the
REM interface's methods.
DIM IDirect3D9{ \
\QueryInterface%, \
\AddRef%, \
\Release%, \
\RegisterSoftwareDevice%, \
\GetAdapterCount%, \
\GetAdapterIdentifier%, \
\GetAdapterModeCount%, \
\EnumAdapterModes%, \
\GetAdapterDisplayMode%, \
\CheckDeviceType%, \
\CheckDeviceFormat%, \
\CheckDeviceMultiSampleType%, \
\CheckDepthStencilMatch%, \
\CheckDeviceFormatConversion%, \
\GetDeviceCaps%, \
\GetAdapterMonitor%, \
\CreateDevice% }
REM We have created the structure, but unfortunately if we were to call
REM any of the methods with it we would fail dramatically. With the
REM next line we redirect our structure to point to the IDirect3D9
REM despatch table.
!(^IDirect3D9{}+4) = !IDirect3D9%
REM Sorry about that, but it is essential we do this if we want to use
REM structure members as methods/functions!
REM Next we define the PRESENT_PARAMETERS{} which we need to 'create
REM the device' and set some of its members.
DIM D3DPRESENT_PARAMETERS{ \
\BackBufferWidth%, \
\BackBufferHeight%, \
\BackBufferFormat%, \
\BackBufferCount%, \
\MultiSampleType%, \
\MultiSampleQuality%, \
\SwapEffect%, \
\hDeviceWindow%, \
\Windowed%, \
\EnableAutoDepthStencil%, \
\AutoDepthStencilFormat%, \
\Flags%, \
\FullScreen_RefreshRateInHz%, \
\PresentationInterval% }
REM Define some constants
REM Take note this is NOT BB4W's TRUE which is -1!
_TRUE = 1
D3DSWAPEFFECT_DISCARD = 1
REM Set some D3DPRESENT_PARAMETERS{} members
D3DPRESENT_PARAMETERS.Windowed% = _TRUE
D3DPRESENT_PARAMETERS.SwapEffect% = D3DSWAPEFFECT_DISCARD
D3DPRESENT_PARAMETERS.hDeviceWindow% = @hwnd%
REM And now we Create the Device
D3DADAPTER_DEFAULT = 0
D3DDEVTYPE_HAL = 1
D3DCREATE_SOFTWARE_VERTEXPROCESSING = &20
SYS IDirect3D9.CreateDevice%, IDirect3D9%, D3DADAPTER_DEFAULT, \
\ D3DDEVTYPE_HAL, @hwnd%, D3DCREATE_SOFTWARE_VERTEXPROCESSING, \
\ D3DPRESENT_PARAMETERS{}, ^IDirect3DDevice9% TO R%
IF R%<>0 OR IDirect3DDevice9% = FALSE THEN
ERROR 100, "Failed to Create IDirect3DDevice9."
ENDIF
REM Notice the ^ (address of) symbol with ^IDirect3DDevice9%. We will
REM come across this a lot when we want to receive a value back from
REM the SYS call which is not returned in the result.
REM A note of the SYS call format:
REM You may have noticed the slightly different SYS call format when
REM calling an method via an object's interface compared to a simple
REM Windows API function. You must put the interface pointer as the
REM second parameter ie after calling the method :
REM
REM SYS IDirect3D9.CreateDevice%
REM
REM We add the interface pointer
REM
REM SYS IDirect3D9.CreateDevice%, IDirect3D9%
REM
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #23 on: Jul 28th, 2015, 9:11pm » |
|
Add this to the first bit...
Code:
REM and then the parameters we are passing. See the call we made above.
REM In fact this Device is an Interface, and so if we want we can
REM define another structure and redirect it to this Interface's
REM despatch table.
DIM IDirect3DDevice9{ \
\QueryInterface%, \
\AddRef%, \
\Release%, \
\TestCooperativeLevel%, \
\GetAvailableTextureMem%, \
\EvictManagedResources%, \
\GetDirect3D%, \
\GetDeviceCaps%, \
\GetDisplayMode%, \
\GetCreationParameters%, \
\SetCursorProperties%, \
\SetCursorPosition%, \
\ShowCursor%, \
\CreateAdditionalSwapChain%, \
\GetSwapChain%, \
\GetNumberOfSwapChains%, \
\Reset%, \
\Present%, \
\GetBackBuffer%, \
\GetRasterStatus%, \
\SetDialogBoxMode%, \
\SetGammaRamp%, \
\GetGammaRamp%, \
\CreateTexture%, \
\CreateVolumeTexture%, \
\CreateCubeTexture%, \
\CreateVertexBuffer%, \
\CreateIndexBuffer%, \
\CreateRenderTarget%, \
\CreateDepthStencilSurface%, \
\UpdateSurface%, \
\UpdateTexture%, \
\GetRenderTargetData%, \
\GetFrontBufferData%, \
\StretchRect%, \
\ColorFill%, \
\CreateOffscreenPlainSurface%, \
\SetRenderTarget%, \
\GetRenderTarget%, \
\SetDepthStencilSurface%, \
\GetDepthStencilSurface%, \
\BeginScene%, \
\EndScene%, \
\Clear%, \
\SetTransform%, \
\GetTransform%, \
\MultiplyTransform%, \
\SetViewport%, \
\GetViewport%, \
\SetMaterial%, \
\GetMaterial%, \
\SetLight%, \
\GetLight%, \
\LightEnable%, \
\GetLightEnable%, \
\SetClipPlane%, \
\GetClipPlane%, \
\SetRenderState%, \
\GetRenderState%, \
\CreateStateBlock%, \
\BeginStateBlock%, \
\EndStateBlock%, \
\SetClipStatus%, \
\GetClipStatus%, \
\GetTexture%, \
\SetTexture%, \
\GetTextureStageState%, \
\SetTextureStageState%, \
\GetSamplerState%, \
\SetSamplerState%, \
\ValidateDevice%, \
\SetPaletteEntries%, \
\GetPaletteEntries%, \
\SetCurrentTexturePalette%, \
\GetCurrentTexturePalette%, \
\SetScissorRect%, \
\GetScissorRect%, \
\SetSoftwareVertexProcessing%, \
\GetSoftwareVertexProcessing%, \
\SetNPatchMode%, \
\GetNPatchMode%, \
\DrawPrimitive%, \
\DrawIndexedPrimitive%, \
\DrawPrimitiveUP%, \
\DrawIndexedPrimitiveUP%, \
\ProcessVertices%, \
\CreateVertexDeclaration%, \
\SetVertexDeclaration%, \
\GetVertexDeclaration%, \
\SetFVF%, \
\GetFVF%, \
\CreateVertexShader%, \
\SetVertexShader%, \
\GetVertexShader%, \
\SetVertexShaderConstantF%, \
\GetVertexShaderConstantF%, \
\SetVertexShaderConstantI%, \
\GetVertexShaderConstantI%, \
\SetVertexShaderConstantB%, \
\GetVertexShaderConstantB%, \
\SetStreamSource%, \
\GetStreamSource%, \
\SetStreamSourceFreq%, \
\GetStreamSourceFreq%, \
\SetIndices%, \
\GetIndices%, \
\CreatePixelShader%, \
\SetPixelShader%, \
\GetPixelShader%, \
\SetPixelShaderConstantF%, \
\GetPixelShaderConstantF%, \
\SetPixelShaderConstantI%, \
\GetPixelShaderConstantI%, \
\SetPixelShaderConstantB%, \
\GetPixelShaderConstantB%, \
\DrawRectPatch%, \
\DrawTriPatch%, \
\DeletePatch%, \
\CreateQuery% }
REM Phew! We will put all this stuff in a library so we don't have to
REM type it out every time.
REM Now, remember to redirect our structure we just typed out to the
REM interface's despatch table.
!(^IDirect3DDevice9{}+4) = !IDirect3DDevice9%
REM Now we can do something with this device.
REM For this tutorial we shall just change the background colour by
REM cycling though some different RGB values 1000 times.
D3DCLEAR_TARGET = 1
FOR I%=1 TO 1000
R% = 128 + 127 * SIN(TIME/50)
G% = 128 + 127 * SIN(TIME/70)
B% = 128 + 127 * SIN(TIME/90)
REM Now we OR these values together to create an D3DCOLOR value
C% = &FF000000 OR (R%<<16) OR (G%<<8) OR B%
REM We could check the return values of these calls,
REM but we won't bother here because we are in a tight
REM loop and we want to get on with things. If we had
REM a problem we could check the return values to aid
REM our debugging process.
SYS IDirect3DDevice9.Clear%, IDirect3DDevice9%, 0, 0, \
\ D3DCLEAR_TARGET, C%, FNf(1.0), 0
SYS IDirect3DDevice9.BeginScene%, IDirect3DDevice9%
REM We will do lots of other things here!
SYS IDirect3DDevice9.EndScene%, IDirect3DDevice9%
SYS IDirect3DDevice9.Present%, IDirect3DDevice9%, 0,0,0,0
PRINT TAB(0,0)"Frame : "; I%, " Colour : ";~C%
NEXT
PRINT "Finished."
PROC_Cleanup
END
REM A cleanup routine.
DEF PROC_Cleanup
REM Release IDirect3DDevice9
IDirect3DDevice9% += 0 : IF IDirect3DDevice9% THEN
SYS IDirect3DDevice9.Release%, IDirect3DDevice9%
ENDIF
REM Release IDirect3D9
IDirect3D9% += 0 : IF IDirect3D9% THEN
SYS IDirect3D9.Release%, IDirect3D9%
ENDIF
REM Free the dll
D3D9DLL% += 0 : IF D3D9DLL% THEN SYS "FreeLibrary", D3D9DLL%
ENDPROC
DEF PROC_Error
SYS "MessageBox", @hwnd%, REPORT$, "Error : ", 0
ENDPROC
REM Convert to 32-bit float
DEF FNf(A#)
LOCAL A%,P%
PRIVATE F%
IF F%=0 THEN
DIM P%10
[OPT 2
.F%
mov esi,[ebp+2]:mov edi,[ebp+7]
fld qword [esi]:fstp dword [edi]
ret
]
ENDIF
A# *= 1.0#
CALL F%,A#,A%
=A%
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #24 on: Jul 28th, 2015, 9:13pm » |
|
....and it works in v6.00 trial!

Um, Richard, I need an ungrade.exe I am afraid... new computer again..
Michael
|
|
|
|
rtr2
Guest
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #25 on: Jul 28th, 2015, 9:34pm » |
|
on Jul 28th, 2015, 4:03pm, DDRM wrote:| If they are different, then your header (or at least a pointer to the vTable list) will DEFINITELY be useful! |
|
OK, here it is. I've checked a few methods chosen at random to see if they have the expected offsets, and they do - which is all good!
Code: DIM IDirect3DDevice9{QueryInterface%,AddRef%,Release%,TestCooperativeLevel%, \
\ GetAvailableTextureMem%,EvictManagedResources%,GetDirect3D%,GetDeviceCaps%, \
\ GetDisplayMode%,GetCreationParameters%,SetCursorProperties%,SetCursorPosition%, \
\ ShowCursor%,CreateAdditionalSwapChain%,GetSwapChain%,GetNumberOfSwapChains%, \
\ Reset%,Present%,GetBackBuffer%,GetRasterStatus%,SetDialogBoxMode%,SetGammaRamp%, \
\ GetGammaRamp%,CreateTexture%,CreateVolumeTexture%,CreateCubeTexture%,CreateVertexBuffer%, \
\ CreateIndexBuffer%,CreateRenderTarget%,CreateDepthStencilSurface%,UpdateSurface%, \
\ UpdateTexture%,GetRenderTargetData%,GetFrontBufferData%,StretchRect%,ColorFill%, \
\ CreateOffscreenPlainSurface%,SetRenderTarget%,GetRenderTarget%,SetDepthStencilSurface%, \
\ GetDepthStencilSurface%,BeginScene%,EndScene%,Clear%,SetTransform%,GetTransform%, \
\ MultiplyTransform%,SetViewport%,GetViewport%,SetMaterial%,GetMaterial%,SetLight%, \
\ GetLight%,LightEnable%,GetLightEnable%,SetClipPlane%,GetClipPlane%,SetRenderState%, \
\ GetRenderState%,CreateStateBlock%,BeginStateBlock%,EndStateBlock%,SetClipStatus%, \
\ GetClipStatus%,GetTexture%,SetTexture%,GetTextureStageState%,SetTextureStageState%, \
\ GetSamplerState%,SetSamplerState%,ValidateDevice%,SetPaletteEntries%,GetPaletteEntries%, \
\ SetCurrentTexturePalette%,GetCurrentTexturePalette%,SetScissorRect%,GetScissorRect%, \
\ SetSoftwareVertexProcessing%,GetSoftwareVertexProcessing%,SetNPatchMode%, \
\ GetNPatchMode%,DrawPrimitive%,DrawIndexedPrimitive%,DrawPrimitiveUP%,DrawIndexedPrimitiveUP%, \
\ ProcessVertices%,CreateVertexDeclaration%,SetVertexDeclaration%,GetVertexDeclaration%, \
\ SetFVF%,GetFVF%,CreateVertexShader%,SetVertexShader%,GetVertexShader%,SetVertexShaderConstantF%, \
\ GetVertexShaderConstantF%,SetVertexShaderConstantI%,GetVertexShaderConstantI%, \
\ SetVertexShaderConstantB%,GetVertexShaderConstantB%,SetStreamSource%,GetStreamSource%, \
\ SetStreamSourceFreq%,GetStreamSourceFreq%,SetIndices%,GetIndices%,CreatePixelShader%, \
\ SetPixelShader%,GetPixelShader%,SetPixelShaderConstantF%,GetPixelShaderConstantF%, \
\ SetPixelShaderConstantI%,GetPixelShaderConstantI%,SetPixelShaderConstantB%, \
\ GetPixelShaderConstantB%,DrawRectPatch%,DrawTriPatch%,DeletePatch%,CreateQuery%} If you don't want to clog up your memory with this declaration it's an ideal application for the CALL statement. Just add a RETURN as the last line of the file and then use:
Code: CALL @lib$+"IDirect3DDevice9" (or whatever name you have saved the file as).
Richard.
|
| « Last Edit: Jul 28th, 2015, 9:42pm by rtr2 » |
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #26 on: Jul 29th, 2015, 08:18am » |
|
^^ I've done all the hard work with all those declarations. They are in a library ready for use. I am presuming people would like them? I'll have to upload them.
Michael
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #27 on: Jul 29th, 2015, 10:02am » |
|
on Jul 29th, 2015, 08:18am, Michael Hutton wrote:| I've done all the hard work |
|
Hard work? I wrote a little program to scan D3D9.H and create the BB4W structure declarations automatically, so there theoretically shouldn't be any errors! I've uploaded the full file D3D9DECL.BBC to the Yahoo group here:
https://groups.yahoo.com/neo/groups/bb4w/files/Graphics/
It can also be downloaded from this direct link.
I wonder if it would be helpful to incorporate some other declarations, such as IID values and maybe constants. Any thoughts?
Richard.
|
|
Logged
|
|
|
|
Torro
New Member
member is offline


Posts: 25
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #28 on: Jul 29th, 2015, 11:52am » |
|
cool so this can be done for directx12?
|
| « Last Edit: Jul 29th, 2015, 11:53am by Torro » |
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #29 on: Jul 29th, 2015, 12:40pm » |
|
on Jul 29th, 2015, 11:52am, Torro wrote:| cool so this can be done for directx12? |
|
I haven't looked into it. Generally speaking I'm not very interested in technologies that work only on recent versions of Windows. Because BB4W runs fine on Windows XP (and earlier) - and indeed that's still what my main development PC has - I try to ensure that libraries do too. Also, the 'user demographic' probably suggests that the average BBC BASIC programmer doesn't own a Windows 8 PC!
But since BB4W can do (virtually) anything any other language can - if sometimes rather more slowly! - I assume that interfacing with DirectX 12 should be entirely possible.
Richard.
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #30 on: Jul 29th, 2015, 8:46pm » |
|
on Jul 29th, 2015, 10:02am, g4bau wrote:Hard work? I wrote a little program to scan D3D9.H and create the BB4W structure declarations automatically, so there theoretically shouldn't be any errors! I've uploaded the full file D3D9DECL.BBC to the Yahoo group here:
... snip ...
I wonder if it would be helpful to incorporate some other declarations, such as IID values and maybe constants. Any thoughts?
Richard.
|
|
"some hard work" - I note that you said it wouldn't be trivial a few posts ago. What has changed?
I think I did the same thing a few years ago. My definitions file has a lot of the constants defined. I think also there were some functions as well, so not so good for a CALL. I do have to install BB4W on this computer before I can update you with any more of what I did those years ago.
I'll try to update. Michael
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #31 on: Jul 29th, 2015, 8:50pm » |
|
on Jul 29th, 2015, 11:52am, Torro wrote:| cool so this can be done for directx12? |
|
Yes, it can. The caveat being that setting up DirectX10/11/12 is different from 9 and below. I only have a 'starter file', basically getting a device going but in theory it is vastly more powerful. What is a major difference is the use of HLSL or 'effect' '.fx' files to control the shaders which make access to DirectCompute and the higher level shaders easier. It is a bit of a stepping stone though and not lightly undertaken.
Michael
|
|
Logged
|
|
|
|
rtr2
Guest
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #32 on: Jul 29th, 2015, 9:45pm » |
|
on Jul 29th, 2015, 8:46pm, Michael Hutton wrote:| I think I did the same thing a few years ago. |
|
The thing is, we are trying to make a fresh start. What you did that long time ago was impressive in many ways, but your programs never worked on my (or several other people's) PCs because of their reliance on D3DX9, with all that entailed. Perhaps understandably - since the programs ran perfectly on your own machine - you never seemed particularly committed to resolving that issue.
As you are probably aware, the way the new D3D9LIB (and the original D3DLIB) are made independent of D3DX is by coding equivalent functions directly in BASIC (made easier and faster by using BB4W's array operators and arithmetic). Whilst that only provides 'simple' solutions for the maths functions in D3DX, it shows one way towards the ultimate goal of writing more complex 3D programs that will work on any modern PC.
So, from my perspective, I don't want to go back to where DirectX9 support in BB4W was when you jumped ship to PureBasic (and deleted all your Direct3D utilities and tutorials from Yahoo). I would rather start with D3D9LIB, which for the first time has made it possible to run simple Direct3D9 programs in BB4W on my own PC. Hopefully we can develop that approach further, perhaps with guidance from the 'Living without D3DX' blog site to which I linked.
Richard.
|
|
Logged
|
|
|
|
Michael Hutton
Developer
member is offline


Gender: 
Posts: 248
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #33 on: Jul 29th, 2015, 10:04pm » |
|
on Jul 29th, 2015, 9:45pm, g4bau wrote: - you never seemed particularly committed to resolving that issue. |
|
I'm really not going to reinvent the wheel by recoding DirectX9 or whatever for BB4W! There is a vast resource out there and all one needs to do is download DirectX9 or whatever version they want. I did add some functions which are missing from the dll which were defined in inline files but really, the idea of recoding DirectX9 to BB4W functions is rather ludicrous, even more so when there are multiple updates of DirectX by a team of professional coders!
If you manage to do it. Well done, but I'm not even going to bother. I have way too many other things to do. I have uploaded the tutorials I made. If they are there for people to look at and change at their will. Good luck with the 'fresh start'!
..and yes, I did delete the lessons when I 'jumped ship'(!) but I understand you had 'ran away' to Liberty Basic also... 'pot and kettle' I am afraid RTR.
Before casting stones..... oh, but it all starts again. 
Michael
|
|
|
|
rtr2
Guest
|
 |
Re: DirectX9 tutorials for BB4W
« Reply #34 on: Jul 29th, 2015, 11:06pm » |
|
on Jul 29th, 2015, 10:04pm, Michael Hutton wrote:| There is a vast resource out there and all one needs to do is download DirectX9 or whatever version they want. |
|
DirectX (8, 9 and typically later versions) comes pre-installed with all recent versions of Windows, it is not necessary to download anything. However the Direct3D extensions (D3DX), which are what are under discussion here, are neither pre-installed with Windows nor (legally at least - post D3DX8) downloadable from anywhere as a DLL.
The only legitimate way to make a D3DX DLL available to an end-user is to ship a massive Microsoft installer with your application, which makes no sense for a BB4W app.
Quote:| the idea of recoding DirectX9 to BB4W functions is rather ludicrous, even more so when there are multiple updates of DirectX by a team of professional coders! |
|
You are muddling DirectX with the Direct 3D Extensions (D3DX). It is perfectly sensible to consider alternatives to D3DX, indeed the blog page I linked to previously explains why D3DX is deprecated (scroll down to Background at the end of the article). The solutions may involve BASIC code (which contrary to your claim is perfectly reasonable for the maths functions at least), other DLLs or open-source tools.
Quote:| ..and yes, I did delete the lessons when I 'jumped ship'(!) but I understand you had 'ran away' to Liberty Basic also... 'pot and kettle' I am afraid RTR. |
|
At no point did my 'absence' from the BB4W scene result in any of the support materials being deleted. After all I continued to market BB4W throughout that period so was both morally and legally obliged to provide ongoing support.
Richard.
|
| « Last Edit: Jul 30th, 2015, 06:36am by rtr2 » |
Logged
|
|
|
|
|