'2013/01'에 해당되는 글 2건

  1. 왜 gl3.h가 필요한가. 2013.01.11
  2. glFrustum때문에 벌어진 삽질 2013.01.11

http://www.opengl.org/discussion_boards/showthread.php/175645-Why-is-gl3-h-necessary


09-19-2011, 01:36 AM

Junior MemberNewbie
Join Date
Sep 2011
Posts
11

Why is gl3.h necessary?

Probably a silly question for an experienced OpenGL developer, but this is a beginners forum (and I am a beginner - more or less), so I guess it's the right place to ask.

I mean, this is the first library that I used where the header carries a version number, and I find that very bizarre. So, if someone could explain why that was done (or point me to some documentation that explains it), I would appreciate that.

Also, in regards to 3.x and higher: Do I have to create a 3.x context in order to use 3.x features, or does GLEW allow me to use them? My current understanding is that this is what GLEW is for ... although, I have to use it even for just basic shaders, and that's supposed to be in 2.x domain, from what I understand (it's like everything in 2.x is being treated like an extension on my system - I would like to know if this is generally how things work, or if it's something specific to my system that maybe needs fixing).


Senior MemberOpenGL Guru
Join Date
May 2009
Posts
4,413

Re: Why is gl3.h necessary?

I mean, this is the first library that I used where the header carries a version number, and I find that very bizarre.
That's because most libraries are not backwards compatible. Or if they are, then they are backwards compatible by not removing old APIs.

Various functions and enumerators were removed from OpenGL at version 3.1. The purpose of gl3.h is to provide a header that includes only the functions and enumerators relevant to 3.1 and above.

Do I have to create a 3.x context in order to use 3.x features, or does GLEW allow me to use them?
It depends on what you mean by that. If you're using GLEW, then you should not care about gl3.h; just use GLEW's headers and you'll be fine.

OpenGL since version 3.2 has been divided into two specifications: core and compatibility. As the name suggests, compatibility means that all of the removed functions are restored. Core means that they're gone.

On most platforms, you must specifically ask for an OpenGL core context, via wgl/glXCreateContextAttribs. If you do not, then you will get a compatibility context. MacOSX has a different way of dealing with it, primarily centered around the fact that they don't provide a compatibility implementation. You either get 2.1 or 3.2 core.

it's like everything in 2.x is being treated like an extension on my system
The OpenGL Wiki's Getting Started page explains this.

Junior MemberNewbie
Join Date
Sep 2011
Posts
11

Re: Why is gl3.h necessary?

Quote Originally Posted by Alfonse Reinheart
That's because most libraries are not backwards compatible. Or if they are, then they are backwards compatible by not removing old APIs.

Various functions and enumerators were removed from OpenGL at version 3.1. The purpose of gl3.h is to provide a header that includes only the functions and enumerators relevant to 3.1 and above.
So, it's not so much about new functions, as it is about breaking the old ones?

It depends on what you mean by that. If you're using GLEW, then you should not care about gl3.h; just use GLEW's headers and you'll be fine.
Yea, well, that's really what I'm asking: If GLEW makes gl3.h irrelevant (in terms of available features - where I can still access the latest GPU capabilities without gl3.h), then what's the point of having gl3.h in the first place?

Is it just to break the old stuff? Why can't GLEW be configured to do that (since it seems to be the arbiter of what's actually made available to the application)?

The OpenGL Wiki's Getting Started page explains this.
That means that all OpenGL functions have to be "loaded in" like that, extension or not - this is how I interpreted those 3 passages.

So, even with a 3.x context, I would still need GLEW.

PS: 

Hey, I've been reading your tutorial - thanks for making that: You can remove deprecated features from the API, but old documentation tends to linger like a bad smell.

Your modern tutorial is a breath of fresh air.

@V-man

Thanks for the info.















GL 공부를 다시 하던 중, x축이 화면 왼쪽을 가리키고 있는 기묘한 현상을 발견했다. 와인딩, 좌표 모두 문제 없었고 y,z는 오른손좌표계 그대로인데, x만 뒤집혀 있었던 것이다.


원인은 glFrustum함수의 left, right가 바뀌어있었던 것 때문이었다.


프러스텀이 +z에서 -z를 바라보고 있어야 했는데 left가 0.5, right가 -0.5인 상태였다. 정상으로 바꾸자 문제는 해결되었다.


프러스텀 설정에 문제가 있는걸 찾기까지 몇시간을 허비했다.