Opengl SuperBible 7th摘抄

本文摘自OpenGL SuperBible,主要讲解第五章关于数据的操作,包括缓冲对象的创建、绑定、内存分配、数据加载和更新。重点介绍了glBufferStorage、glNamedBufferStorage等函数,以及glMapBuffer和glMapBufferRange用于直接内存映射。同时提到了OpenGL中数据如何从缓冲对象传输到顶点属性,以及统一块的概念。在第四章中,涉及3D图形的数学知识,如向量、归一化、点乘、叉乘,以及矩阵变换、投影等概念。第三章阐述了OpenGL管线的工作原理,从顶点着色器、细分着色器、几何着色器到光栅化和片段着色器的流程,以及视口设置、裁剪等。
摘要由CSDN通过智能技术生成


OpenGL SuperBible学习
第五章
Data

1. void glCreateBuffers(GLsizei n, GLuint* buffers);
buffers is the address of the variable or variables that will be used to store the names of the buffer objects.

2. void glBindBuffer(GLenum target, GLuint buffer);

3. The functions that are used to allocate memory using a buffer object are glBufferStorage() and glNamedBufferStorage(). Their protetypes are
void glBufferStorage(GLenum target, GLsizeptr size, const void* data, GLbitfield flags);
void glNamedBufferStorage(GLuint uffer, GLsizeptr size, const void* data, GLbitfield flags);

4. To be clear, the contents of the buffer object's data store can be changed, but its size or usage flags may not.

5. There are a handful of ways to get dat into the buffer object.

6. Had we instead supplied a pointer to some data, that data would have been used to initialize the buffer object. Using this pointer ,however, allow us to set only the initial data to be stored in the buffer.

7. void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
void glNameBufferSubData(Gluint buffer, GLintptr offset, GLsizeiptr size, const void* data);

8. void* glMapBuffer(GLenum target, GLenum usage);
void* glMapNamedBuffer(GLuint buffer, GLenum usage);
one that affects the buffer bound to one fo the targets of the current context, and one that operates directly on a buffer whose name you specify.

9. If you map a buffer, you can simply read the contents of the file directly into the mapped buffer.

10. void* glMapBufferRange(GLenum target, GLintptr offset, GLsizeptr length, GLbitfield access);
void* glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
These functions, rather than mapping the entire buffer object map only a specific range of the buffer object.

11. However, because of the additional control and stronger contract provided by glMapBufferRange() and glMapNamedBufferRange(), it is generally preferred to call these functions rather than glMapNamedBuffer().


12. glClearBufferSubData -- glClearNamedBufferSubData
glCopyBufferSubData -- glCopyNamedBufferSubData

13. To tell OpenGL which buffer object our data is in and where in that buffer object the data resides, we use the glVertexArrayVertexBuffer() function to bind a buffer to one of the vertex buffer bindings. We use the glVertexArrayAttribFormat() function to describe the layout and format of the data, and finally we enable automatic filling of the attribute by calling glEnableVertexAttribArray().

14. OpenGL allows you to combine a group of uniforms into a uniform block and store the whole block in a
OpenGL SuperBible: Comprehensive Tutorial and Reference 5th Edition 1008 pages Publisher: Addison-Wesley Professional; 5 edition (August 2, 2010) Language: English ISBN-10: 0321712617 ISBN-13: 978-0321712615 OpenGL® SuperBible, Fifth Edition is the definitive programmer’s guide, tutorial, and reference for the world’s leading 3D API for real-time computer graphics, OpenGL 3.3. The best all-around introduction to OpenGL for developers at all levels of experience, it clearly explains both the API and essential associated programming concepts. Readers will find up-to-date, hands-on guidance on all facets of modern OpenGL development, including transformations, texture mapping, shaders, advanced buffers, geometry management, and much more. Fully revised to reflect ARB’s latest official specification (3.3), this edition also contains a new start-to-finish tutorial on OpenGL for the iPhone, iPod touch, and iPad. Coverage includes • A practical introduction to the essentials of real-time 3D graphics • Core OpenGL 3.3 techniques for rendering, transformations, and texturing • Writing your own shaders, with examples to get you started • Cross-platform OpenGL: Windows (including Windows 7), Mac OS X, GNU/Linux, UNIX, and embedded systems • OpenGL programming for iPhone, iPod touch, and iPad: step-by-step guidance and complete example programs • Advanced buffer techniques, including full-definition rendering with floating point buffers and textures • Fragment operations: controlling the end of the graphics pipeline • Advanced shader usage and geometry management • A fully updated API reference, now based on the official ARB (Core) OpenGL 3.3 manual pages • New bonus materials and sample code on a companion Web site, www.starstonesoftware.com/OpenGL Part of the OpenGL Technical Library–The official knowledge resource for OpenGL developers The OpenGL Technical Library provides tutorial and reference books for OpenGL. The Library enables programmers to gain a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值