Page 1 of 1

CallCom

Posted: Tue Sep 29, 2009 5:23 pm
by Motu
I was working on an old project to make it vista/windows7 ready. Everything ist working fine now, but there is an old piece of code that used CallCom to access purebasics internal directX library to change the renderstate. I was wondering if there is a way to make this work without having to install the acient CallCom lib on every new PB version. Maybe someone can help me there :-)

Code: Select all

#IDirect3DDevice7_SetRenderState              =  20 * 4
#D3DRENDERSTATE_CULLMODE = 22
#D3DCULL_NONE            = $1
#D3DCULL_CW              = $2
#D3DCULL_CCW             = $3
#D3DCULL_FORCE_DWORD     = $7FFFFFFF

Procedure GetD3Ddevice_interface()
  Shared D3Ddevice_interface
  ; Fill Interface variable
  !extrn _PB_Direct3D_Device
  !MOV dword EAX, [_PB_Direct3D_Device]
  !MOV dword [v_D3Ddevice_interface],EAX
EndProcedure

Procedure SetRenderState(a,b)
 Shared D3Ddevice_interface
 If D3Ddevice_interface = 0
  GetD3Ddevice_interface()
 EndIf
 CallCOM(#IDirect3DDevice7_SetRenderState  ,D3Ddevice_interface,a,b) ; Set Render-State
EndProcedure

Re: CallCom

Posted: Tue Sep 29, 2009 5:55 pm
by Motu
Okay, I found a solution myself by guessing, if somebody needs it:

Code: Select all

Procedure GetD3Ddevice_interface()
  Shared D3Ddevice_interface.IDirect3DDevice7
  ; Fill Interface variable
  !extrn _PB_Direct3D_Device
  !MOV dword EAX, [_PB_Direct3D_Device]
  !MOV dword [v_D3Ddevice_interface],EAX
EndProcedure

Procedure SetRenderState(a.l,b.l)
 Shared D3Ddevice_interface.IDirect3DDevice7
 If D3Ddevice_interface = 0
  GetD3Ddevice_interface()
 EndIf
 D3Ddevice_interface\SetRenderState(a,b)
; CallCOM(#IDirect3DDevice7_SetRenderState  ,D3Ddevice_interface,a,b) ; Set Render-State
EndProcedure

Anyway, if someone knows how to code a callcom in pb without using an external lib that knowlege would be usefull for me :-)