I tried to access the Direct3DDevice returned by SystemProperty to draw some graphics on the screen, just for fun :)
Here's the PureBasic code. It doesn't work. I get a 'Memory Access Violation' when I call the 'Render' function. The error occurs in the line where the DrawPrimitive function is called. I also tried other functions of IDirect3DDevice, but no one works. I'm just a beginner in PureBasic, so I hope you can help me.
Structure vertex
x.f
y.f
z.f
EndStructure
*device.IDirect3DDevice7
ProcedureDLL SetDevice( *dev.IDirect3DDevice7 )
device = dev
If Not device
ProcedureReturn( 0 )
EndIf
ProcedureReturn( 1 )
EndProcedure
ProcedureDLL Render( )
Shared *device
Dim verts.vertex( 3 )
verts( 0 )\x = -1
verts( 0 )\y = 1
verts( 0 )\z = 0
verts( 1 )\x = 1
verts( 1 )\y = 1
verts( 1 )\z = 0
verts( 2 )\x = 1
verts( 2 )\y = -1
verts( 2 )\z = 0
verts( 3 )\x = -1
verts( 3 )\y = -1
verts( 3 )\z = 0
*device\DrawPrimitive( 6, $002, verts, 4, 0 )
ProcedureReturn( 0 )
EndProcedure
|