Skip to main content
added 435 characters in body
Source Link
P. Avery
  • 575
  • 1
  • 4
  • 20

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE: The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

When using the back buffer at index 1 the frame rate falls to 30fps while using vsync. This produces artifacts and Horizontal Shearing. Using the back buffer at index 0 seems to be correct. When using this buffer the application presents a frame at the refresh rate of the monitor. Therefore in order to correctly implement triple buffering using Direct3D 9 you should draw to the back buffer at index 0.

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE: The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE: The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

When using the back buffer at index 1 the frame rate falls to 30fps while using vsync. This produces artifacts and Horizontal Shearing. Using the back buffer at index 0 seems to be correct. When using this buffer the application presents a frame at the refresh rate of the monitor. Therefore in order to correctly implement triple buffering using Direct3D 9 you should draw to the back buffer at index 0.

added 435 characters in body
Source Link
P. Avery
  • 575
  • 1
  • 4
  • 20

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE: The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

UPDATE: The application appears to run faster when I use a pointer to the first back buffer like so:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer --- NOTICE THE Back Buffer Index parameter is now 0 ---
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
added 35 characters in body
Source Link
P. Avery
  • 575
  • 1
  • 4
  • 20

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);

I am creating an application using Direct3D 9. I want to implement triple buffering with vsync. I can successfully create a graphics device object with 2 back buffers. How do I know which buffer to draw to?

EDIT:

Here is how I retrieve a pointer to the back buffer onto which I will draw using a deferred shading technique:

// graphics device object
IDirect3DDevice9 *pd3dDevice = GetDevice();

// back buffer pointer
IDirect3DSurface9 *pBackBuffer = null;

// get pointer to back buffer
pd3dDevice->GetBackBuffer(0, 1, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
added 370 characters in body
Source Link
P. Avery
  • 575
  • 1
  • 4
  • 20
Loading
Source Link
P. Avery
  • 575
  • 1
  • 4
  • 20
Loading