티스토리 뷰

이 글을 발견하게 된 계기는 사소하다. GLUT, GLEW, GLFW와 같은 라이브러리들이 있는데, 대체 이 라이브러리들이 무엇인지에 대해 잘 이해가 안 가서 찾아보던 중이었다. 사실 나는 생각없이 GLUT를 쓰고 있었는데 이게 뭔지 제대로 알지도 못한 채 그냥 쓰고 있다는 사실을 자각하게 되었고, 거기다 맥과 우분투에서 동시에 작업할 수 있는 환경을 만드는 것에 대해 고민하다 차라리 이번 기회에 자세히 알지 못하던 부분을 자세히 알아봐야 겠다고 생각한 것이 시작이었다. 그러다 찾은 글이 바로 이 글이다. StackOverflow에 올라온 글인데, 채택된 답변 보다는 그 아래의 답변이 인상 깊었다. 꽤나 양질의 글인지라 번역해놓으면 도움이 되지 않을까 싶어서 부족한 실력이지만 번역을 시도해봤다. 



Q.

I am aware that there were similar questions in past few years, but after doing some researches I still can't decide where from and what should I learn. I would also like to see your current, actual view on modern OpenGL programming with more C++ OOP and shader approach. And get sure that my actual understanding on some things is valid.

나는 이런 질문에 대한 답을 찾기 위해 알아보다가 과거에도 비슷한 질문이 여러번 있어왔다는 것을 알게 됬다. 그리고 아직도 내가 무엇을 배워야 하는지 모르겠다. 나는 OpenGL을 C++ OOP와 쉐이더와 관련지어 어떻게 생각하고 있는지, 그리고 내가 알고 있는 것이 정확한지 알려줬으면 한다. 


So... currently we have OpenGL 4.2 out, which as I read somewhere requires dx11 hardware (what does it mean?) and set of 'side' libraries, to for example create window.

현재 우리는 OpenGL 4.2 외에도 윈도우를 만드는 것 등을 위해 추가적인 라이브러리를 쓴다.


There is the most common GLUT, which I extremely hate. One of main reason are function calls, which doesn't allow freedom in the way how we create main loop. As some people were telling, it was not meant for games.

GLUT는 가장 흔하게 쓰이지만 나는 이게 정말 싫다. 가장 큰 이유는 main loop를 내 마음대로 설계할 수 없다는 점이다. 사람들이 말하길 이것은 GLUT가 게임을 위한 것이 아니기 때문이라고 한다.


There is also GLFW, which actually is quite nice and straight-forward to me. For some reason people use it with GLUT. ( which provides not only window initialisation, but also other utilities? )

GLFW라는 것도 있다. 이건 잘 만들어졌고 나한테 직관적으로 보이는 라이브러리다. 그래서 사람들은 이 라이브러리를 GLUT와 함께 쓰더라. (윈도우를 띄우는 것 말고도 여러 유틸리티를 제공하기 때문인 것 같다.)


And there is also SFML and SDL ( SDL < SFML imo ), whereas both of them sometimes need strange approach to work with OGL and in some cases are not really fast.

그리고 SFML과 SDL이라는 것도 있다. (내 생각에는 SFML이 SDL보다 나은 것 같다.) 그런데 OpenGL과 함께 사용하는데에 있어 조금 이상한 구석이 있고 어던 경우에는 퍼포먼스가 부족하게 느껴진다.


And we have also GLEW, which is extension loading utility... wait... isn't GLUT/GLFW already an extension? Is there any reason to use it, like are there any really important extensions to get interested with?

GLEW는 어떤가. 이 녀석은 익스텐션인데.... 그런데 GLUT랑 GLFW가 이미 익스텐션 아닌가? 굳이 GLEW를 쓸 이유가 있나?


Untill now we have window creation (and some utilities), but... OGL doesn't take care of loading textures, neither 3D models. How many other libs do I need?

어쨌든 우리는 윈도우를 띄울 수 있지만 OpenGL은 텍스쳐 로딩도 지원 안하고, 3D 모델 로딩도 지원하지 않는다. 얼마나 많은 라이브러리가 더 필요한거야?


Let's mention education part now. There is (in)famous NeHe tutorial. Written in C with use of WinApi, with extremely unclear code and outdated solutions, yet still the most popular one. Some stuff like Red Book can be found, which are related to versions like 2.x or 3.x, however there are just few (and unfinished) tutorials mentioning 4.x.

교육 측면에서 말하겠다. Nehe가 만든 튜토리얼이 있는데, WinAPI와 C를 이용해서 작성되었는데 정말 코드가 더럽고 오래된 튜토리얼이다. 그런데도 가장 인기있는 튜토리얼 중 하나다. Red Book 같은 것에서 OpenGL 2.x, 3.x에 대한 내용이 좀 있긴 한데, 4.x에 대한 내용은 정말 적다.


What to go with?

이제 난 어떻게 해야 하는거야?



A.

So... currently we have OpenGL 4.2 out, which as I read somewhere requires dx11 hardware (what does it mean?) and set of 'side' libraries, to for example create window.


DX11 hardware is... hardware that has "supports DirectX 11" written on the side of the box. I'm not sure what it is you're asking here; are you unclear on what Direct3D is, what D3D 11 is, or what separates D3D 11 from prior versions?

DX11 하드웨어는 그 하드웨어의 박스에 DirectX 11을 지원한다고 되어있는 것들을 말한다. 난 여기서 니가 뭘 질문한건지 모르겠다. Direct3D가 뭔지, D3D11이 뭔지, 그리고 D3D11와 그 전의 버전에 대해서 잘 모르는건가?


FYI: D3D is a Windows-only alternative to using OpenGL to access rendering hardware. Version 11 is just the most recent version of the API. And D3D11 adds a few new things compared to D3D10, but nothing much that a beginner would need.

참고로 D3D은 윈도우에서만 쓸 수 있는, OpenGL 말고 다른 렌더링 하드웨어다. 11 버전은 가장 최신의 API고 D3D11은 D3D10에 비해 몇가지 새로운 것이 추가되었는데, 초심자에게는 아마 별로 다르게 보일게 없을거다.


OpenGL is a specification that describes a certain interface for graphics operations. How this interface is created is not part of OpenGL. Therefore, every platform has its own way for creating an OpenGL context. Windows uses the Win32 API with WGL. X-Windows uses the X-Windows API with GLX functions. And so forth.

OpenGL은 그래픽 연산을 위한 스펙을 작성해놓은 인터페이스다. 이 인터페이스가 어떻게 만들어진건지는 OpenGL의 영역이 아니다. 그러므로 모든 플랫폼들은 각자의 방식으로 OpenGL을 구현해놓을 수 있다. 윈도우는 Win32 API와 WGL을 쓰고, X-Windows는 X-Windows API와 GLX를 쓴다. 그 외에도 여러가지가 있겠지.


Libraries like GLUT, GLFW, etc are libraries that abstract all of these differences. They create and manage an OpenGL window for you, so that you don't have to dirty your code with platform-specific details. You do not have to use any of them.

GLUT, GLFW 같은 라이브러리들은 이런 차이들을 추상화 해 놓은 라이브러리들이다. 이것들로 OpenGL 윈도우를 관리할 수 있고, 각 플랫폼별 코드 때문에 네 코드가 더러워지는 것을 방지할 수 있다. 즉, 이걸 꼭 쓸 필요는 없다는 뜻이다.


Granted, if you're interested in learning OpenGL, it's best to avoid dealing with platform-specific minutae like how to take care of a HWND and such.

니가 OpenGL을 배우는데 관심이 있는거라면 각 플랫폼 때문에 삽질하는 것들은 피하는게 좋다. 예를 들면 HWND가 뭔지 이해하려 드는 것 말이다.


And we have also GLEW, which is extension loading utility... wait... isn't GLUT/GLFW already an extension? Is there any reason to use it, like are there any really important extensions to get interested with?


This is another misunderstanding. GLUT is a library, not an extension. An OpenGL extension is part of OpenGL. See, OpenGL is just a specification, a document. The implementation of OpenGL that you're currently using implements the OpenGL graphics system, but it may also implement a number of extensions to that graphics system.

또 잘못 이해하고 있는게 있군. GLUT는 라이브러리지 익스텐션이 아니다. OpenGL extension은 OpenGL의 것이다. 위에서 말한 것처럼 OpenGL은 그저 스펙이고 문서다. 각 시스템마다 OpenGL의 구현은 다르다는 말이다. 하지만 그 그래픽스 시스템을 위해 몇 가지 익스텐션들이 존재한다.


GLUT is not part of OpenGL; it's just a library. The job of GLUT is to create and manage an OpenGL window. GLEW is also a library, which is used for loading OpenGL functions. It's not the only alternative, but it is a popular one.

GLUT는 OpenGL의 일부가 아니고 라이브러리다. GLUT의 역할은 OpenGL 윈도우를 생성하고 관리하는 것이다. GLEW도 OpenGL의 함수들을 로드하는데 쓰는 라이브러리다. 유일하진 않지만 인기 있는 라이브러리 중 하나다.


Untill now we have window creation (and some utilities), but... OGL doesn't take care of loading textures, neither 3D models. How many other libs do I need?


OpenGL is not a game engine. It is a graphics system, designed for interfacing with dedicated graphics hardware. This job has nothing to do with things like loading anything from any kind of file. Yes, making a game requires this, but as previously stated, OpenGL is not a game engine.

OpenGL은 게임엔진이 아니라 하드웨어와의 인터페이스 역할을 하는 그래픽스 시스템이다. 이건 파일을 로드하는 것과 같은 작업들이라는 관계 없는 일이다. 게임을 만드는데는 그런 것들이 필요하겠지만 OpenGL은 게임 엔진이 아니니까 상관없다.


If you need to load a file format to do something you wish to do, then you will need to either write code to do the loading (and format adjustment needed to interface with GL) or download a library that does it for you. The OpenGL Wiki maintains a pretty good list of tools for different tasks.

만약 니가 파일을 로드하는게 필요하다면(그리고 그 내용을 OpenGL에서 쓸 수 있도록 보완하는게 필요하다면) 직접 그 코드를 작성하거나 다른 라이브러리를 써라. OpenGL Wiki에 관련 내용들이 있다.


There is (in)famous NeHe tutorial. Written in C with use of WinApi, with extremely unclear code and outdated solutions, yet still the most popular one. Some stuff like Red Book can be found, which are related to versions like 2.x or 3.x, however there are just few (and unfinished) tutorials mentioning 4.x.


What to go with?


The OpenGL Wiki maintains a list of online materials for learning OpenGL stuff, both old-school and more modern.

OpenGL Wiki에는 OpenGL에 대한 온라인 강좌 리스트도 있다. 옛날 것도 있고 요즘 것도 있지.




지금 그래픽스 강의를 들으면서 GLUT로 튜토리얼을 진행해나가고 있는데, 이 글을 읽고 나서 드는 고민이 있다. GLUT를 계속 쓸 것인지에 대한 것인데, 사실상 그래픽스에서 배우고자 하는 것은 그래픽스이지, 이미지 파일을 어떻게 로드하고 모델 파일을 어떻게 로드하는지가 아니다. 그런데 그런 그래픽스 공부 외적인 부분에 시간이 너무 많이 소모된다는 생각이 든다. 이럴 바에는 SDL 같은거 쓰는게 더 나은거 아닌가 싶기도 하고.... 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday