笔记:OpenGL SuperBible - First Program
来源:互联网 发布:王宏安 软件所 编辑:程序博客网 时间:2024/05/21 11:18
// Include the "sb6.h" header file#include "sb6.h"// Derive my_application from sb6::applicationclass my_application : public sb6::application {public: // Our rendering function void render(double currentTime) { // Simply clear the window with red static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f }; glClearBufferfv(GL_COLOR, 0, red); }};// Our one and only instance of DECLARE_MAINDECLARE_MAIN(my_application);
注解:
1、函数 glClearBufferfv 原型:
void glClearBufferfv(GLenum buffer,GLint drawBuffer,const GLfloat * value);glClearBufferfv() tells OpenGL to clear the buffer specifiedby the first parameter (in this caseGL_COLOR) to the value specified in itsthird parameter. The second parameter, drawBuffer, is used when there are multiple output buffers that could be cleared. Because we’re only using one here and drawBufferis a zero-based index, we’ll just set it to zero in this example.
2、currentTime:
the number ofseconds since the application was started, and we can use it to create asimple animation.
The following example use it to change colour for clearing the window:
Animating color over time:
// Our rendering functionvoid render(double currentTime) {const GLfloat color[] = { (float)sin(currentTime) * 0.5f + 0.5f, (float)cos(currentTime) * 0.5f + 0.5f, 0.0f, 1.0f }; glClearBufferfv(GL_COLOR, 0, color);}
0 0
- 笔记:OpenGL SuperBible - First Program
- 笔记:OpenGL SuperBible - First Triangle
- OpenGL Superbible 7 02 Our First OpenGL Program
- 笔记:OpenGL SuperBible - overview
- 笔记:OpenGL SuperBible - Intro
- 笔记:OpenGL SuperBible - Shaders
- 笔记:OpenGL SuperBible - Tessellation
- OpenGL SuperBible阅读笔记
- 笔记:OpenGL SuperBible - Shaders 2
- Your First OpenGL Program
- OpenGL SuperBible
- OpenGL SUPERBIBLE Fifth Edition 学习笔记1
- 学习OpenGL笔记(1.1)——first program: entering main
- My first OPENGL little program
- opengl superbible第一个程序
- OpenGL Superbible 7 01 Introduction
- Opengl SuperBible 7th摘抄
- openGL SuperBible 7th 初编译
- Struts2中指定的校验文件不起作用的原因
- Begins and tests
- Android学习之surfaceview(一)
- hdu 5030(2014广州网络赛)后缀数组+二分!
- warning: control reaches end of non-void function [-Wreturn-type]
- 笔记:OpenGL SuperBible - First Program
- 关于二进制补码
- 数据表损坏的修复方法(终极完美版!!!!!)
- 中缀表达式求值
- java学习二十四 java循环语句do while
- 《Java 解惑》 第二章 表达式之谜
- Android应用---小火箭Rocket
- RED5 Plugin 及 RED5 Application在Eclipse中的调试
- C++ Primer 第五版 中文版 练习 13.14&13.15&14.16&14.17 个人code