lab1 코드 실행하고 실행 및 코드분석 리포트 (init() & draw() 함수 중심으로, 장수 제한 없음. 그리고 본인의 geometry primitive를 추가한다. (Due by 9/21)
-triangle
-square
-circle (primitive type)
-indexed square
–your geometry (eg. star, flower) 추가
Just another Kyoung Shin Park's Lectures Sites site
lab1 코드 실행하고 실행 및 코드분석 리포트 (init() & draw() 함수 중심으로, 장수 제한 없음. 그리고 본인의 geometry primitive를 추가한다. (Due by 9/21)
-triangle
-square
-circle (primitive type)
-indexed square
–your geometry (eg. star, flower) 추가
glVertexAttribPointer — define an array of generic vertex attribute data
https://www.opengl.org/sdk/docs/man/html/glVertexAttribPointer.xhtml
void glVertexAttribPointer( |
GLuint index, |
GLint size, | |
GLenum type, | |
GLboolean normalized, | |
GLsizei stride, | |
const GLvoid * pointer) ; |
index
size
GL_BGRA
is accepted by glVertexAttribPointer
. The initial value is 4.type
GL_BYTE
, GL_UNSIGNED_BYTE
, GL_SHORT
, GL_UNSIGNED_SHORT
, GL_INT
, and GL_UNSIGNED_INT
are accepted by glVertexAttribPointer
and glVertexAttribIPointer
. Additionally GL_HALF_FLOAT
, GL_FLOAT
, GL_DOUBLE
, GL_FIXED
, GL_INT_2_10_10_10_REV
, GL_UNSIGNED_INT_2_10_10_10_REV
and GL_UNSIGNED_INT_10F_11F_11F_REV
are accepted by glVertexAttribPointer
. GL_DOUBLE
is also accepted by glVertexAttribLPointer
and is the only token accepted by the type
parameter for that function. The initial value is GL_FLOAT
.normalized
glVertexAttribPointer
, specifies whether fixed-point data values should be normalized (GL_TRUE
) or converted directly as fixed-point values (GL_FALSE
) when they are accessed.stride
stride
is 0, the generic vertex attributes are understood to be tightly packed in the array. The initial value is 0.pointer
GL_ARRAY_BUFFER
target. The initial value is 0.
lecture4-ch2
lecture3-ch2
lecture2-opengl
http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-1:-The-Graphics-Pipeline.html
Modern OpenGL (OpenGL 3.x) 프로그래밍은 다음과 같은 단계로 진행한다.
1.Shader 프로그램을 만든다.
2.Vertex 자료를 Vertex Buffer Object (VBO)와 Vertex Array Object (VAO)를 만들고 이 자료를 쉐이더에 로딩한다.
3.이 자료의 위치와 쉐이더의 변수와 “연결(Connect)” 한다.
4.렌더링을 수행한다.
Windows7 이상 운영체제에서 Visual Studio 2017과 OpenGL 3.x 이상을 지원하는 그래픽카드 드라이버가 설치되어 있어야 합니다.
1. freeglut는 아래 파일을 다운 받아 unzip해 주어야 합니다.
http://freeglut.sourceforge.net/
압축을 풀어보면 include, lib, system32 세 개의 폴더가 있습니다.
C:\………\freeglut-MSVC-3.0.0-2.mp\freeglut\include\GL
freeglut.h freeglut_ext.h freeglut_std.h glut.h
C:\………\freeglut-MSVC-3.0.0-2.mp\freeglut\lib
freeglut.lib
C:\………\freeglut-MSVC-3.0.0-2.mp\freeglut\bin
freeglut.dll
2. glew는 아래 파일을 다운 받아 unzip해 주어야 합니다.
http://glew.sourceforge.net/
압축을 풀어보면 include, lib, system32 세 개의 폴더가 있습니다.
C:\………\glew-2.0.0-win32\glew-2.0.0\include\GL
glew.h glxew.h wglew.h
C:\………\glew-2.0.0-win32\glew-2.0.0\lib\Release\Win32
glew32.lib glew32s.lib
C:\………\glew-2.0.0-win32\glew-2.0.0\lib\Release MX\Win32
glew32mx.lib glew32mxs.lib
C:\………\glew-2.0.0-win32\glew-2.0.0\bin\Release\Win32
glew32.dll
C:\………\glew-2.0.0-win32\glew-2.0.0\bin\Release MX\Win32
glew32mx.dll
3. glm는 아래 파일을 다운 받아 unzip해 주어야 합니다.
https://github.com/g-truc/glm/releases
C:\………..\glm-0.9.8.4\glm 안에 glm 디렉토리 전체를 복사
4. Microsoft SDKs가 있는 디렉토리의 Include와 Lib 폴더에 *.h와 *.lib을 넣는다.
5. Windows\system32 폴더에 *.dll을 넣는다.
6. 세팅이 모두 끝나면, 프로젝트를 Win32 Console로 생성(File->New->Project, 템플렛에서 Win32->Win32 Console Application을 선택하고 <your project name>을 넣는다)하고, 아래의 소스를 넣어 컴파일, 실행해 봅니다.
7. 이때, opengl32.lib glu32.lib glut32.lib 라이브러리 링크를 걸어줍니다.
Project->Properties(ALT+F7)->Configuration Properties탭->Linker탭->Input탭에 Additional Dependencies에 “glew32.lib;freeglut.lib”를 넣는다.
8. 컴파일/링크(Build)(F7)후 실행(Debug)(F5)시켜서 하얀색화면의 윈도우가 뜨면 완성된 것입니다.