* frame buffer 는 3개의 render buffer 를 가지고 있다.
(frame buffer = color render buffer + depth render buffer + stencil render buffer)
* render buffer 생성
glGenRenderbuffers(1, &_renderBufferColor);
glBindRenderbuffer(GL_RENDERBUFFER, _renderBufferColor);
glGenRenderbuffers(1, &_renderBufferDepth);
glBindRenderbuffer(GL_RENDERBUFFER, _renderBufferDepth);
* frame buffer 생성
GLuint frame_buffer;
glGenFramebuffers(1, &frame_buffer);
glBindFramebuffer(GL_FRAMEBUFFER, frame_buffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _renderBufferDepth);
* VBO
// vertex buffer
GLuint vertexBuffer;
glGenBuffers(1, &vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glVertexAttribPointer(_attribLocation_Position, 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat), 0);
// texture buffer
GLuint textureBuffer;
glGenBuffers(1, &textureBuffer);
glBindBuffer(GL_ARRAY_BUFFER, textureBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(Textures), Textures, GL_STATIC_DRAW);
glVertexAttribPointer(_attribLocation_Texture, 2, GL_FLOAT, GL_FALSE, 2*sizeof(GLfloat), 0);
// index buffer
GLuint indexBuffer;
glGenBuffers(1, &indexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);
'OpenGLES 초보' 카테고리의 다른 글
[번역] TyphoonLabs' OpenGL Shading Language tutorials. Chapter1 (0) | 2015.09.15 |
---|---|
[번역] All about OpenGL ES 2.x - (part 2/3) (0) | 2014.11.25 |
[번역] OpenGL Tutorial for iOS: OpenGL ES 2.0 (1) | 2014.10.31 |
OpenGL Shader Builder. mac (0) | 2014.10.28 |
blender, Smart UV Project (0) | 2014.07.04 |