----------------------------------------------------------------------------- Name: InitDeviceObjects() Desc: Initialize scene objects. -----------------------------------------------------------------------------
| 203 | // Desc: Initialize scene objects. |
| 204 | //----------------------------------------------------------------------------- |
| 205 | HRESULT CMyD3DApplication::InitDeviceObjects() |
| 206 | { |
| 207 | HRESULT hr; |
| 208 | |
| 209 | m_pFont->InitDeviceObjects( m_pd3dDevice ); |
| 210 | |
| 211 | ilInit(); |
| 212 | iluInit(); |
| 213 | ilutInit(); |
| 214 | ilutD3D8TexFromFile(m_pd3dDevice, __argv[1], &m_pTexture); |
| 215 | //D3DXCreateTextureFromFile(m_pd3dDevice, __argv[1], &m_pTexture); |
| 216 | |
| 217 | // Create a vertex buffer |
| 218 | { |
| 219 | if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( 4*sizeof(VERTEX), |
| 220 | D3DUSAGE_WRITEONLY, |
| 221 | D3DFVF_VERTEX, |
| 222 | D3DPOOL_MANAGED, &m_pVB ) ) ) |
| 223 | return hr; |
| 224 | |
| 225 | VERTEX* pVertices; |
| 226 | m_pVB->Lock( 0, 4*sizeof(VERTEX), (BYTE**)&pVertices, 0 ); |
| 227 | memcpy( pVertices, g_vVertices, sizeof(VERTEX)*4 ); |
| 228 | m_pVB->Unlock(); |
| 229 | } |
| 230 | |
| 231 | return S_OK; |
| 232 | } |
| 233 | |
| 234 | |
| 235 |