๋ฐ˜์‘ํ˜•

์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” Visual Studio 2015 MFC ํ™˜๊ฒฝ์—์„œ VTK SDK๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

๋จผ์ €, VTK๋ฅผ ์ค€๋น„ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”.


1. Dialog ๊ธฐ๋ฐ˜์˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.


2. 'ํ”„๋กœ์ ํŠธ > ์†์„ฑ'์ฐฝ์„ ์—ฝ๋‹ˆ๋‹ค.

3. 'Debugging > Environment'์— dll์ด ์กด์žฌํ•˜๋Š” ๊ฒฝ๋กœ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

path=C:\Program Files (x86)\VTK\Debug\bin;%PATH%


4. 'C/C++ > General > Additional Include Directories'์— ์•„๋ž˜์˜ ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

์•„๋ž˜ ๊ฒฝ๋กœ๋Š” CMake๋กœ ์ƒ์„ฑ๋œ ์œ„์น˜๋กœ, include ํด๋”๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.


5. 'Linker > General > Additional Library Directories'์— ์•„๋ž˜์˜ ๊ฒฝ๋กœ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.


6. 'Linker > Input > Additional Dependencies'์— lib ํด๋” ๋‚ด์˜ ๋ชจ๋“  *.lib ํŒŒ์ผ ๋ชฉ๋ก์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

๋ฌผ๋ก , ์‚ฌ์šฉํ•˜๋Š” lib ํŒŒ์ผ๋งŒ ์ž…๋ ฅํ•ด๋„ ๋˜์ง€๋งŒ ์ž‘์—…ํ•˜๋‹ค ๋ณด๋ฉด ์‚ฌ์šฉํ•ด์•ผ ํ•  ํŒŒ์ผ๋“ค์ด ๋Š˜์–ด๋‚˜๊ธฐ ๋•Œ๋ฌธ์— ํ•œ ๋ฒˆ์— ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์‰ฝ๊ฒŒ lib ํŒŒ์ผ ๋ชฉ๋ก์„ ์ž…๋ ฅํ•˜์„ธ์š”.


7. 'Linker > Input > Delay Loaded Dlls'์— bin ํด๋” ๋‚ด์˜ ๋ชจ๋“  *.dll ํŒŒ์ผ ๋ชฉ๋ก์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

lib์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๊ฐ™์€ ๋ฐฉ๋ฒ•์œผ๋กœ dll ํŒŒ์ผ ๋ชฉ๋ก์„ ์ž…๋ ฅํ•˜๋ฉด ๋˜๊ฒ ์Šต๋‹ˆ๋‹ค.

์ง€์—ฐ๋œ dll ๋ชฉ๋ก์„ ์ž…๋ ฅํ•˜๋Š” ์ด์œ ๋Š”, False Memory Leak ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

VTK Library๊ฐ€ ํ•ด์ œ๋˜๊ธฐ ์ „์— MFC๊ฐ€ ๋จผ์ € ํ•ด์ œ๋˜์–ด ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ๋•Œ๋ฌธ์ด์ฃ .


8. ํ”„๋กœ์ ํŠธ ์„ค์ •์€ ๋ชจ๋‘ ์™„๋ฃŒ๋์Šต๋‹ˆ๋‹ค.

์ด์ œ ์ฝ”๋“œ์—์„œ VTK Library๋ฅผ ์ดˆ๊ธฐํ™” ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

header ํŒŒ์ผ์— ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
(์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋Šฅ์— ๋”ฐ๋ผ ์ดˆ๊ธฐํ™” ๋ฐ ์ถ”๊ฐ€๋˜๋Š” ํ—ค๋”ํŒŒ์ผ์ด ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.)

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);

#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkSmartPointer.h>
#include <vtkRenderWindowInteractor.h>


9. ์ด์ œ ๋นŒ๋“œํ•˜์—ฌ ๋ฌธ์ œ๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ๋ณ„๋‹ค๋ฅธ ์ด์œ ๊ฐ€ ์—†๋‹ค๋ฉด ๋นŒ๋“œ์— ์„ฑ๊ณตํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ด๋กœ์จ Visual Studio 2015 MFC ํ™˜๊ฒฝ์—์„œ VTK ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•  ์ค€๋น„๊ฐ€ ๋ชจ๋‘ ์™„๋ฃŒ๋์Šต๋‹ˆ๋‹ค.

๋ฐ˜์‘ํ˜•