'컴퓨터 그래픽 > OpenGL' 카테고리의 다른 글
[ Getting Started ] 개발환경 구축 - Ubuntu (1) | 2022.04.22 |
---|---|
[Getting Started] 0. CMake 사용하기 - 기초 (0) | 2022.04.16 |
[Getting Started] 2. OpenGL (0) | 2022.04.16 |
[OpenGL] 공부 강좌 및 저서 출처 (0) | 2022.04.16 |
[ Getting Started ] 개발환경 구축 - Ubuntu (1) | 2022.04.22 |
---|---|
[Getting Started] 0. CMake 사용하기 - 기초 (0) | 2022.04.16 |
[Getting Started] 2. OpenGL (0) | 2022.04.16 |
[OpenGL] 공부 강좌 및 저서 출처 (0) | 2022.04.16 |
[ vimrc 파일 ]
[ zshrc 파일 ]
[ vimrc 파일 코드 ]
1 " Basic Settings
2
3 map <F3> <ESC>:NERDTreeToggle<CR>
4 map <F5> :tabnew<CR>
5 map <F4> :bn<CR>
6
7 colorscheme jellybeans
8 set termguicolors
9 syntax on
10 set number
11 set nu
12 set hlsearch
13 set ignorecase
14 set tabstop=4
15 set softtabstop=4
16 set shiftwidth=4
17 set expandtab
18 autocmd FileType make setlocal noexpandtab
19
20 " Key Settings
21 nnoremap <F2> :set invpaste paste?<CR>
22 set pastetoggle=<F2>
23 let mapleader = ","
24 nnoremap <leader>q :bp<CR>
25 nnoremap <leader>w :bn<CR>
26
27 " Key Setting - resize windows
28 nnoremap <silent> <Leader>= :exe "resize +3"<CR>
29 nnoremap <silent> <Leader>- :exe "resize -3"<CR>
30 nnoremap <silent> <Leader>] :exe "vertical resize +8"<CR>
31 nnoremap <silent> <Leader>[ :exe "vertical resize -8"<CR>
32
33 nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
34 nnoremap <silent> <Leader>_ :exe "resize " . (winheight(0) * 2/3)<CR>
35 nnoremap <silent> <Leader>} :exe "vertical resize " . (winheight(0) * 3/2)<CR>
36 nnoremap <silent> <Leader>{ :exe "vertical resize " . (winheight(0) * 2/3)<CR>
37
38 " Vundle
39 set nocompatible " be iMproved, required
40 filetype off " required
41
42 " set the runtime path to include Vundle and initialize
43 set rtp+=~/.vim/bundle/Vundle.vim
44 call vundle#begin()
45 " alternatively, pass a path where Vundle should install plugins
46 "call vundle#begin('~/some/path/here')
47
48 " let Vundle manage Vundle, required
49 Plugin 'VundleVim/Vundle.vim'
50
51 " Keep Plugin commands between vundle#begin/end.
52
53 Plugin 'vim-airline/vim-airline'
54 Plugin 'vim-airline/vim-airline-themes'
55 Plugin 'The-NERD-Tree'
56 Plugin 'terryma/vim-multiple-cursors'
57 Plugin 'terryma/vim-smooth-scroll'
58 Plugin 'Raimondi/delimitMate'
59 Plugin 'SirVer/ultisnips'
60 Plugin 'honza/vim-snippets'
61 Plugin 'Syntastic'
62 Plugin 'Shougo/deoplete.nvim'
63 Plugin 'Rip-Rip/clang_complete'
64 Plugin 'roxma/nvim-yarp'
65 Plugin 'roxma/vim-hug-neovim-rpc'
66 Plugin 'morhetz/gruvbox'
67
68 " All of your Plugins must be added before the following line
69 call vundle#end() " required
70 filetype plugin indent on " required
71 " To ignore plugin indent changes, instead use:
72 "filetype plugin on
73 "
74 " Brief help
75 " :PluginList - lists configured plugins
76 " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
77 " :PluginSearch foo - searches for foo; append `!` to refresh local cache
78 " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
79 "
80 " see :h vundle for more details or wiki for FAQ
81 " Put your non-Plugin stuff after this line
82
83 " for vim-airline
84 let g:airline#extensions#tabline#enabled = 1 " turn on buffer list
85 " Smarter tab line 활성화: 모든 파일 버퍼 출력
86 let g:airline#extensions#tabline#enabled = 1
87
88 " Tab line 구분자 '|' 로 설정
89 let g:airline#extensions#tabline#left_sep = ' '
90 let g:airline#extensions#tabline#left_alt_sep = '|'
91
92 " Tab line 에 파일명만 출력되도록 설정
93 let g:airline#extensions#tabline#formatter = 'unique_tail'
94
95 " Powerline-font 활성화
96 let g:airline_powerline_fonts = 1
97 let g:airline_theme='hybrid'
98 set laststatus=2 " turn on bottom bar
99
100 " The-NERD-Tree
101 autocmd BufEnter * lcd %:p:h
102 autocmd VimEnter * if !argc() | NERDTree | endif
103 nmap <leader>ne :NERDTreeToggle<cr>
104 let NERDTreeShowLineNumbers=1
105 let g:NERDTreeWinPos = "right"
106
107 " gruvbox
108 let g:gruvbox_contrast_dark="hard"
109 set background=dark
110 autocmd vimenter * colorscheme gruvbox
111
112 " vim-multiple-cursor
113 let g:multi_cursor_use_default_mapping=0
114 " Default mapping
115 let g:multi_cursor_next_key='<C-n>'
116 let g:multi_cursor_prev_key='<C-p>'
117 let g:multi_cursor_skip_key='<C-x>'
118 let g:multi_cursor_quit_key='<Esc>'
119
120 " vim-smooth-scroll
121 noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 10, 5)<CR>
122 noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 10, 5)<CR>
123 noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 10, 3)<CR>
124 noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 10, 3)<CR>
125
126 " delimitMate
127 let delimitMate_expand_cr=1
128
129 " UltiSnips
130 let g:UltiSnipsExpandTrigger="<tab>"
131 let g:UltiSnipsJumpForwardTrigger="<tab>"
132 let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
133 let g:UltiSnipsEditSplit="vertical"
134
135 " Syntastic
136 set statusline+=%#warningmsg#
137 set statusline+=%{SyntasticStatuslineFlag()}
138 set statusline+=%*
139
140 let g:syntastic_always_populate_loc_list = 1
141 let g:syntastic_auto_loc_list = 1
142 let g:syntastic_check_on_open = 1
143 let g:syntastic_check_on_wq = 0
144
145 let g:syntastic_cpp_compiler = 'g++'
146 let g:syntastic_cpp_compiler_options = "-std=c++11 -Wall -Wextra -Wpedantic"
147 let g:syntastic_c_compiler_options = "-std=c11 -Wall -Wextra -Wpedantic"
148
149 " Deoplete.
150 let g:deoplete#enable_at_startup = 1
151
152 " clang_complete
153 set completeopt-=preview
CMake는 다양한 빌드(Build) 도구 중 하나이다.
X. 만약에 이미 CMake가 설치되어있는 경우, 제거해준다.
$sudo apt-get purge cmake
A. 필요한 패키지들을 설치한다.
$ sudo apt-get update
$ sudo apt-get install wget build-essential
B. 공식 홈페이지로 이동하여 다운로드 링크를 복사한다.
[공식 홈페이지 : https://cmake.org/download/]
$ wget https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1.tar.gz
$ tar -xvf cmake-3.23.1.tar.gz
C. 아래의 명령어의 순차적으로 진행한다.
$ cd cmake-3.23.1
$ ./bootstrap --prefix=/usr
$ make
$ sudo make install
D. 최종적으로 설치된 CMake 버젼을 확인한다.
$ cmake --version
1. CMakeLists.txt 파일을 만든다.
$ vim CMakeLists.txt
2. src와 build 디렉토리를 만든다.
소스 파일과 빌드 파일들을 저장하기 위해서
$ mkdir src
$ mkdir build
3. src 폴더 안에 main.cpp 파일을 생성해준다.
$ cd src
/src$ vim main.cpp
4. 간단한 Hello World 파일을 만든다.
#include <iostream>
using namespace std;
int main(void){
cout << "Hello World!" << endl;
return 0;
}
5. 본격적으로 CMakeLists.txt 파일을 만든다.
cmake_minimun_required(VERSION 3.18) // cmake --version을 통해 현재 버젼이하로 설정하자
set(PROJECT_NAME Project_name) // PROJECT_NAME이라는 변수에 Project_name을 기입한다.
set(CMAKE_CXX_STANDARD 17) // c++ 버젼을 기입
project(${PROJECT_NAME}) // 프로젝트 이름을 설정
add_executable(${PROJECT_NAME} src/main.cpp) // 프로젝트 메인 소스 파일 설정
6. build 파일 안에서 cmake 빌드와 make 빌드를 진행한다.
$ cd build
/build$ cmake ..
/build$ make
7. Project가 생성되었는지 확인한다.
/build$ ls
/build$ .... Project_name
8. Project 실행
/build$ ./Project_name
Hello World!
[ Getting Started ] 개발환경 구축 - Ubuntu (1) | 2022.04.22 |
---|---|
[CMakeLists.txt 파일] (0) | 2022.04.21 |
[Getting Started] 2. OpenGL (0) | 2022.04.16 |
[OpenGL] 공부 강좌 및 저서 출처 (0) | 2022.04.16 |
OpenGL은 그래픽이나 이미지를 다루기 위한 API의 일종이다.
하지만, OpenGL은 그 자체가 API인 것은 아니다.
OpenGL은 넓은 범위에서의 설명서이다.
Input과 Output에 대하여 그래픽이나 이미지들의 구현이 어떻게 되는지에 대한 대략적인 설명서이다.
대략적인 설명서인 이유는 사용자의 하드웨어,
즉, 그래픽 카드에 따라서 다른 OpenGL 버젼이 사용되기 때문이다.
그렇기에, 특정 버젼에 따라 지원해주는 OS 혹은 기기가 달라지기에, 큰 범주에서
"그래픽 카드에서 다루는 함수들의 라이브러리"라는 의미로 OpenGL이 사용된다.
[p.s]
다음 홈페이지에서는 그래픽 관련 API들이 모여있는 정보들을 확인할 수 있다.
Welcome to the Khronos Group
Nov5th2021년 11월 2일, 미국 오레곤주 비버톤 – 크로노스그룹은 오늘 3D 데이터 가시화를 위한 확장가능한 API 개방형 표준으로 ANARI™ 1.0 (Analytic Rendering Interface)의 잠정 표준안을 공개하였다. ANARI
kr.khronos.org
고정 함수 파이프라인(fixed function pipeline)이라고도 불렸던 옛날 형식의 OpenGL 방식이다.
이것의 장점은 그래픽을 비교적 쉽게 그릴 수 있다는 것이다.
하지만, 시간이 지나고 효율적인 측면과 커스터마이징에 대한 필요성이 증대되면서,
사용자가 조금 더 Low-Level에서 그래픽 라이브러리를 다룰 필요가 되면서 한계점이 드러나기 시작한다.
위와 같은 현상 때문에, 개발자들은 "Core-Profile Mode"라고 하는 옛날 방식의 기능들이
제거된 새로운 모드를 제시한다.
이 방식의 장점으로는 효율성과 유연성이 매우 좋다는 점이다.
하지만, 이것은 옛날 방식에 비해 학습에 있어서 난이도가 높다는 단점이 있다.
OpenGL의 가장 뛰어난 장점 중의 하나가 바로 "확대 지원"이라고 할 수 있다.
조금 더 친근하게 설명하자면, 다양한 그래픽 카드에 대해서도 지원을 확대하여 가능하게 하는 것이다.
OpenGL은 하나의 시스템이자 커다란 컴퓨터라고 생각하면 된다.
우리는 삼각형을 그리는 대신에 OpenGL로 구현한 코드들의 변수들을 변경시키면서
그림을 그려나갈 것이다.
[ Getting Started ] 개발환경 구축 - Ubuntu (1) | 2022.04.22 |
---|---|
[CMakeLists.txt 파일] (0) | 2022.04.21 |
[Getting Started] 0. CMake 사용하기 - 기초 (0) | 2022.04.16 |
[OpenGL] 공부 강좌 및 저서 출처 (0) | 2022.04.16 |