Skip to content

Commit

Permalink
[WINDOWS] Load Atlas before creating the buffers...
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed May 11, 2019
1 parent 30b9978 commit d1455a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ void DrawCockpit (IDirect3DDevice9 *pd3dDevice)
pd3dDevice->SetFVF( D3DFVF_TRANSFORMEDCOLVERTEX );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, 0, 2 ); // 3 points per triangle

pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
//pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
Expand Down
10 changes: 5 additions & 5 deletions StuntCarRacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ HRESULT CALLBACK OnResetDevice( IDirect3DDevice9 *pd3dDevice,
// Create a sprite to help batch calls when drawing many lines of text
V_RETURN( D3DXCreateSprite( pd3dDevice, &g_pSprite ) );

if (FAILED(D3DXCreateTextureFromResource(pd3dDevice, NULL, L"ATLAS", &g_pAtlas)))
return E_FAIL;

InitAtlasCoord();

if (CreatePolygonVertexBuffer(pd3dDevice) != S_OK)
return E_FAIL;
if (CreateTrackVertexBuffer(pd3dDevice) != S_OK)
Expand All @@ -569,11 +574,6 @@ HRESULT CALLBACK OnResetDevice( IDirect3DDevice9 *pd3dDevice,
if (CreateCockpitVertexBuffer(pd3dDevice) != S_OK)
return E_FAIL;

if ( FAILED( D3DXCreateTextureFromResource( pd3dDevice, NULL, L"ATLAS", &g_pAtlas ) ) )
return E_FAIL;

InitAtlasCoord();

// Set the projection transform (view and world are updated per frame)
D3DXMATRIX matProj;
FLOAT fAspect = pBackBufferSurfaceDesc->Width / (FLOAT)pBackBufferSurfaceDesc->Height;
Expand Down

0 comments on commit d1455a8

Please sign in to comment.