Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualCatwheel

Posted 15 August 2014 - 01:53 PM

OKay so let me get this straight before I get started.

The process should look like this:

		m_lpDX->m_lpDevice->EndScene();
        IDirect3DSurface9 * frame1 = NULL;
        IDirect3DSurface9 * frame2 = NULL;
        IDirect3DSurface9 * pBackBuffer = NULL;
        IDirect3DSurface9 * pActualBackBuffer = NULL;

        RECT r1;
        SetRect(&r1, 0, GetHeight()/4, GetWidth(), ((GetHeight()*3)/4));

        //get back buffer and initialize frame surfaces
        m_lpDX->m_lpDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
        m_lpDX->m_lpDevice->GetRenderTargetData(pBackBuffer,pActualBackBuffer);
        m_lpDX->m_lpDevice->CreateOffscreenPlainSurface(GetWidth(),GetHeight()/2,D3DFMT_/*format matching back buffer*/,D3DPOOL_DEFAULT,&frame1,NULL);// - CAT
        m_lpDX->m_lpDevice->CreateOffscreenPlainSurface(GetWidth(),GetHeight()/2,D3DFMT_/*format matching back buffer*/,D3DPOOL_DEFAULT,&frame2,NULL);// - CAT

//copy middle of back buffer to the two surfaces
        m_lpDX->m_lpDevice->StretchRect(pActualBackBuffer,&r1,frame1,NULL,D3DTEXF_NONE);
        m_lpDX->m_lpDevice->StretchRect(pActualBackBuffer,&r1,frame2,NULL,D3DTEXF_NONE);

//some operations would go here later to modify the surfaces for a left and right eye view

//copy frame surfaces back to the back buffer to be presented later.
        RECT d1;
        SetRect(&d1, 0, 0, GetWidth(), GetHeight()/2);
        m_lpDX->m_lpDevice->StretchRect(frame1,NULL,pActualBackBuffer,&d1,D3DTEXF_NONE);
        RECT d2;
        SetRect(&d2, 0, GetHeight()/2, GetWidth(), GetHeight());
        m_lpDX->m_lpDevice->StretchRect(frame2,NULL,pActualBackBuffer,&d2,D3DTEXF_NONE);

//release pointers
        frame1->Release();
        frame2->Release();
        pBackBuffer->Release();
        pActualBackBuffer->Release();

You'll notice that I did not check for the HResults, that is because I have a different question having to do with those before I write them in.

 

So I checked out the article that Unbird linked. I opened up the directx control panel and set it up for debug mode, however nothing came out. After googling I found that I needed to declare     #define D3D_DEBUG_INFO  so I did that, in this fashion:

//#ifdef _DEBUG
    #define D3D_DEBUG_INFO  // declare this before including d3d9.h
//#endif

#include <d3d9.h>
#include <d3dx9.h>

I'm not really sure where I'm supposed to retrieve the debug info though. Alternatively, I would settle for just being able to output some info, like with println(); but the program I am altering simply becomes a plugin for another piece of software. Therefore, i don't know where to find the output. I don't have a lot of experience with the command line, but I am wondering "Is there something there I could do?"

EDIT: This has to do with my question about HRESULT, which is essentially, "How can I make some custom text output that I can reference, while in this plugin?"

 

Lastly, I just wanted to say, I'm a senior college student with no prior graphics programming experience. Is this project too demanding for someone from my position? Further, do you have any general advice for someone in my position?


#1Catwheel

Posted 15 August 2014 - 01:48 PM

OKay so let me get this straight before I get started.

The process should look like this:

		m_lpDX->m_lpDevice->EndScene();
        IDirect3DSurface9 * frame1 = NULL;
        IDirect3DSurface9 * frame2 = NULL;
        IDirect3DSurface9 * pBackBuffer = NULL;
        IDirect3DSurface9 * pActualBackBuffer = NULL;

        RECT r1;
        SetRect(&r1, 0, GetHeight()/4, GetWidth(), ((GetHeight()*3)/4));

        //get back buffer and initialize frame surfaces
        m_lpDX->m_lpDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer );
        m_lpDX->m_lpDevice->GetRenderTargetData(pBackBuffer,pActualBackBuffer);
        m_lpDX->m_lpDevice->CreateOffscreenPlainSurface(GetWidth(),GetHeight()/2,D3DFMT_/*format matching back buffer*/,D3DPOOL_DEFAULT,&frame1,NULL);// - CAT
        m_lpDX->m_lpDevice->CreateOffscreenPlainSurface(GetWidth(),GetHeight()/2,D3DFMT_/*format matching back buffer*/,D3DPOOL_DEFAULT,&frame2,NULL);// - CAT

//copy middle of back buffer to the two surfaces
        m_lpDX->m_lpDevice->StretchRect(pActualBackBuffer,&r1,frame1,NULL,D3DTEXF_NONE);
        m_lpDX->m_lpDevice->StretchRect(pActualBackBuffer,&r1,frame2,NULL,D3DTEXF_NONE);

//some operations would go here later to modify the surfaces for a left and right eye view

//copy frame surfaces back to the back buffer to be presented later.
        RECT d1;
        SetRect(&d1, 0, 0, GetWidth(), GetHeight()/2);
        m_lpDX->m_lpDevice->StretchRect(frame1,NULL,pActualBackBuffer,&d1,D3DTEXF_NONE);
        RECT d2;
        SetRect(&d2, 0, GetHeight()/2, GetWidth(), GetHeight());
        m_lpDX->m_lpDevice->StretchRect(frame2,NULL,pActualBackBuffer,&d2,D3DTEXF_NONE);

//release pointers
        frame1->Release();
        frame2->Release();
        pBackBuffer->Release();
        pActualBackBuffer->Release();

You'll notice that I did not check for the HResults, that is because I have a different question having to do with those before I write them in.

 

So I checked out the article that Unbird linked. I opened up the directx control panel and set it up for debug mode, however nothing came out. After googling I found that I needed to declare     #define D3D_DEBUG_INFO  so I did that, in this fashion:

//#ifdef _DEBUG
    #define D3D_DEBUG_INFO  // declare this before including d3d9.h
//#endif

#include <d3d9.h>
#include <d3dx9.h>

I'm not really sure where I'm supposed to retrieve the debug info though. Alternatively, I would settle for just being able to output some info, like with println(); but the program I am altering simply becomes a plugin for another piece of software. Therefore, i don't know where to find the output. I don't have a lot of experience with the command line, but I am wondering "Is there something there I could do?"

 

Lastly, I just wanted to say, I'm a senior college student with no prior graphics programming experience. Is this project too demanding for someone from my position? Further, do you have any general advice for someone in my position?


PARTNERS