Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Oct 2010
Offline Last Active Jul 25 2013 08:10 AM

Topics I've Started

DrawPrimitive() fails after device reset?

27 September 2012 - 03:13 PM


I am trying to deal with the case when the D3D device is lost (due to window minimization in a fullscreen application)..
Everything seem to be working fine, except for the DrawPrimitive function, which keeps failing after the device is successfully reset!

Here is what my rendering function look like:

1. Call the TestCooperativeLevel function and only proceed to rendering if the function returned D3D_OK.
2. If the function returned D3DERR_DEVICELOST, return without doing anything.
3. If it returned D3DERR_DEVICENOTRESET, ReleaseResources(), reset the device (passing the same presentation parameters used when creating the device) and then RecreateResources().
4. If it returned D3D_OK, continue rendering.

Where in ReleaseResources(), I release an array of dynamic vertex buffers which I use to render all the geometry in my application, as well as releasing all the textures used in the application (I don't create any other resources), and in RecreateResources(), I recreate the textures again. (Vertex buffers are created and released as needed each rendering frame so they don't need recreation)

After debugging, I found that the device reset function succeeds, as well as the device functions: Clear(), BeginScene(), SetStreamSource(), EndScene(), Present(), and when writing vertex data to vertex buffers, the functions Lock() and Unlock() also succeed.
The only function that fails is DrawPrimitive().

Since the device was reset, I know it is not a problem of releasing resources..
So what could the problem be?

Thanks for any help, and let me know if you need any further details..

Problem With Vertex Buffer??

05 October 2010 - 07:58 AM


I am trying to draw a simple quad on the screen using direct3d.
To do this, I fill a vertex buffer and an index buffer with
the requaired vertex and index arrays, and use the
DrawIndexedPrimitive function.

The quad is drawn only if I declare my vertex array as a fixed array:

VERTEX vArray[4];

and pass it directly to the (memcpy) function, which I use to fill
the vertex buffer.

but when I try to use a dynamic array:

VERTEX *vArray = new VERTEX[4];

or when I try to pass a fixed array as an argument to a function
that use it to fill the buffer by passing it again to the (memcpy),
nothing is shown on the screen..

Do anybody know why does this happen?

thanks in advanced and sorry for my poor english..