Sign in to follow this  

Direct3D10 & Color Problem

This topic is 2586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I have this

// CColorf class
real *GetARGB() const
{
real fColor[4] = { 0.0f };

fColor[0] = this->GetA();
fColor[1] = this->GetR();
fColor[2] = this->GetG();
fColor[3] = this->GetB();
return fColor;
}

// CD3D10Render class
void CRenderD3D10::Clear(const CColorf &Colorf)
{
if (m_pDevice)
{
m_pDevice->ClearRenderTargetView(m_pRenderTargetView, Colorf.GetARGB());
m_pDevice->ClearDepthStencilView(m_pDepthStencilView, D3D10_CLEAR_DEPTH | D3D10_CLEAR_STENCIL, 1, 0);
}
// move it in another function
if (m_pDXGISwapChain) m_pDXGISwapChain->Present(0, 0);
}

//--------------
if (m_pRenderD3D10) m_pRenderD3D10->Clear(CColorf(1.0f, 0.125f, 0.3f, 1.0f));




I'm using Visual C++ 2010. When i run the release exe the clear color is red-pink
when i run the debug exe the clear color is black why this???

i checked the any single color and this is my log:


//debug
(a)1.000000,(r)0.125000,(g)0.300000,(b)1.000000

//release
(a)1.000000,(r)0.125000,(g)0.300000,(b)1.000000




Please help me :(

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
You're returning a pointer to a temporary variable (fColor). Either make it a member of your CColorf class, or make it static member of that class, or have that GetARGB function take an array as a parameter that it will fill with the values.


Ok thanks now it work :)

Share this post


Link to post
Share on other sites

This topic is 2586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this