Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Has anyone had any luck with the Lock method on the DirectDraw Surface object?

 

Every time I lock a surface, application just freezes and eventually throws an exception, I have tried everything, cant seem to get it to work properly.

Posted
Has anyone had any luck with the Lock method on the DirectDraw Surface object?

 

Every time I lock a surface, application just freezes and eventually throws an exception, I have tried everything, cant seem to get it to work properly.

 

yes I do

 

 

Dim dati As Integer(,)

 

Dim i As Integer

Dim j As Integer

 

dati = CType(superficie.Lock(LockFlags.Wait), Integer(,))

 

For i = 0 To 639

For j = 0 To 479

dati(i, j) = Color.Red.ToArgb

Next

Next

 

superficie.Unlock(dati)

 

 

where superficie is a surface of 640 x 480

 

works only on summer update and .net 2003

Posted

I think the Lock() method is just crap to be honest. I have it working, but the bigger surface you lock, the longer the lock takes to begin. I am guessing this has something to do with mapping to an array in .NET. But either way, it makes the method pretty useless for any realtime effects. Which is pretty much what it is there for.

 

Thanks for the help.

Posted

what's the point of even locking it? all i use it for is getting the array back from the vertex buffer to store into the vertices..

 

vertices = vertbuffer.lock(0,0) :-p

or

vertices = directcast(vertexbuffer.lock(0,0),customvertex.PositionTexturedorwhatever))

 

i do this before setting the vertices coordinates and stuff (and then unlock it of course)

 

seems to work for me

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted
I'm using a DirectDraw surface. No 3D stuff in this one.

if you need a quick access to memory is impossible, memory acces is show

if you need simple modification use pixel shader in direct3D. If you use 2.0 version you can obtain many effect but you can't do what ever you want.

In directDraw this is the best you can do

Posted
Just thought I'd mention that you can use D3D to create 2D stuff (not to mention you get better performance AND it's easier to use). There's a Sprite class in D3D that makes this all too easy. :)
Gamer extraordinaire. Programmer wannabe.
Posted
Locking a surface gives you direct access to the data for manipulation. It also prevents multiple threads from manipulating it at the same time.
Gamer extraordinaire. Programmer wannabe.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...