Browse Source

no message

Hongtae Kim 7 years ago
parent
commit
139badbdd3
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      TestApp1/TestApp1.cpp

+ 7
- 1
TestApp1/TestApp1.cpp View File

19
 	{
19
 	{
20
 		DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
20
 		DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
21
 		DKObject<DKCommandQueue> queue = device->CreateCommandQueue();
21
 		DKObject<DKCommandQueue> queue = device->CreateCommandQueue();
22
-		DKObject<DKCommandBuffer> buffer = queue->CreateCommandBuffer();
23
 		DKObject<DKSwapChain> swapChain = queue->CreateSwapChain(window);
22
 		DKObject<DKSwapChain> swapChain = queue->CreateSwapChain(window);
24
 
23
 
25
 		DKTimer timer;
24
 		DKTimer timer;
29
 		while (!runningRenderThread.CompareAndSet(0, 0))
28
 		while (!runningRenderThread.CompareAndSet(0, 0))
30
 		{
29
 		{
31
 			DKRenderPassDescriptor rpd = swapChain->CurrentRenderPassDescriptor();
30
 			DKRenderPassDescriptor rpd = swapChain->CurrentRenderPassDescriptor();
31
+			double t = timer.Elapsed();
32
+			t = (cos(t) + 1.0) * 0.5;
33
+			rpd.colorAttachments.Value(0).clearColor = DKColor(t, 0.0, 0.0, 0.0);
34
+
35
+			DKObject<DKCommandBuffer> buffer = queue->CreateCommandBuffer();
32
 			DKObject<DKRenderCommandEncoder> encoder = buffer->CreateRenderCommandEncoder(rpd);
36
 			DKObject<DKRenderCommandEncoder> encoder = buffer->CreateRenderCommandEncoder(rpd);
33
 			if (encoder)
37
 			if (encoder)
34
 			{
38
 			{
35
 				// draw scene!
39
 				// draw scene!
36
 
40
 
41
+				encoder->EndEncoding();
42
+				buffer->Commit();
37
 				swapChain->Present();
43
 				swapChain->Present();
38
 			}
44
 			}
39
 			else
45
 			else