设为首页 加入收藏

TOP

OpenGL ES 3.0之顶点缓冲(二)
2015-11-10 13:45:02 来源: 作者: 【 】 浏览:10
Tags:OpenGL 3.0 顶点 缓冲

? ? ?
? glVertexAttribPointer(? ? ? ? ? // STEP 5
? ? ? GLKVertexAttribPosition,
? ? ? 3,? ? ? ? ? ? ? ? ? // three components per vertex
? ? ? GL_FLOAT,? ? ? ? ? ? // data is floating point
? ? ? GL_FALSE,? ? ? ? ? ? // no fixed point scaling
? ? ? sizeof(SceneVertex), // no gaps in data
? ? ? NULL);? ? ? ? ? ? ? // NULL tells GPU to start at
? ? ? ? ? ? ? ? ? ? ? ? ? // beginning of bound buffer
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? // Draw triangles using the first three vertices in the
? // currently bound vertex buffer
? glDrawArrays(GL_TRIANGLES,? ? ? // STEP 6
? ? ? 0,? // Start with first vertex in currently bound buffer
? ? ? 3); // Use three vertices from currently bound buffer
}



/////////////////////////////////////////////////////////////////
// Called when the view controller's view has been unloaded
// Perform clean-up that is possible when you know the view
// controller's view won't be asked to draw again soon.
- (void)viewDidUnload
{
? [super viewDidUnload];
?
? // Make the view's context current
? GLKView *view = (GLKView *)self.view;
? [EAGLContext setCurrentContext:view.context];
? ?
? // Delete buffers that aren't needed when view is unloaded
? if (0 != vertexBufferID)
? {
? ? ? glDeleteBuffers (1,? ? ? ? ? // STEP 7
? ? ? ? ? ? ? ? ? ? ? &vertexBufferID);?
? ? ? vertexBufferID = 0;
? }
?
? // Stop using the context created in -viewDidLoad
? ((GLKView *)self.view).context = nil;
? [EAGLContext setCurrentContext:nil];
}


@end



-------------------------------------分割线-------------------------------------


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Java 构造函数内部的多态方法 完.. 下一篇Java对象初始化

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: