Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

1

12.09.2011, 11:26

SDK-Effects11-Binärcodefehler

Hi,ich schriebe das erste mal in euer Forum und hoff das das alles so passt:

Ich hab vor einigen Wochen mit der SPieleprogrammierung in C++ begonnen mit dem Buch "Spieleprogrammierung mit DirectX 11 und c++"

Anfangs bin ich auf das Problem gestossen,dass sich die Beispielprogramme mit VC++ Studio Expressedition nicht kompilieren lassen,darauf bin ich sozusagen auf die VC++ Expressedition 2010 umgestiegen und habe die Beispielprogramme für 2010 geöffnet.Hat soweit auch immer alles funktioniert.

Nun am ende des ersten Kapitels soll ich die Datei Effects11 für ein EffectFramework ins projekt aufnehmen bzw. includieren (ich hoff ich habs ungefähr richtig ausgedrückt).

Jedoch immer wenn ich das fertige Programm kompiliere können bestimmte verweise nicht aufgelöst werden (Fehlermeldung: Verweis auf nicht aufgelöstes externes Symbol).

Als ich dann aus neugier heraus nur nur das Project Effects11 debugged habe ist die Fehlermeldung gekommen,dass die Datei ein nicht bekanntes oder nicht unterstütztes Binärformat bestitz.

Andere Daten von denen ich nciht weiss ob sie witchtig sind:

Betreibssystem Windows7 x64Bit

Das DX-SDK ist natürlich auch heruntergeladen u.ä

Ich hoffe ich hab keine Informationen vergessen und bedanke mich schonmal im Voraus:D

Der eig. Quellcode des eig. Projects:

C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
//-------------------------------------------------------------------------------------- 
// File: SimpleSample11.cpp 
// 
// Starting point for new Direct3D 11 samples. For a more basic starting point, 
// use the EmptyProject11 sample instead. 
// 
// Copyright (c) Microsoft Corporation. All rights reserved. 

//-------------------------------------------------------------------------------------- 
#include "DXUT.h" 
#include "DXUTgui.h" 
#include "DXUTmisc.h" 
#include "DXUTCamera.h" 
#include "DXUTSettingsDlg.h" 
#include "SDKmisc.h" 
#include "SDKmesh.h" 
#include "resource.h" 
#include "d3dx11effect.h" 

//#define DEBUG_VS // Uncomment this line to debug D3D9 vertex shaders 
//#define DEBUG_PS // Uncomment this line to debug D3D9 pixel shaders 

//-------------------------------------------------------------------------------------- 
// Global variables 
//-------------------------------------------------------------------------------------- 
CModelViewerCamera g_Camera; // A model viewing camera 
CDXUTDialogResourceManager g_DialogResourceManager; // manager for shared resources of dialogs 
CD3DSettingsDlg g_SettingsDlg; // Device settings dialog 
CDXUTTextHelper* g_pTxtHelper = NULL; 
CDXUTDialog g_HUD; // dialog for standard controls 
CDXUTDialog g_SampleUI; // dialog for sample specific controls 

// Direct3D 9 resources 
extern ID3DXFont* g_pFont9; 
extern ID3DXSprite* g_pSprite9; 

// Direct3D 11 resources 
ID3D11VertexShader* g_pVertexShader11 = NULL; 
ID3D11PixelShader* g_pPixelShader11 = NULL; 
ID3D11InputLayout* g_pLayout11 = NULL; 
ID3D11SamplerState* g_pSamLinear = NULL; 


//------------------------------------------------------------------------------------- 
//Eigene 
//------------------------------------------------------------------------------------- 
//Effekt und Technique 
ID3DX11Effect*    g_pEffect = NULL; 
ID3DX11EffectTechnique*    g_pTechnique = NULL; 


//Effektvariablen 
ID3DX11EffectMatrixVariable* g_pmWorldViewProj = NULL; 
ID3DX11EffectMatrixVariable* g_pmWorld = NULL; 

//Material 
ID3DX11EffectVectorVariable* g_pDiffuseVariable = NULL; 

//Textur 
ID3D11ShaderResourceView* g_pRV = NULL; 
ID3DX11EffectShaderResourceVariable* g_ptxDiffuseVariable = NULL; 

//Licht 
ID3DX11EffectVectorVariable* g_pLightDirVariable = NULL; 
ID3DX11EffectVectorVariable* g_pLightDiffuseVariable = NULL; 
ID3DX11EffectVectorVariable* g_pAmbientVariable = NULL; 

//Anderes 
D3DXMATRIX g_mWorld; 
CDXUTSDKMesh    g_Mesh; 
//-------------------------------------------------------------------------------------- 
// Constant buffers 
//-------------------------------------------------------------------------------------- 
#pragma pack(push,1) 
struct CB_VS_PER_OBJECT 
{ 
D3DXMATRIX m_mWorldViewProjection; 
D3DXMATRIX m_mWorld; 
D3DXVECTOR4 m_MaterialAmbientColor; 
D3DXVECTOR4 m_MaterialDiffuseColor; 
}; 

struct CB_VS_PER_FRAME 
{ 
D3DXVECTOR3 m_vLightDir; 
float m_fTime; 
D3DXVECTOR4 m_LightDiffuse; 
}; 
#pragma pack(pop) 

ID3D11Buffer* g_pcbVSPerObject11 = NULL; 
ID3D11Buffer* g_pcbVSPerFrame11 = NULL; 

//-------------------------------------------------------------------------------------- 
// UI control IDs 
//-------------------------------------------------------------------------------------- 
#define IDC_TOGGLEFULLSCREEN 1 
#define IDC_TOGGLEREF 2 
#define IDC_CHANGEDEVICE 3 


//-------------------------------------------------------------------------------------- 
// Forward declarations 
//-------------------------------------------------------------------------------------- 
LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, 
void* pUserContext ); 
void CALLBACK OnKeyboard( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext ); 
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ); 
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ); 
bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, void* pUserContext ); 



bool CALLBACK IsD3D11DeviceAcceptable( const CD3D11EnumAdapterInfo *AdapterInfo, UINT Output, const CD3D11EnumDeviceInfo *DeviceInfo, 
DXGI_FORMAT BackBufferFormat, bool bWindowed, void* pUserContext ); 
HRESULT CALLBACK OnD3D11CreateDevice( ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, 
void* pUserContext ); 
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain, 
const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ); 
void CALLBACK OnD3D11ReleasingSwapChain( void* pUserContext ); 
void CALLBACK OnD3D11DestroyDevice( void* pUserContext ); 
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime, 
float fElapsedTime, void* pUserContext ); 

void InitApp(); 
void RenderText(); 


//-------------------------------------------------------------------------------------- 
// Entry point to the program. Initializes everything and goes into a message processing 
// loop. Idle time is used to render the scene. 
//-------------------------------------------------------------------------------------- 
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) 
{ 
// Enable run-time memory check for debug builds. 
#if defined(DEBUG) | defined(_DEBUG) 
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); 
#endif 

// DXUT will create and use the best device (either D3D9 or D3D11) 
// that is available on the system depending on which D3D callbacks are set below 

// Set DXUT callbacks 
DXUTSetCallbackMsgProc( MsgProc ); 
DXUTSetCallbackKeyboard( OnKeyboard ); 
DXUTSetCallbackFrameMove( OnFrameMove ); 
DXUTSetCallbackDeviceChanging( ModifyDeviceSettings ); 

DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable ); 
DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice ); 
DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain ); 
DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain ); 
DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice ); 
DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender ); 

InitApp(); 
DXUTInit( true, true, NULL ); // Parse the command line, show msgboxes on error, no extra command line params 
DXUTSetCursorSettings( true, true ); 
DXUTCreateWindow( L"SimpleSample11" ); 

// Only require 10-level hardware, change to D3D_FEATURE_LEVEL_11_0 to require 11-class hardware 
// Switch to D3D_FEATURE_LEVEL_9_x for 10level9 hardware 
DXUTCreateDevice( D3D_FEATURE_LEVEL_10_0, true, 640, 480 ); 

DXUTMainLoop(); // Enter into the DXUT render loop 

return DXUTGetExitCode(); 
} 


//-------------------------------------------------------------------------------------- 
// Initialize the app 
//-------------------------------------------------------------------------------------- 
void InitApp() 
{ 
g_SettingsDlg.Init( &g_DialogResourceManager ); 
g_HUD.Init( &g_DialogResourceManager ); 
g_SampleUI.Init( &g_DialogResourceManager ); 

g_HUD.SetCallback( OnGUIEvent ); 
int iY = 30; 
int iYo = 26; 
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 22 ); 
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += iYo, 170, 22, VK_F3 ); 
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += iYo, 170, 22, VK_F2 ); 

g_SampleUI.SetCallback( OnGUIEvent ); iY = 10; 
} 


//-------------------------------------------------------------------------------------- 
// Render the help and statistics text. This function uses the ID3DXFont interface for 
// efficient text rendering. 
//-------------------------------------------------------------------------------------- 
void RenderText() 
{ 
g_pTxtHelper->Begin(); 
g_pTxtHelper->SetInsertionPos( 5, 5 ); 
g_pTxtHelper->SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) ); 
g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) ); 
g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() ); 
g_pTxtHelper->End(); 
} 


//-------------------------------------------------------------------------------------- 
// Reject any D3D11 devices that aren't acceptable by returning false 
//-------------------------------------------------------------------------------------- 
bool CALLBACK IsD3D11DeviceAcceptable( const CD3D11EnumAdapterInfo *AdapterInfo, UINT Output, const CD3D11EnumDeviceInfo *DeviceInfo, 
DXGI_FORMAT BackBufferFormat, bool bWindowed, void* pUserContext ) 
{ 
return true; 
} 


//-------------------------------------------------------------------------------------- 
// Create any D3D11 resources that aren't dependant on the back buffer 
//-------------------------------------------------------------------------------------- 
HRESULT CALLBACK OnD3D11CreateDevice( ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, 
void* pUserContext ) 
{ 
HRESULT hr; 

ID3D11DeviceContext* pd3dImmediateContext = DXUTGetD3D11DeviceContext(); 
V_RETURN( g_DialogResourceManager.OnD3D11CreateDevice( pd3dDevice, pd3dImmediateContext ) ); 
V_RETURN( g_SettingsDlg.OnD3D11CreateDevice( pd3dDevice ) ); 
g_pTxtHelper = new CDXUTTextHelper( pd3dDevice, pd3dImmediateContext, &g_DialogResourceManager, 15 ); 

// Read the HLSL file 
WCHAR str[MAX_PATH]; 
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"SimpleSample.hlsl" ) ); 

// Compile the shaders 
DWORD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS; 
#if defined( DEBUG ) || defined( _DEBUG ) 
// Set the D3DCOMPILE_DEBUG flag to embed debug information in the shaders. 
// Setting this flag improves the shader debugging experience, but still allows 
// the shaders to be optimized and to run exactly the way they will run in 
// the release configuration of this program. 
dwShaderFlags |= D3DCOMPILE_DEBUG; 
#endif 

// You should use the lowest possible shader profile for your shader to enable various feature levels. These 
// shaders are simple enough to work well within the lowest possible profile, and will run on all feature levels 


ID3DBlob* pBlob = NULL; 
V_RETURN( D3DX11CompileFromFile( str, NULL, NULL, "", "fx_5_0", dwShaderFlags, 0, NULL, 
&pBlob, NULL, NULL ) ); 

ID3DBlob* pPixelShaderBuffer = NULL; 
    V_RETURN( D3DX11CreateEffectFromMemory( pBlob->GetBufferPointer(), pBlob->GetBufferSize(), dwShaderFlags, pd3dDevice, &g_pEffect)); 



    //Effektvariablen 
    g_pmWorldViewProj = g_pEffect-> 
        GetVariableByName("g_mWorldViewProjection")->AsMatrix(); 
    g_pmWorld = g_pEffect->GetVariableByName("g_mWorld")->AsMatrix(); 

    //Licht 
    g_pLightDirVariable = g_pEffect->GetVariableByName("g_vLightDir")->AsVector(); 
    g_pLightDiffuseVariable = g_pEffect->GetVariableByName("g_LightDiffuse")-> 
        AsVector(); 

    //Material 
    g_pAmbientVariable = g_pEffect->GetVariableByName("g_MaterialAmbientColor")-> 
        AsVector(); 
    g_pDiffuseVariable = g_pEffect->GetVariableByName("g_MaterialDiffuseColor")-> 
        AsVector(); 

    //Textur 
DXUTFindDXSDKMediaFileCch(str, MAX_PATH, L"Genetica\\Born to Rule.jpg"); 
    DXUTGetGlobalResourceCache().CreateTextureFromFile(pd3dDevice, pd3dImmediateContext, 
str, &g_pRV); 
    g_ptxDiffuseVariable = g_pEffect->GetVariableByName("g_txDiffuse")-> 
        AsShaderResource(); 

    //Technique 
    g_pTechnique = g_pEffect->GetTechniqueByName("RenderScene"); 


//Vertexlayout 
    const D3D11_INPUT_ELEMENT_DESC layout[] = 
    { 
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, 
        D3D11_INPUT_PER_VERTEX_DATA, 0 }, 
        { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, 
        D3D11_INPUT_PER_VERTEX_DATA, 0 }, 
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, 
        D3D11_INPUT_PER_VERTEX_DATA, 0 }, 
    }; 

// No longer need the shader blobs 
SAFE_RELEASE( pPixelShaderBuffer ); 

// Create state objects 
D3D11_SAMPLER_DESC samDesc; 
ZeroMemory( &samDesc, sizeof(samDesc) ); 
samDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; 
samDesc.AddressU = samDesc.AddressV = samDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; 
samDesc.MaxAnisotropy = 1; 
samDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS; 
samDesc.MaxLOD = D3D11_FLOAT32_MAX; 
V_RETURN( pd3dDevice->CreateSamplerState( &samDesc, &g_pSamLinear ) ); 
DXUT_SetDebugName( g_pSamLinear, "Linear" ); 

// Create constant buffers 
D3D11_BUFFER_DESC cbDesc; 
ZeroMemory( &cbDesc, sizeof(cbDesc) ); 
cbDesc.Usage = D3D11_USAGE_DYNAMIC; 
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; 
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; 

cbDesc.ByteWidth = sizeof( CB_VS_PER_OBJECT ); 
V_RETURN( pd3dDevice->CreateBuffer( &cbDesc, NULL, &g_pcbVSPerObject11 ) ); 
DXUT_SetDebugName( g_pcbVSPerObject11, "CB_VS_PER_OBJECT" ); 

cbDesc.ByteWidth = sizeof( CB_VS_PER_FRAME ); 
V_RETURN( pd3dDevice->CreateBuffer( &cbDesc, NULL, &g_pcbVSPerFrame11 ) ); 
DXUT_SetDebugName( g_pcbVSPerFrame11, "CB_VS_PER_FRAME" ); 

// Create other render resources here 

// Setup the camera's view parameters 
D3DXVECTOR3 vecEye( 0.0f, 0.0f, -5.0f ); 
D3DXVECTOR3 vecAt ( 0.0f, 0.0f, -0.0f ); 
g_Camera.SetViewParams( &vecEye, &vecAt ); 

return S_OK; 
} 


//-------------------------------------------------------------------------------------- 
// Create any D3D11 resources that depend on the back buffer 
//-------------------------------------------------------------------------------------- 
HRESULT CALLBACK OnD3D11ResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain* pSwapChain, 
const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ) 
{ 
HRESULT hr; 

V_RETURN( g_DialogResourceManager.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) ); 
V_RETURN( g_SettingsDlg.OnD3D11ResizedSwapChain( pd3dDevice, pBackBufferSurfaceDesc ) ); 

// Setup the camera's projection parameters 
float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height; 
g_Camera.SetProjParams( D3DX_PI / 4, fAspectRatio, 0.1f, 1000.0f ); 
g_Camera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height ); 
g_Camera.SetButtonMasks( MOUSE_LEFT_BUTTON, MOUSE_WHEEL, MOUSE_MIDDLE_BUTTON ); 

g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 170, 0 ); 
g_HUD.SetSize( 170, 170 ); 
g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 170, pBackBufferSurfaceDesc->Height - 300 ); 
g_SampleUI.SetSize( 170, 300 ); 

return S_OK; 
} 


//-------------------------------------------------------------------------------------- 
// Render the scene using the D3D11 device 
//-------------------------------------------------------------------------------------- 
void CALLBACK OnD3D11FrameRender( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, double fTime, 
float fElapsedTime, void* pUserContext ) 
{ 
// If the settings dialog is being shown, then render it instead of rendering the app's scene 
if( g_SettingsDlg.IsActive() ) 
{ 
g_SettingsDlg.OnRender( fElapsedTime ); 
return; 
} 

float ClearColor[4] = { 0.176f, 0.196f, 0.667f, 0.0f }; 
ID3D11RenderTargetView* pRTV = DXUTGetD3D11RenderTargetView(); 
pd3dImmediateContext->ClearRenderTargetView( pRTV, ClearColor ); 

// Clear the depth stencil 
ID3D11DepthStencilView* pDSV = DXUTGetD3D11DepthStencilView(); 
pd3dImmediateContext->ClearDepthStencilView( pDSV, D3D11_CLEAR_DEPTH, 1.0, 0 ); 

// Get the projection & view matrix from the camera class 
D3DXMatrixTranslation(&g_mWorld, 0, 0, 0); 

D3DXMATRIX mView = *g_Camera.GetViewMatrix(); 
D3DXMATRIX mProj = *g_Camera.GetProjMatrix(); 
D3DXMATRIX mWorldViewProjection = g_mWorld * mView * mProj; 





    g_pmWorldViewProj->SetMatrix((float*)&mWorldViewProjection); 
    g_pmWorld->SetMatrix((float*)&g_mWorld); 

    //Licht 
D3DXVECTOR3 LightDir(1.0f, 0.0f, 0.0f); 
if(g_pLightDirVariable) 
g_pLightDirVariable->SetFloatVector(LightDir); 

D3DXVECTOR3 LightDiffuse(1.0f, 0.0f, 0.0f); //Rot 
if(g_pLightDiffuseVariable) 
g_pLightDiffuseVariable->SetFloatVector(LightDiffuse); 

    //Material 
D3DXVECTOR3 Ambient(0.0f, 0.0f, 1.0f); //Blau 
if(g_pAmbientVariable) 
g_pAmbientVariable->SetFloatVector(Ambient); 

D3DXVECTOR3 Diffuse(1.0f, 1.0f, 1.0f); //Weiss 
    if(g_pDiffuseVariable) 
        g_pDiffuseVariable->SetFloatVector(Diffuse); 

    //Textur 
if(g_ptxDiffuseVariable) 
g_ptxDiffuseVariable->SetResource(g_pRV); 

    pd3dImmediateContext->IASetInputLayout( g_pLayout11 ); 

    g_pTechnique->GetPassByIndex(0)->Apply(0, pd3dImmediateContext); 

    g_Mesh.Render(pd3dImmediateContext); 






} 


//-------------------------------------------------------------------------------------- 
// Release D3D11 resources created in OnD3D11ResizedSwapChain 
//-------------------------------------------------------------------------------------- 
void CALLBACK OnD3D11ReleasingSwapChain( void* pUserContext ) 
{ 
g_DialogResourceManager.OnD3D11ReleasingSwapChain(); 
} 


//-------------------------------------------------------------------------------------- 
// Release D3D11 resources created in OnD3D11CreateDevice 
//-------------------------------------------------------------------------------------- 
void CALLBACK OnD3D11DestroyDevice( void* pUserContext ) 
{ 
g_DialogResourceManager.OnD3D11DestroyDevice(); 
g_SettingsDlg.OnD3D11DestroyDevice(); 
DXUTGetGlobalResourceCache().OnDestroyDevice(); 
SAFE_DELETE( g_pTxtHelper ); 

SAFE_RELEASE( g_pVertexShader11 ); 
SAFE_RELEASE( g_pPixelShader11 ); 
SAFE_RELEASE( g_pLayout11 ); 
SAFE_RELEASE( g_pSamLinear ); 

// Delete additional render resources here... 

SAFE_RELEASE( g_pcbVSPerObject11 ); 
SAFE_RELEASE( g_pcbVSPerFrame11 ); 
} 


//-------------------------------------------------------------------------------------- 
// Called right before creating a D3D9 or D3D11 device, allowing the app to modify the device settings as needed 
//-------------------------------------------------------------------------------------- 
bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, void* pUserContext ) 
{ 
if( pDeviceSettings->ver == DXUT_D3D9_DEVICE ) 
{ 
IDirect3D9* pD3D = DXUTGetD3D9Object(); 
D3DCAPS9 Caps; 
pD3D->GetDeviceCaps( pDeviceSettings->d3d9.AdapterOrdinal, pDeviceSettings->d3d9.DeviceType, &Caps ); 

// If device doesn't support HW T&L or doesn't support 1.1 vertex shaders in HW 
// then switch to SWVP. 
if( ( Caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT ) == 0 || 
Caps.VertexShaderVersion < D3DVS_VERSION( 1, 1 ) ) 
{ 
pDeviceSettings->d3d9.BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING; 
} 

// Debugging vertex shaders requires either REF or software vertex processing 
// and debugging pixel shaders requires REF. 
#ifdef DEBUG_VS 
if( pDeviceSettings->d3d9.DeviceType != D3DDEVTYPE_REF ) 
{ 
pDeviceSettings->d3d9.BehaviorFlags &= ~D3DCREATE_HARDWARE_VERTEXPROCESSING; 
pDeviceSettings->d3d9.BehaviorFlags &= ~D3DCREATE_PUREDEVICE; 
pDeviceSettings->d3d9.BehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; 
} 
#endif 
#ifdef DEBUG_PS 
pDeviceSettings->d3d9.DeviceType = D3DDEVTYPE_REF; 
#endif 
} 

// For the first device created if its a REF device, optionally display a warning dialog box 
static bool s_bFirstTime = true; 
if( s_bFirstTime ) 
{ 
s_bFirstTime = false; 
if( ( DXUT_D3D9_DEVICE == pDeviceSettings->ver && pDeviceSettings->d3d9.DeviceType == D3DDEVTYPE_REF ) || 
( DXUT_D3D11_DEVICE == pDeviceSettings->ver && 
pDeviceSettings->d3d11.DriverType == D3D_DRIVER_TYPE_REFERENCE ) ) 
{ 
DXUTDisplaySwitchingToREFWarning( pDeviceSettings->ver ); 
} 

} 

return true; 
} 


//-------------------------------------------------------------------------------------- 
// Handle updates to the scene. This is called regardless of which D3D API is used 
//-------------------------------------------------------------------------------------- 
void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ) 
{ 
// Update the camera's position based on user input 
g_Camera.FrameMove( fElapsedTime ); 
} 


//-------------------------------------------------------------------------------------- 
// Handle messages to the application 
//-------------------------------------------------------------------------------------- 
LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, 
void* pUserContext ) 
{ 
// Pass messages to dialog resource manager calls so GUI state is updated correctly 
*pbNoFurtherProcessing = g_DialogResourceManager.MsgProc( hWnd, uMsg, wParam, lParam ); 
if( *pbNoFurtherProcessing ) 
return 0; 

// Pass messages to settings dialog if its active 
if( g_SettingsDlg.IsActive() ) 
{ 
g_SettingsDlg.MsgProc( hWnd, uMsg, wParam, lParam ); 
return 0; 
} 

// Give the dialogs a chance to handle the message first 
*pbNoFurtherProcessing = g_HUD.MsgProc( hWnd, uMsg, wParam, lParam ); 
if( *pbNoFurtherProcessing ) 
return 0; 
*pbNoFurtherProcessing = g_SampleUI.MsgProc( hWnd, uMsg, wParam, lParam ); 
if( *pbNoFurtherProcessing ) 
return 0; 

// Pass all remaining windows messages to camera so it can respond to user input 
g_Camera.HandleMessages( hWnd, uMsg, wParam, lParam ); 

return 0; 
} 


//-------------------------------------------------------------------------------------- 
// Handle key presses 
//-------------------------------------------------------------------------------------- 
void CALLBACK OnKeyboard( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext ) 
{ 
} 


//-------------------------------------------------------------------------------------- 
// Handles the GUI events 
//-------------------------------------------------------------------------------------- 
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ) 
{ 
switch( nControlID ) 
{ 
case IDC_TOGGLEFULLSCREEN: 
DXUTToggleFullScreen(); 
break; 
case IDC_TOGGLEREF: 
DXUTToggleREF(); 
break; 
case IDC_CHANGEDEVICE: 
g_SettingsDlg.SetActive( !g_SettingsDlg.IsActive() ); 
break; 
} 
}

idontknow

unregistriert

2

12.09.2011, 11:40

Fehlermeldung: Verweis auf nicht aufgelöstes externes Symbol -> eine *lib nicht eingebunden/gelinkt.

Sowas solltest du googln bzw. die Suckfunktion benutzen die Frage wird irgendwie ständig gestellt.

Fireball

Alter Hase

Beiträge: 415

Wohnort: Werne

Beruf: Dipl. Inf.

  • Private Nachricht senden

3

12.09.2011, 12:15

Einem Anfänger im ersten Kapitel ein ca. 600 Zeilen langes Prog an die Birne zu knallen finde ich schon echt grenz wertig.

Meiner Meinung nach sollte das Buch "Spieleprogrammierung mit DirectX 11 und c++" verboten werden! Denn die Autorin hat dort zum größten Teil
die Beispiele aus dem DirectX SDK abgedruckt.

FSA

Community-Fossil

  • Private Nachricht senden

4

12.09.2011, 16:46

Da kann ich mich nur anschließen!
Ein Freund von mir hatte das Buch auch.
Ich habe mal reingelesen und ganz ehrlich das ist nur Quellcode den man garantiert nicht versteht im ersten Kapitel.
ZB wird dort eine Kamera eingesetzt die du überhaupt nicht verwenden bzw initialisieren kannst ( also mit FOV usw ).
Ich empfehle dir nicht unbedingt das Buch zu lesen. Nacher wenn du ein anderes Buch fertig hast ist dass schon interresant.
MFG
Und zu dem Problem: Effect.lib linken ;-)

Zitat

Der RCCSWU (RandomCamelCaseSomtimesWithUndersquare) Stil bricht auch mal mit den veraltet strukturierten Denkmustern und erlaubt dem Entwickler seine Kreativität zu entfalten.

Ridcally

Frischling

Beiträge: 59

Beruf: Schüler

  • Private Nachricht senden

5

12.09.2011, 18:14

Naja, sooooooo schlecht ist das Buch nun auch wieder nicht. Hatte es einmal aus der Bücherei ausgeliehen, und habe schon das ein oder andere gelernt.
Tipp: Du kannst das Projekt des Effekt-Frameworks auch in deine Projektmappe aufnehmen, und dann bei deinem Projekt unter "Projektabhängigkeiten" hinzufügen.
MFG Ridcally

"In Zukunft werde ich bescheiden werden. Nicht nur bescheiden, nein, der bescheidenste Mensch der Welt!"
Hercule Poirot

6

14.09.2011, 19:23

Die Autorin hat selbsverständlich angemerkt,dass ein Großteil aus dem SimpleSample ist.

Ich hab den Quellcode nur reinkopiert,falls in jemand gebraucht hätte:)

Aber ich habs trotz dem Hinweis in diesem Forum und der Anleitung im Buch nicht hinbekommen die Datei so zu inkludieren,dass es funktioniert...

Ich habs 1000 und 1mal probiert.Kann mir irgendjemand weiterhelfen?

Und ich habs in die Projektmappe aufgenommen-das eine der erklärungen vom Buch :(

Hat trotzdem nicht funktioniert

(Bitte steinigt mich nicht für meine Unwissenheit)

PS:Könntet ihr mir ein anderes Buch vorschlagen?

Ridcally

Frischling

Beiträge: 59

Beruf: Schüler

  • Private Nachricht senden

7

15.09.2011, 16:52

Es stellt sich halt die Frage, warum du mit DX11 anfangen willst. Das ist nämlich doch eher komplex. Wenn du 3D machen willst, bietet sich eventuell eine Game-Engine an, zB Irrlicht:
www.irrlicht3d.org
Da gibt es eine Wiki mit (englischen) Tutorials, und das ganze ist doch eher einfach.
Zu DX9 gibt es natürlich auch dieses Buch:
http://www.amazon.de/3D-Spieleprogrammie…16098269&sr=8-1
Ist auch ein tolles Buch.
MFG Ridcally

"In Zukunft werde ich bescheiden werden. Nicht nur bescheiden, nein, der bescheidenste Mensch der Welt!"
Hercule Poirot

8

15.09.2011, 17:30

Ok danke:D

Und kann mir inderweile noch jemand mit dem eig. Problem weiterhelfen?

I-wie funktionierts net obwhol ich genau des mach was da steht

Werbeanzeige