Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Feb 2010
Offline Last Active Feb 29 2012 11:24 PM

Topics I've Started

[C++ DirectX9] Render to Texture

21 February 2012 - 07:12 PM

Let's just jump straight into code:

void beginRender(void)
  pd3dDev->GetRenderTarget(0, &pBackBuffer);
  pRenderTexture->GetSurfaceLevel(0, &pRenderSurface);
  pd3dDev->SetRenderTarget(0, pRenderSurface);
  pd3dDev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
  pd3dDev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
void endRender(void)
  //Do RTT
  effect->SetTexture("Screen", pRenderTexture);
  pd3dDev->SetRenderTarget(0, pBackBuffer);
  pd3dDev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(100, 0, 0), 1.0f, 0);
  pd3dDev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
  pd3dDev->SetTexture(0, pRenderTexture);
  pd3dDev->SetStreamSource(0, pRenderVB, 0, sizeof(VERTEX2D));
  UINT cPasses;
  effect->Begin(&cPasses, 0);
  for(UINT i = 0; i < cPasses; i++)
  pd3dDev->SetTexture(0, NULL);
  pd3dDev->Present(NULL, NULL, NULL, NULL);
  mouseState.x = mouseState.y = 0;

So basically this code works flawlessly on my laptop, but when I try and run it on my desktop the texture is black. I've experimented with the shader and the shader is working fine. The scene itself renders fine when I don't save it to a texture. I'm really stumped on this one, if anyone needs more code snippets I'll be happy to show some more.

Thanks in advance,
Daniel (Ripe)

[FMOD] Sound Card Problems.

27 November 2010 - 08:39 AM


That's my original thread over on the fmod forums. I decided to post here as well just to get more feedback, I'm really stuck. It's not hindering the development of my game, but I know that compatibility will be a big issue when my game is tested.

Thanks for your help in advance.


Texturing a Circle

25 February 2010 - 05:46 PM

OK, this should be a quick answer, but I need to texture a circle (home made coding a circle) if you need I can post how I do it, but it's really math intensive and I don't want to scare people. Also I need to know how to rotate it (once again HOME MADE ROTATE, none of that glRotatef crap) when need be. thanks in advance for all the help.