Programming/openGL2012. 6. 2. 23:38
-l(소문자 L/ Library) 에 GL GLU glut를 넣으면
gcc를 통해 openGL 컴파일시 라이브러리 링크를 해준다

$ gcc -lglut -lGLU -lGL 


오랫만에 다시 컴파일 하려니 다 까먹고 이게 머야 ㅠ.ㅠ
2011/09/07 - [Linux/Ubuntu] - ubuntu 에서 openGL 프로그래밍하기

'Programming > openGL' 카테고리의 다른 글

openGL state variables  (0) 2013.12.12
openGL에서 AVI 동영상 재생하기  (0) 2013.04.09
glsl과 glew의 연관관계  (0) 2011.11.22
GLSL 관련 링크  (0) 2011.11.20
GLSL 함수목록 정리  (0) 2011.11.20
Posted by 구차니
Programming/openGL2011. 11. 22. 21:04
소스들을 보면 glsl을 위해서는 항상 glew를 사용하는데
왜 사용하는지 문득 궁금해져서 뒤져보니

과거에 GLSL은 OpenGL 1.4의 extension으로 시작되었다고 한다.
그리고 ARB는 OpenGL ARB에 의해 공식적으로 승인된 Extension이라고 한다.

즉, GLSL 역시 Extention 이므로, GLEW(GL Extention Wrangler) 를 사용해서 
편리하게(?) 확장하여 사용을 하게 된다.

ARB - Extensions officially approved by the OpenGL Architecture Review Board
[링크 : http://www.opengl.org/resources/features/OGLextensions/]
[링크 : http://glew.sourceforge.net/basic.html]

Originally introduced as an extension to OpenGL 1.4, GLSL was formally included into the OpenGL 2.0 core by the OpenGL ARB.
[링크 : http://en.wikipedia.org/wiki/GLSL]
[링크 : http://en.wikipedia.org/wiki/OpenGL#Extensions


사족 : 그러고 보니. Nvidia는 Geforce 8000 이상부터 ATI는 HD 급 부터라고 한거 봐서는..
         Nvidia의 CUDA / ATI의 ATI Stream(OpenCL) 적용 하드웨어와 일치하는 느낌이 드는데..
         결국에는 GLSL은 특화된 CUDA/OpenCL 이라고 보면 되려나?

'Programming > openGL' 카테고리의 다른 글

openGL에서 AVI 동영상 재생하기  (0) 2013.04.09
openGL gcc에서 컴파일 하기  (0) 2012.06.02
GLSL 관련 링크  (0) 2011.11.20
GLSL 함수목록 정리  (0) 2011.11.20
GLSL 은.. intel 내장형으로는 무리?  (0) 2011.11.19
Posted by 구차니
Programming/openGL2011. 11. 20. 14:40
GLSL 관련 문서들 링크

개인적으로 in vec3 val, 이런게 보이길래 찾다보니
pdf 문서가 무진장 정리 잘되어 있는것 같아서 득템한기분임 ㅋㅋ

in 은 함수 안으로 들어가는 변수. 없으면 in과 비슷하다고 보면 될 듯하고
uniform은 GLSL과 어플리케이션의 변수를 공유하도록 하는 구분자이다.


[링크 : http://www.jrr.kr/entry/8-GLSL-Animation] << 펄럭이는 예제

[링크 : http://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Operations] << 벡터 업 캐스팅/다운캐스팅
[링크 : http://www.opengl.org/documentation/glsl/]
    [링크 : http://www.opengl.org/sdk/docs/tutorials/TyphoonLabs/]
        [링크 : http://www.opengl.org/sdk/docs/tutorials/TyphoonLabs/Chapter_2.pdf] << 요거 좋은듯
 [링크 : http://en.wikipedia.org/wiki/GLSL]

'Programming > openGL' 카테고리의 다른 글

openGL gcc에서 컴파일 하기  (0) 2012.06.02
glsl과 glew의 연관관계  (0) 2011.11.22
GLSL 함수목록 정리  (0) 2011.11.20
GLSL 은.. intel 내장형으로는 무리?  (0) 2011.11.19
GLSL 관련 링크  (0) 2011.11.12
Posted by 구차니
Programming/openGL2011. 11. 20. 11:27
예제소스를 보고 정리한 GLSL에서 사용하는 함수들 목록
glShaderSource()의 경우에는 파일의 내용을 직접 넣어주고
glCompileShader()를 통해 모종의 작업을 하는듯 -_-

[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml ]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glShaderSource.xml]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glAttachShader.xml]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glLinkProgram.xml]

'Programming > openGL' 카테고리의 다른 글

glsl과 glew의 연관관계  (0) 2011.11.22
GLSL 관련 링크  (0) 2011.11.20
GLSL 은.. intel 내장형으로는 무리?  (0) 2011.11.19
GLSL 관련 링크  (0) 2011.11.12
gluUnProject / glRenderMode(GL_SELECT)  (0) 2011.10.19
Posted by 구차니
Programming/openGL2011. 11. 19. 00:03
다뤄지지 않은 예외가 발생해서 이래저래 뒤적여 보는데..

OpenGL Version = '1.4.0 - Build 7.14.10.4704'
Shading Language Version = '(null)'
Warning: Your graphics card or the driver may be old.
   The next assignment will require OpenGL 3.2 and GLSL 1.50 support.
   Please change the "#version" tag to 110 in your GLSL shader file.
   Compiling shader "..\shaders\blinn_phong_vert.glsl". 

Intel 945GM 으로는 openGL 1.4만 지원하고
965나 946GZ에서나 openGL 2.1을 지원한다고 한다.
[링크 : http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=248717]

6) What NVIDIA hardware will support OpenGL 3?

The new features in OpenGL 3 require G80, or newer hardware. Thus OpenGL 3.0/3.1/3.2/3.3 is not supported on NV3x, NV4x nor G7x hardware. This means you need one of the following NVIDIA graphics accelerators to use OpenGL 3:

Desktop
Quadro FX 370, 570, 1700, 3700, 4600, 4700x2, 4800, 5600, 5800, Quadro VX200, Quadro CX
GeForce 8000 series or higher; Geforce G100, GT120, 130, 220, GTS 150, GTS 250, GT310, 320, 330, 340, GeForce GTX 260 and higher, any ION based products.
 
Notebook
Quadro FX 360M, 370M, 570M, 770M, 1600M, 1700M, 2700M, 2800M, 3600M, 3700M, 3800M
GeForce 8000 series or higher
 
[링크 : http://developer.nvidia.com/opengl-driver

OpenGL 3.2
Released on August 3, 2009 and updated on December 7, 2009.
Supported Cards: GeForce 8, GeForce 9, GeForce 100, GeForce 200 and GeForce 300 series, Radeon HD series
Features:
OpenGL Shading Language revision 1.50 (GLSL)

[링크 : http://en.wikipedia.org/wiki/OpenGL]

결론 : Intel 내장형으로는 포기하면 편해~ 라는거?

'Programming > openGL' 카테고리의 다른 글

GLSL 관련 링크  (0) 2011.11.20
GLSL 함수목록 정리  (0) 2011.11.20
GLSL 관련 링크  (0) 2011.11.12
gluUnProject / glRenderMode(GL_SELECT)  (0) 2011.10.19
glNormal()  (0) 2011.10.18
Posted by 구차니
Programming/openGL2011. 11. 12. 21:27
GLSL 샘플 코드라는데..
ARB와 openGL 2.0 버전과 차이점은 먼지 공부할게 많은듯 -_-

[링크 : http://www.lighthouse3d.com/tutorials/glsl-tutorial/setup-for-glsl-example/]

----
2011.1120 추가
Intel 945에서는 ARB 버전으로 해봐도 안된다 -_-
[링크 : http://lighthouse3d.com/wptest/wp-content/uploads/2011/03/glutglsl.zip]
-----
GLEW
[링크 : http://glew.sourceforge.net/]

공식 glsl 사이트
[링크 : http://www.opengl.org/documentation/glsl/]

쉐이더 개발 프로그램
[링크 : http://www.opengl.org/sdk/tools/ShaderDesigner/] Shader Designer
[링크 : http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx] render monkey

디버거 - glslDevil 

[링크 : http://cumbia.informatik.uni-stuttgart.de/glsldevil/]
    [링크 : http://cloudlucifer.tistory.com/entry/GLSL-디버거-발견]


튜토리얼
[링크 : http://zach.in.tu-clausthal.de/teaching/cg_literatur/glsl_tutorial/index.html]
[링크 : http://www.lighthouse3d.com/opengl/glsl/]
[링크 : http://www.clockworkcoders.com/oglsl/tutorials.html]

용어정리
ARB - OpenGL Architecture Review Board 
[링크 : http://en.wikipedia.org/wiki/OpenGL_ARB ]

'Programming > openGL' 카테고리의 다른 글

GLSL 함수목록 정리  (0) 2011.11.20
GLSL 은.. intel 내장형으로는 무리?  (0) 2011.11.19
gluUnProject / glRenderMode(GL_SELECT)  (0) 2011.10.19
glNormal()  (0) 2011.10.18
glut Menu 관련 함수들  (0) 2011.10.10
Posted by 구차니
Programming/openGL2011. 10. 19. 11:10
테스트해보지 못한 사항이지만..

gluUnProject()는 모델/투영행렬의 역행렬을 구해 화면상에 보이는 좌표의 원본 좌표를 구해주는 역활을 한다고 한다.
glRenderMode()의 경우 GL_SELECT 모드에서 모델링시에 추가한 glLoadName 을 리턴해 준다.

어떻게 보면 개체나 점(vertex)를 선택하는 방법론이지만
좌표를 얻어야 한다면 gluUnProject를 정해놓은 개체를 얻어야 한다면 glLoadName과 glRenderMode를 조합하는 것이
적정한 접근방법으로 보인다.

[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glReadPixels.xml]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/gluUnProject.xml]
    [링크 : http://blog.naver.com/nowcome/130035713309
    [링크 : http://www.gpgstudy.com/gpgiki/알려진 평면의 피킹]
 
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glRenderMode.xml]
    [링크 : http://www.opengl.org/resources/code/samples/glut_examples/examples/examples.html]
    [링크 : http://www.gpgstudy.com/forum/viewtopic.php?p=117646]
    [링크 : http://dis.dankook.ac.kr/lectures/cg11/entry/OpenGL-Picking

[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glLoadName.xml]
    [링크 : http://www.opengl.org/sdk/docs/man/xhtml/glInitNames.xml]
    [링크 : http://www.opengl.org/sdk/docs/man/xhtml/glPushName.xml]

'Programming > openGL' 카테고리의 다른 글

GLSL 은.. intel 내장형으로는 무리?  (0) 2011.11.19
GLSL 관련 링크  (0) 2011.11.12
glNormal()  (0) 2011.10.18
glut Menu 관련 함수들  (0) 2011.10.10
glutAttachMenu()의 Linux용 버그  (2) 2011.10.10
Posted by 구차니
Programming/openGL2011. 10. 18. 23:14
glNormal()은 점이나 면에 대해서 법선 벡터를 정하는 함수이다.
이러한 법선 벡터는 빛의 반사를 계산하는데 쓰이는데 설정하지 않았을 경우 기본값은 (0,0,1)로 지정이 된다.
nomalize는 단위벡터로 입력을 받는 기능인데 기본적으로 꺼져 있으나 과도하게 큰 값이 들어가면
흰색이나 검은색으로 보이기도 하니, 되도록이면 평준화 시켜서 사용하는 것이 좋을듯 하다.

void glNormal3b( GLbyte   nx,  GLbyte   ny,  GLbyte   nz);
void glNormal3d( GLdouble  nx,  GLdouble ny,  GLdouble  nz);
void glNormal3f( GLfloat   nx,  GLfloat   ny,  GLfloat   nz);
void glNormal3i( GLint   nx,  GLint   ny,  GLint   nz);
void glNormal3s( GLshort   nx,  GLshort   ny,  GLshort   nz);

void glNormal3bv( const GLbyte *   v);
void glNormal3dv( const GLdouble *   v);
void glNormal3fv( const GLfloat *   v);
void glNormal3iv( const GLint *   v);
void glNormal3sv( const GLshort *   v);

nx, ny, nz
Specify the x, y, and z coordinates of the new current normal.
The initial value of the current normal is the unit vector, (0, 0, 1).

Description

The current normal is set to the given coordinates whenever glNormal is issued. Byte, short, or integer arguments are converted to floating-point format with a linear mapping that maps the most positive representable integer value to 1.0 and the most negative representable integer value to -1.0 .

Normals specified with glNormal need not have unit length. If GL_NORMALIZE is enabled, then normals of any length specified with glNormal are normalized after transformation. If GL_RESCALE_NORMAL is enabled, normals are scaled by a scaling factor derived from the modelview matrix. GL_RESCALE_NORMAL requires that the originally specified normals were of unit length, and that the modelview matrix contain only uniform scales for proper results. To enable and disable normalization, call glEnable and glDisable with either GL_NORMALIZE or GL_RESCALE_NORMAL. Normalization is initially disabled.
 
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glNormal.xml

glNormal()은 쉐이더와 조명의 영향을 받는다.
glEnable(GL_LIGHTING)
glEnable(GL_NORMALIZE)

GL_LIGHTi
If enabled, include light i in the evaluation of the lighting equation. See glLightModel and glLight.

GL_LIGHTING
If enabled and no vertex shader is active, use the current lighting parameters to compute the vertex color or index. Otherwise, simply associate the current color or index with each vertex. See glMaterial, glLightModel, and glLight.

GL_NORMALIZE
If enabled and no vertex shader is active, normal vectors are normalized to unit length after transformation and before lighting. This method is generally less efficient than GL_RESCALE_NORMAL. See glNormal and glNormalPointer.
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glEnable.xml

glShadeModel(GL_FLAT)
glShadeModel(GL_SMOOTH)

[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glShadeModel.xml

[링크 : http://www.codeguru.com/cpp/g-m/opengl/article.php/c2681]
2011/10/13 - [이론 관련/3D 그래픽 관련] - vertex normal - 버텍스 노말

'Programming > openGL' 카테고리의 다른 글

GLSL 관련 링크  (0) 2011.11.12
gluUnProject / glRenderMode(GL_SELECT)  (0) 2011.10.19
glut Menu 관련 함수들  (0) 2011.10.10
glutAttachMenu()의 Linux용 버그  (2) 2011.10.10
GLUT에서 더블클릭은 음..  (0) 2011.10.10
Posted by 구차니
Programming/openGL2011. 10. 10. 22:29
glut의 메뉴는 context-menu용으로 우클릭을 등록해서 많이 사용하는 타입의 메뉴이다.

아래는 glut의 메뉴관련 함수들의 목록이다.
$ vi /usr/include/GL/freeglut_std.h 
443 /*
444  * Menu stuff, see freeglut_menu.c
445  */
446 FGAPI int     FGAPIENTRY glutCreateMenu( void (* callback)( int menu ) );
447 FGAPI void    FGAPIENTRY glutDestroyMenu( int menu );
448 FGAPI int     FGAPIENTRY glutGetMenu( void );
449 FGAPI void    FGAPIENTRY glutSetMenu( int menu );
450 FGAPI void    FGAPIENTRY glutAddMenuEntry( const char* label, int value );
451 FGAPI void    FGAPIENTRY glutAddSubMenu( const char* label, int subMenu );
452 FGAPI void    FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
453 FGAPI void    FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
454 FGAPI void    FGAPIENTRY glutRemoveMenuItem( int item );
455 FGAPI void    FGAPIENTRY glutAttachMenu( int button );
456 FGAPI void    FGAPIENTRY glutDetachMenu( int button ); 

사용예는 아래와 같이
menuid = glutCreateMenu(callback); 로 생성을 하고 콜백함수를 등록하며
생성된 메뉴에  glutAdd*() 함수들을 이용해 항목이나 하위 메뉴를 추가하는 형식으로 구성된다.
submenu의 경우에는 생성이 완료된 하나의 메뉴를 현재의 메뉴 아래에 추가하는 것이기 때문에
예제처럼 하위 메뉴를 먼저 생성하고 메인 메뉴를 생성한뒤 하위 메뉴를 추가해주어야 한다.
static int mainMenu, displayMenu;

void MenuCallback(int value)
{
	switch (value)
	{
		case 99:
			exit(0);
			break;

		default: 
			break;
	}
}
 
void glutinit_contextmenu()
{
	displayMenu = glutCreateMenu(MenuCallback);
		glutAddMenuEntry("Wireframe", 0);

	mainMenu = glutCreateMenu(MenuCallback);
		glutAddSubMenu("Display", displayMenu);
		glutAddMenuEntry("Exit", 99);
		glutAttachMenu(GLUT_RIGHT_BUTTON);
}
[링크 : http://linux.die.net/man/3/glutcreatemenu]
[링크 : http://linux.die.net/man/3/glutattachmenu]
[링크 : http://linux.die.net/man/3/glutaddmenuentry]
[링크 : http://linux.die.net/man/3/glutaddsubmenu]

'Programming > openGL' 카테고리의 다른 글

gluUnProject / glRenderMode(GL_SELECT)  (0) 2011.10.19
glNormal()  (0) 2011.10.18
glutAttachMenu()의 Linux용 버그  (2) 2011.10.10
GLUT에서 더블클릭은 음..  (0) 2011.10.10
openglut / freeglut 무슨 사이야?  (0) 2011.10.09
Posted by 구차니
Programming/openGL2011. 10. 10. 22:18
glutAttachMenu(GLUT_MIDDLE_BUTTON);
로 휠 클릭을 하면 메뉴가 뜨도록 해주었는데 희한한 현상이 발견되었다.

리눅스에서 발생하는 현상이고, 윈도우에서는 발생하지 않지만,
메뉴를 띄운후 메뉴가 떠있는 상태에서 
메뉴가 아닌 다른 곳에서 마우스 버튼을 눌러 조작을 할경우
무조건 GLUT_LEFT_BUTTON으로 인식하는 버그가 존재
한다.

윈도우에서는 메뉴가 떠있는 상태에서 다른 버튼을 클릭해도 키를 무시하고
메뉴를 없앤후 부터 마우스 입력을 받아 이러한 문제는 발생하지 않는다.

[링크 : http://linux.die.net/man/3/glutattachmenu]

'Programming > openGL' 카테고리의 다른 글

glNormal()  (0) 2011.10.18
glut Menu 관련 함수들  (0) 2011.10.10
GLUT에서 더블클릭은 음..  (0) 2011.10.10
openglut / freeglut 무슨 사이야?  (0) 2011.10.09
freeglut - glutMouseFunc()  (0) 2011.10.09
Posted by 구차니