Sprite wont be drawn

Started by
-1 comments, last by Florian22222 12 years, 3 months ago
Hi!

I want to port my engine on D3D10 and so i tried to draw my crosshairl.


//text
D3DX10CreateFont( pd3dDevice, 14, 9, 1600, 1, FALSE, DEFAULT_CHARSET,OUT_RASTER_PRECIS, ANTIALIASED_QUALITY,FF_DONTCARE,TEXT("Arial"), &g_pFont);
D3DX10CreateSprite(pd3dDevice,0,&g_pSprite);
g_DialogResourceManager.OnD3D10CreateDevice(pd3dDevice);
g_pTxtHelper = new CDXUTTextHelper(g_pFont,g_pSprite,15);
//load crosshair
if(FAILED(DXUTGetGlobalResourceCache().CreateTextureFromFile(pd3dDevice,TEXT("Textures\\crosshair.png"),&g_pCrosshairTexture)))
{
MessageBox(NULL,TEXT("Crosshair.png cant be loaded"),TEXT("Crosshair error"),MB_OK);
exit(1);
}
D3DXMATRIX scale,translation;
/*D3DXMatrixScaling(&scale,0.4f,0.4f,0.0f);
D3DXMatrixTranslation(&translation,0,0,0.0f);
D3DXMatrixMultiply(&scale,&scale,&translation);*/
D3DXMatrixIdentity(&scale);
g_CrosshairSprite.pTexture = g_pCrosshairTexture;
g_CrosshairSprite.matWorld = scale;
g_CrosshairSprite.TexCoord = D3DXVECTOR2(0.0f,0.0f);
g_CrosshairSprite.TextureIndex = 0;
g_CrosshairSprite.TexSize = D3DXVECTOR2(128.0,128.0);
g_CrosshairSprite.ColorModulate = D3DXCOLOR(1.0f,1.0f,1.0f,1.0f);



void RenderGUI()
{
//TEXT
g_pTxtHelper->Begin();
g_pTxtHelper->SetInsertionPos(0,0);
g_pTxtHelper->SetForegroundColor(D3DXCOLOR(1.0f,1.0f,1.0f,1.0f));

std::wstringstream s;
s.clear();
s << TEXT("FPS: ") << (int)g_fps;
g_pTxtHelper->DrawTextLine(s.str().c_str());
g_pTxtHelper->End();
//draw GUI
g_pSprite->Begin(0);
D3DXMATRIX view,proj;
D3DXMatrixIdentity(&view);
D3DXMatrixIdentity(&proj);
/*D3DXMatrixMultiply(&view,&view,g_pCamera->GetViewMatrix());
D3DXMatrixMultiply(&proj,&proj,g_pCamera->GetProjMatrix());*/
g_pSprite->SetProjectionTransform(&view);
g_pSprite->SetViewTransform(&proj);
g_pSprite->DrawSpritesBuffered(&g_CrosshairSprite,1);
//g_pSprite->Flush();
g_pSprite->End();
}


The fps renders right. But the only thing i see from my crosshair is a horicontal white line on the screen.

This topic is closed to new replies.

Advertisement