Programming/openGL2011. 3. 25. 22:23

The Red Book 중 포함된 파일




GL_POINTS
 


GL_LINES


GL_LINE_STRIP


GL_LINE_LOOP


GL_TRIANGLES


GL_TRIANGLE_STRIP


GL_TRIANGLE_FAN


GL_QUADS


GL_QUAD_STRIP


GL_POLYGON


음.. 점 4개로는 티가 안나네 -_-

[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glEnd.xml]
Posted by 구차니
Programming/openGL2011. 3. 25. 22:06
glortho() 함수는 화면상의 좌표축을 설정하는 함수이다.
#include "windows.h"
#include "GL/gl.h"
#include "GL/glut.h"

void display(void)
{
/*  clear all pixels  */
    glClear (GL_COLOR_BUFFER_BIT);
/*  draw white polygon (rectangle) with corners at
 *  (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)  
 */
    glColor3f (1.0, 1.0, 1.0);
    glBegin(GL_POLYGON);
        glVertex3f (0.25, 0.25, 0.0);
        glVertex3f (0.75, 0.25, 0.0);
        glVertex3f (0.75, 0.75, 0.0);
        glVertex3f (0.25, 0.75, 0.0);
    glEnd();
/*  don’t wait!  
 *  start processing buffered OpenGL routines 
 */
    glFlush ();
}
void init (void) 
{
/*  select clearing (background) color       */
    glClearColor (0.0, 0.0, 0.0, 0.0);
/*  initialize viewing values  */
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
/* 
 *  Declare initial window size, position, and display mode
 *  (single buffer and RGBA).  Open window with "hello"
 *  in its title bar.  Call initialization routines.
 *  Register callback function to display graphics.
 *  Enter main loop and process events.
 */
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250); 
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("hello");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;   /* ISO C requires main to return int. */
}

glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); 로 설정할 경우의 결과


glOrtho(0.0, 2.0, 0.0, 2.0, -2.0, 2.0); 로 설정할 경우의 결과

대충 정리하자면, 아래 그림과 같다고 할까나~?!


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

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

freeglut  (0) 2011.03.26
openGL - glbegin()  (2) 2011.03.25
visual Studio에서 openGL 돌리기  (0) 2011.03.16
윈도우에서 opengl.dll을 찾을 수 없다고 할 경우  (0) 2011.03.15
GLUT(openGL Utility Toolkit) 다운로드 (윈도우)  (0) 2011.03.15
Posted by 구차니
Programming/openGL2011. 3. 16. 21:55
프로젝트 링커에서는 되도록이면
opengl32.lib glut32.lib glu32.lib 세가지 모두 넣어주는게 속이 편하다.


glut32.dll ->C:\Windows\System32
glut32.lib ->C:\program files\microsoft visual studio 8\vc\platformsdk\lib
glut32.h ->...\vc\platformsdk\include\gl

opengl32.lib glu32.lib glut32.lib

[링크 : http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=220142] 

만약 glu32.lib를 하지 않으면 일부 glu를 사용하는 프로그램에서 다음과 같은 에러가 발생한다.
1>bigtest.obj : error LNK2019: _gluLookAt@72 외부 기호(참조 위치: _gfxInit 함수)에서 확인하지 못했습니다.
1>bigtest.obj : error LNK2019: _gluPerspective@32 외부 기호(참조 위치: _gfxInit 함수)에서 확인하지 못했습니다.
1>bigtest.obj : error LNK2019: _gluOrtho2D@32 외부 기호(참조 위치: _showText 함수)에서 확인하지 못했습니다.
1>C:\Documents and Settings\user\바탕 화면\openGL\openGL\Debug\openGL.exe : fatal error LNK1120: 3개의 확인할 수 없는 외부 참조입니다. 

[링크 : http://thoughtsfrommylife.com/article-748-OpenGL_and_Visual_Studio_Express_2008]
[링크 : http://doctory.egloos.com/10521013]
[링크 : http://www.mrmoen.com/2008/03/30/opengl-with-visual-c-express-edition/]




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

openGL - glbegin()  (2) 2011.03.25
openGL - glortho()  (4) 2011.03.25
윈도우에서 opengl.dll을 찾을 수 없다고 할 경우  (0) 2011.03.15
GLUT(openGL Utility Toolkit) 다운로드 (윈도우)  (0) 2011.03.15
openGL tutorial  (0) 2011.03.12
Posted by 구차니
Programming/openGL2011. 3. 15. 23:21
"opengl.dll을 찾을 수 없으므로 응용 프로그램을 시작하지 못했습니다."
라는 에러가 발생하면 윈도우에서는 아래와 같이 glut.lib를 링크했을 경우이다.
glut.lib / glut.dll 은 sgi 용이라서 윈도우에서 하려면
glut32.lib / glut32.dll 을 링크해야 한다고 한다.



---
2011.03.16 추가
아마도 위에서는 opengl32.lib를 링킹해주지 않아서 발생한 에러로 추측된다.
자세한 링크 정보와 복사경로는 아래의 문서 참조
2011/03/16 - [Programming/openGL] - visual Studio에서 openGL 돌리기
---

[링크 : http://pcsupport.about.com/od/findbyerrormessage/a/opengl-dll-not-found-missing-error.htm]

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

openGL - glortho()  (4) 2011.03.25
visual Studio에서 openGL 돌리기  (0) 2011.03.16
GLUT(openGL Utility Toolkit) 다운로드 (윈도우)  (0) 2011.03.15
openGL tutorial  (0) 2011.03.12
openGL, GLU, GLUT 관계  (4) 2011.03.07
Posted by 구차니
Programming/openGL2011. 3. 15. 23:01
필요한 녀석은 glutdll3x.zip 하나이다.
GL/gl.h 나 GL/glu.h 는 OS에 포함되어 있거나 그래픽 카드 벤더에서 제공을 하고 있으므로
그리 신경을 안써도 된다는데, Visual Studio 2008의 경우
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl 경로에 기본적으로 포함을 하고 있다.

그리고
glut.h는 C:\Program Files\Microsoft Visual Studio 9.0\VC\include\GL이나
            C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl
glut.lib는 C:\Program Files\Microsoft Visual Studio 9.0\VC\lib 에 복사한다.

[링크: http://www.opengl.org/resources/libraries/glut/glut_downloads.php#windows]
    [링크 : http://www.opengl.org/resources/libraries/glut/glut36.zip]  
    [링크 : http://www.opengl.org/resources/libraries/glut/glutdlls36.zip] << 다운로드
    [링크 : http://www.opengl.org/resources/libraries/glut/glut36data.zip]

    [링크 : http://www.opengl.org/resources/libraries/glut/glut37.zip]
    [링크 : http://www.opengl.org/resources/libraries/glut/glut37data.zip] << 다운로드
    [링크 : http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip]

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

visual Studio에서 openGL 돌리기  (0) 2011.03.16
윈도우에서 opengl.dll을 찾을 수 없다고 할 경우  (0) 2011.03.15
openGL tutorial  (0) 2011.03.12
openGL, GLU, GLUT 관계  (4) 2011.03.07
openGL - GLUT  (0) 2010.08.26
Posted by 구차니
Programming/openGL2011. 3. 12. 21:39
하아.. 언넝 따라해보면서 습득을 해야지 ㅠ.ㅠ


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

윈도우에서 opengl.dll을 찾을 수 없다고 할 경우  (0) 2011.03.15
GLUT(openGL Utility Toolkit) 다운로드 (윈도우)  (0) 2011.03.15
openGL, GLU, GLUT 관계  (4) 2011.03.07
openGL - GLUT  (0) 2010.08.26
glBegin() / glEnd()  (3) 2010.08.23
Posted by 구차니
Programming/openGL2011. 3. 7. 09:57
문서를 찾아봐도 딱히 연관관계에 관한 내용이 없어서 대충 끄적끄적 정리 -_-


openGL은 렌더링에 관련된 라이브러리로 내부에 정해진 쉐이더가 존재한다.(라고 하는데 알리가 없잖아 -_-)
이러한 쉐이더를 제어할 수 있는 녀석이 GLSL(Graphic Library Shader Language)이고
이를 편하게 하기 위해 만들어 진것이 GLEW(GL extension Wrangler Library) 이다.

그리고 openGL에 그리거나 조작을 할 수 있는 함수가
GLU(GL Utility library) 이고, GLU/GL에는 키보드나 마우스 등의 입력에 관한 처리가 없으므로
이를 처리해서 통합적으로 관리해주는 것이 GLUT(GL Utility Toolkit) 이다.

아무튼 GLUT의 경우에는 OS에 따른 플랫폼을 포함하므로 openGL과 GLUT사이에는
GLX(GL extension for unix/Linux Xwindow) 혹은 WGL(GL extension for Microsoft Windows)가 존재할 듯?
XGL은 GLX를 지원하는 Xserver라고 한다.



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

GLUT(openGL Utility Toolkit) 다운로드 (윈도우)  (0) 2011.03.15
openGL tutorial  (0) 2011.03.12
openGL - GLUT  (0) 2010.08.26
glBegin() / glEnd()  (3) 2010.08.23
openGL 문서들  (0) 2010.08.22
Posted by 구차니
Programming/openGL2010. 8. 26. 15:34
GLUT는 openGL Utility Toolkit 의 약자이다.

원래는 openGL에서 글씨를 쓰는 예제를 찾으려 했는데,
찾다보니 openGL 에서 순수하게 그리는 건,

glBitmap()으로 폰트 이미지를 넘기는 식으로 밖에 없었고
glBitmapCharater() 라는 것은 GLUT에서 지원한다고 되어 있었다.
[링크 : http://www.videotutorialsrock.com/opengl_tutorial/draw_text/home.php]
[링크 : http://www.opengl.org/documentation/specs/glut/]
    [링크 : http://www.opengl.org/documentation/specs/glut/spec3/spec3.html]
    [링크 : http://www.opengl.org/resources/libraries/glut/spec3/spec3.html]
[링크 : http://www.xmission.com/~nate/glut.html]

glFontTextOut() 이라는 녀석도 발견했는데, GLUT 처럼 별도의 helper API로 생각된다.
[링크 : http://www.daniweb.com/forums/thread29134.html]
    [링크 : http://students.cs.byu.edu/~bfish/glfontdl.php]



하아.. openGL 개발환경은 왜이리 잡아놓기가 귀찮지 -ㅁ-

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

openGL tutorial  (0) 2011.03.12
openGL, GLU, GLUT 관계  (4) 2011.03.07
glBegin() / glEnd()  (3) 2010.08.23
openGL 문서들  (0) 2010.08.22
openGL  (4) 2010.08.18
Posted by 구차니
Programming/openGL2010. 8. 23. 22:34
openGL에서 선이나 점, 면을 그릴때에는
 glBegin();
 glEnd();
사이에 값을 넣어준다.

glBegin()과 glEnd()의 프로토타입은 아래와 같으며,
glBegin()의 경우 데이터를 처리할 방법에 대해서 정해준다.
void glBegin(GLenum mode);
    GL_POINTS,
    GL_LINES,
    GL_LINE_STRIP,
    GL_LINE_LOOP,
    GL_TRIANGLES,
    GL_TRIANGLE_STRIP,
    GL_TRIANGLE_FAN,
    GL_QUADS,
    GL_QUAD_STRIP, and
    GL_POLYGON.

void glEnd(void);

Only a subset of GL commands can be used between glBegin and glEnd.
            The commands are
            glVertex, glColor, glSecondaryColor, glIndex, glNormal, glFogCoord, glTexCoord, glMultiTexCoord,
            glVertexAttrib, glEvalCoord, glEvalPoint, glArrayElement, glMaterial, and glEdgeFlag.
            Also, it is acceptable to use glCallList or glCallLists to execute
            display lists that include only the preceding commands.
            If any other GL command is executed between glBegin and glEnd,
            the error flag is set and the command is ignored.

[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glBegin.xml]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glEnd.xml] glBegin으로 링크 변경됨

아래의 소스처럼 glBegin()과 glEnd() 사이에 값을 넣어주면,
그림처럼 openGL에서 glBegin()의 값을 이용하여 점/선/면을 처리하게 된다.
여기서는 GL_POLYGON 이므로 5개의 점으로 이루어진 하나의 면이 나타나게 된다.
glBegin(GL_POLYGON);
   glVertex2f(0.0, 0.0);
   glVertex2f(0.0, 3.0);
   glVertex2f(3.0, 3.0);
   glVertex2f(4.0, 1.5);
   glVertex2f(3.0, 0.0);
glEnd();


[링크 : http://fly.cc.fer.hr/~unreal/theredbook/chapter02.html]

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

openGL tutorial  (0) 2011.03.12
openGL, GLU, GLUT 관계  (4) 2011.03.07
openGL - GLUT  (0) 2010.08.26
openGL 문서들  (0) 2010.08.22
openGL  (4) 2010.08.18
Posted by 구차니
Programming/openGL2010. 8. 22. 21:42
openGL 에는 책이 두권이 있다.
하나는 빨간책(Red Book) 다른 하나는 파란책(Blue Book)이다.



대부분의 국내서점에서 한글판은 절판이고, 영문판은 6만원에 육박한다.
그리고 버전도 여러가지라서 참으로 헷갈려서, 도무지 어느 녀석을 사야할지 모호하다.

2010.08.22 일 기준으로, openGL은 4.0 까지 나와있으므로
openGL 3.0 을 이야기 하고있는, 7th edition을 구매하면 될 것으로 생각된다.

[도서]
OpenGL 프로그래밍 가이드 : OpenGL 1.2 공식 학습 가이드 (3)
OpenGL 프로그래밍 가이드 : OpenGL 1.4 공식 학습 가이드 (4판)

[외서]
Opengl Programming Guide : The Official Guide To Learning Opengl, Version 2 (Paperback, 5/E)
OpenGL Programming Guide : The Official Guide to Learning OpenGL, Version 2.1 (Paperback, 6th Edition)
Opengl Programming Guide : The Official Guide to Learning OpenGL, Versions 3.0 and 3.1 (Paperback, 7th Edition)

[출처 : www.yes24.com opengl 키워드]

[링크 : http://www.opengl.org/documentation/specs/]
[링크 : http://fly.cc.fer.hr/~unreal/theredbook/]
    [링크 : http://fly.cc.fer.hr/~unreal/theredbook/theredbook.zip] << red book html download
[링크 : http://www.opengl.org/documentation/]
    [링크 : http://alien.dowling.edu/~vassil/theredbook/] << red book
    [링크 : http://alien.dowling.edu/~vassil/thebluebook/] << blue book

2010.08.23 추가
[링크 : http://www.opengl.org/sdk/docs/man/] API manpage

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

openGL tutorial  (0) 2011.03.12
openGL, GLU, GLUT 관계  (4) 2011.03.07
openGL - GLUT  (0) 2010.08.26
glBegin() / glEnd()  (3) 2010.08.23
openGL  (4) 2010.08.18
Posted by 구차니