Hi,
I am currently working on the d3d9 port of miniB3dExtended. The main part of the implementation is nearly finished for a while, but when testing the whole thing...the screen keeped black.
So, after hours of debugging I wrote a small hardcoded d3d9 sample, but it is the same -> nothing is be rendered!
The strange thing is, that exactly the same source works fine with vc8...
May be one of you knows what's wrong..
I am currently working on the d3d9 port of miniB3dExtended. The main part of the implementation is nearly finished for a while, but when testing the whole thing...the screen keeped black.
So, after hours of debugging I wrote a small hardcoded d3d9 sample, but it is the same -> nothing is be rendered!
The strange thing is, that exactly the same source works fine with vc8...
May be one of you knows what's wrong..
strict local win:tGAdget = createwindow("test",32,32,832,632) local hwnd:int = QueryGadget(win,QUERY_HWND) local d3d9Graphics:Direct3d = new Direct3d d3d9Graphics._Init(hwnd,800,600,false) local lpD3DDevice:IDirect3DDevice9 = d3d9Graphics.GetDevice() Type _TriangleVertices Field x1:Float = 320.0 Field y1:Float = 150.0 Field z1:Float = 0.0 Field r1:Float = 1.0 Field c1:Int = $FF0000FF Field x2:Float = 400.0 Field y2:Float = 330.0 Field z2:Float = 0.0 Field r2:Float = 1.0 Field c2:Int = $FFFF0000 Field x3:Float = 240.0 Field y3:Float = 330.0 Field z3:Float = 0.0 Field r3:Float = 1.0 Field c3:Int = $FF00FF00 End Type Local TriangleVertices:_TriangleVertices = New _TriangleVertices Local D3D_CUSTOMVERTEX:Int = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE) Local VertexBufferStart:Byte Ptr Local VB_Triangle:IDirect3DVertexBuffer9 = Null if lpD3DDevice.CreateVertexBuffer( 60,D3DUSAGE_WRITEONLY,D3D_CUSTOMVERTEX,D3DPOOL_MANAGED,VB_Triangle, Null) <> D3D_OK then notify "faild to create vb" end endif if VB_Triangle.Lock(0, 60, VertexBufferStart, 0) <> DD_OK then notify "cant lock vb" end end if MemCopy(VertexBufferStart, byte ptr ( TriangleVertices ), Sizeof(_TriangleVertices)) VB_Triangle.Unlock() lpD3DDevice.SetFVF(D3D_CUSTOMVERTEX) repeat 'waitevent d3d9Graphics.BeginScene() lpD3DDevice.SetStreamSource(0, VB_Triangle, 0, 60) ; lpD3DDevice.DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1) ; d3d9Graphics.EndScene() until KeyHit(Key_Escape) end type Direct3d field clsColor :int = $FF0000FF Field Direct3D9 :IDirect3D9 = null Field Direct3DDevice9 :IDirect3DDevice9 = null Field BackBuffer :IDirect3DSurface9 = null field PParams :D3DPRESENT_PARAMETERS = null field hwnd :int = 0 Method _Init(hwnd:int, w:Int, h:Int, bWindowed:Int = false) Self.hwnd = hwnd Direct3D9 = Direct3DCreate9( $900 ) if not Direct3D9 then notify "error creating d3d9interface!" end endif PParams = New D3DPRESENT_PARAMETERS PParams.SwapEffect = D3DSWAPEFFECT_DISCARD; PParams.hDeviceWindow = hwnd; PParams.Windowed = bWindowed; PParams.BackBufferWidth = w; PParams.BackBufferHeight = h; PParams.BackBufferFormat = D3DFMT_A8R8G8B8; local hr:int hr = Direct3D9.CreateDevice( 0 ,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,PParams,Direct3DDevice9) <> D3D_OK if hr then notify "error creating d3d9device!" end endif Direct3DDevice9.GetBackBuffer(0,0, D3DBACKBUFFER_TYPE_MONO, BackBuffer ); end method method SetClsColor(r:int,g:int,b:int) clsColor = Int(( 255 Shl 24)| (r Shl 16)| (g Shl 8)| b ) end method method BeginScene() Direct3DDevice9.Clear(0,null,D3DCLEAR_TARGET,clsColor,0,0); Direct3DDevice9.BeginScene(); end method method EndScene() Direct3DDevice9.EndScene(); Direct3DDevice9.Present(null,null,null,null); end method method GetDevice:IDirect3DDevice9() return Direct3DDevice9 end method method GetBackBuffer:IDirect3DSurface9() return BackBuffer end method end type