perfect329

导航

 

OpenGL 常用的库

0. GL:OpenGL的底层函数库,并没有包含打开窗口,捕获鼠标键盘事件的函数。使用前缀gl,需要include<GL/gl.h>

1. GLU:利用底层的OpenGL函数来执行一些特定的任务,该函数都是用前缀glu, 需要include<GL/glu.h>

2. WGL: Microsoft Windows 下的函数库,用来支持OpenGL渲染,该函数都使用前缀wgl,需要include<windows.h>

3. GLUT:是一个独立于窗口系统的工具包,目的是隐藏不同窗口系统API所带来的复杂性。可以创建窗口,捕获鼠标键盘事件,并且可创建复杂的三维物体。可作为学习的起点。Freeglut就是GLUT的开源实现。include<freeglut.h>

4. 各硬件新特性:需要在www.opengl.org/registry下下载,引用方式 #include “glext.h”

5. 指定OpenGL版本: 引用方式include<GL3/gl3.h>

6. GLEW: OpenGL Extension Wrangler

 

GLUT的完成绘制图像的主要函数

1. glutInit()

2. glutInitDisplayMode 指定RGBA模式还是颜色索引模式,单缓冲还是双缓冲模式等。

3. glutInitWindowPosition

4. gluInitWindowSize

5. glutInitContextVersion 声明使用的OpenGL版本

6. glutInitContextFlags 向下兼容使用

7. glutDispayFunc 设定ReDraw的回调函数。usually, use glClear color and then draw the content.

8. glutPostRedisplay, trigger glutMainLoop to envoke the display callback function

9. glutMainLoop, begin to draw the content.

10. glutCreateWindow, popup a window to display the content.

 

Is there any way to provide a window handle?

Is there any way to get something like idc to draw anything you like in the current window?

Does it easy to make the display in WPF window and calculate in c++ code?

 

 

How to redraw smoothly?

1. use double buffer mode

2. draw the frame, than swap the buffer.

What happens if the windows size is changed?

1. use flutReshapeFunc to callback

posted on 2014-06-05 20:59  perfect329  阅读(330)  评论(0)    收藏  举报