Read on...
Why does this fail?
BlitzMax Forums/BlitzMax Programming/Why does this fail? OKay so can now make a Vertex buffer but I can't lock it.. ANyone got any ideas..
Lock Method
This is the c++ code, I've probably got it all wrong
Type D3DVERTEXBUFFERDESC Field dwSize Field dwNumVertices Field dwFVF Field dwCaps End Type Global pverts:Byte Ptr Global verts:Float[12] Global d3dVertexBuffer:IDirect3DVertexBuffer7 Global desc:D3DVERTEXBUFFERDESC = New D3DVERTEXBUFFERDESC desc.dwSize =SizeOf(desc) desc.dwNumVertices = 16*3 desc.dwFVF = D3DFVF_XYZRHW desc.dwCaps = 0 primarydevice.d3d.CreateVertexBuffer(desc,d3dVertexBuffer,Null) pVerts = verts verts[0]=50 verts[1]=200 verts[2]=0 verts[3]=150 verts[4]=50.0 verts[5]=0.0 verts[6]=0 verts[7]=1 verts[8]=250.0 verts[9]=200.0 verts[10]=0 verts[11]=1 d3dVertexBuffer.lock(DDLOCK_WAIT|DDLOCK_WRITEONLY|DDLOCK_NOOVERWRITE,Pverts,Null)' ********UNHANDLED MEMORY EXCEPTION ERROR HERE
Lock Method
Type IDirect3DVertexBuffer7 Extends IUnknown Method Lock(dwFlags,lplpData:Byte Ptr Var,Size Var) End Type
This is the c++ code, I've probably got it all wrong
STDMETHOD(Lock)(THIS_ DWORD,LPVOID*,LPDWORD) PURE;
Is it because size=0 ?
[edit] Oi you changed it lol...still, are you allowed to lock 0 verts?
[editedit] Also, did you check that the vertexbuffer exists?
[edit] Oi you changed it lol...still, are you allowed to lock 0 verts?
[editedit] Also, did you check that the vertexbuffer exists?
The size parameter is actually returned by the Lock command. If you set Size to 0 or Null then no size is returned.
I think the issue is with LPVOID*, documentation says LPVOID* is the pointer to our pointer to the buffer. How the heck do I do that in BMax?
[edit]VertexBuffer is returning Null! What a waste of a day!
I think the issue is with LPVOID*, documentation says LPVOID* is the pointer to our pointer to the buffer. How the heck do I do that in BMax?
[edit]VertexBuffer is returning Null! What a waste of a day!
Dang, he's compiled it as a module so I can't learn anything from that.
I'm sure Mark S could answer this one in 2 mins - or maybe there is a reason I can't do this? Anyone?
I'm sure Mark S could answer this one in 2 mins - or maybe there is a reason I can't do this? Anyone?
Doesn't he give the source later in the thread?
Ohh nice, I had an idea I might have to include some C in there somewhere.
Where is Ant anyway?
Where is Ant anyway?
Starting a new project... I expect :)
ROFL. hey whats this 360 Game Creator on his site? One of the games he's saying that was made with it was actually made in D ?? whats the story there eh?
I think it looks quite funky but not really sure what it is, what you can do and how it fits into Bmax. Nothing on the forums either
I think he's keeping a low profile ta actually *do* something... (however incredible it sounds.. ;))
Anyway back to topic.
anyone got a danny?
anyone got a danny?
VertexBuffer is returning Null! What a waste of a day!
A successful call in DirextX returns 0, which of course is null, so your buffer may be ok.
I was checking the memory address returned by the function, the address was null :(