Jump to content
  • Advertisement
Sign in to follow this  
ph33r

Texture's wont display when switching windowed-fullscreen.

This topic is 5456 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

For some reason I can't get textures to display correctly when going from fullscreen to windowed and vice-versa. Every other managed resource gets re-created properly, like my vb and ib. Here is my code for loading the texture.
[SOURCE]
D3DXCreateTextureFromFileEx( 
g_pDevice, fileName, 
0, 0, 0, 0, 
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED, 
D3DX_FILTER_POINT, 
D3DX_DEFAULT, 
d3d::MAGENTA, 
NULL, NULL, &temp.m_tex );

Here is my code thats called when i reset the texture
	hr = g_pDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
	if( FAILED( hr ) )
	{
		::MessageBox( 0, "No support for renderstate ALPHATESTENABLE", 0, 0 );
		return false;
	}
	
	g_pDevice->SetRenderState( D3DRS_ALPHAREF, d3d::MAGENTA );
	g_pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
	g_pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
	g_pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
	g_pDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_EQUAL );


Also, I even try calling SetTexture( ), and passing it the currently active texture. But the model just displays white after a switch from full->windowed. Thanks, -ph33r

Share this post


Link to post
Share on other sites
Advertisement
I've got one code path for all my renderstates so im reseting them. What else could the problem be?

Here's the code path I do for reseting

//
// Reset the device first.
//
if( FAILED( g_pDevice->Reset( &d3d::g_d3dpp ) ) )
return false;

//
// Reset manager classes(resources).
//
if( !g_vbManager.Reset( ) ) return false;
if( !g_ibManager.Reset( ) ) return false;
if( !g_TextureManager.Reset( ) ) return false;

// VB/IB
if( !g_vbManager.SetActiveVertexBuffer( 0 ) ) return false;
if( !g_ibManager.SetIndices( ) ) return false;


//
// Reset states.
//
if( !d3d::InitializeView( ) ) return false;
if( !InitializeRenderStates( ) ) return false;

//////////////////////////////////////////////////////////////////////////
// Reset App Specifics here
//////////////////////////////////////////////////////////////////////////

if( !g_meshOne.Reset( ) ) return false;
if( !g_meshOne.SetMeshTexture( ) ) return false;

//////////////////////////////////////////////////////////////////////////
// END
//////////////////////////////////////////////////////////////////////////

// Success!
return true;
}


All my render states that are called, are being called in that intial render states function, so i dont understand how i could miss anything.

Share this post


Link to post
Share on other sites
I'm not sure what your rendering loop looks like but is your call to Reset on the device returning success and are you doing a Clear/Present before the next update?

I *just* went through getting windowed <-> fullscreen working myself (a real pain). When it failed though I didn't get anything to display at all.

Share this post


Link to post
Share on other sites
Yes, Reset is not failing, and I'm clearing the screen and doing a present.

My vertex/index buffer get reset properly because my mesh is still displayed its just my texture doesn't get reset properly. All I get is my mesh in plane white :(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!