-
Tutorial 3: Initializing DirectX 11 연습문제Directx 11 with rastertek 2022. 9. 2. 16:48
To Do Exercises
1. Re-compile the code and run the program to ensure DirectX works, if not look at the steps from the first tutorial. Press the escape key to quit after the window displays.
2. Change the global in graphicsclass.h to full screen and re-compile/run.
3. Change the clear color in GraphicsClass::Render to yellow.
4. Write the video card name out to a text file.
1. 프로그램 다시 컴파일하고 실행해보기.
1번 결과 2. graphicsclass.h에 있는 전역 변수 중 FULL_SCREEN을 true로 설정해보기.
graphicsclass.h
const bool FULL_SCREEN = true;
2번 결과 3. GraphicsClass::Render에서 화면 초기화를 노랑색으로 바꿔보기.
graphicsclass.cpp
bool GraphicsClass::Render() { // Clear the buffers to begin the scene. m_Direct3D->BeginScene(1.0f, 1.0f, 0.0f, 1.0f); // Present the rendered scene to the screen. m_Direct3D->EndScene(); return true; }
참고로 노란색의 색상코드는 FFFF00이다. 따라서 1.0, 1.0, 0.0으로 설정해주면 노란색이 출력 됨.
3번 결과 4. .txt파일에 그래픽카드의 메모리용량과 그래픽카드의 이름을 출력하라.
d3dclass.cpp
bool D3DClass::Initialize(int screenWidth, int screenHeight, bool vsync, HWND hwnd, bool fullscreen, float screenDepth, float screenNear) { .............. 생략 ................ ofstream file("output.txt"); if (file.is_open()) { file << "메모리용량 : " << m_videoCardMemory << endl; file << "그래픽카드 이름 : " << m_videoCardDescription<< endl; file.close(); } else { cout << "error" << endl; return 1; } .............. 생략 ................ }
4번 결과 참고로 .txt파일의 위치는 아래와 같은 방법으로 들어갈 수 있다.
우선 프로젝트를 우클릭하고 '파일 탐색기에서 폴더 열기(X)'를 클릭해주자.
위와같은 output.txt 파일이 생성되어있다.(참고, 코드에서 이름을 다르게 넣어주면 파일이름이 달라질 수 있음.)
그리고 해당 파일을 열면된다. -끝-
'Directx 11 with rastertek' 카테고리의 다른 글
Tutorial 8: Loading Maya 2011 Models 연습문제 (0) 2022.09.07 Tutorial 6: Diffuse Lighting 연습문제 (0) 2022.09.06 Tutorial 5: Texturing 연습문제 (0) 2022.09.05 Tutorial 4: Buffers, Shaders, and HLSL 연습문제 (0) 2022.09.03 Tutorial 2: Creating a Framework and Window 연습문제 (0) 2022.09.02