测试代码如下
#include "gl/glew.h"
#include "gl/freeglut.h"
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutCreateWindow("GLEW Test");//get an openGL context
GLenum err = glewInit();
if (err != GLEW_OK )
{
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
exit (-2);
}
//openGL生产商及版本
const char* vendorName = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
const char* version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
//是否支持某个扩展
bool isSupport = glewIsSupported("GL_EXT_framebuffer_object"); //是否支持帧缓冲
int NumberOfExtensions;
glGetIntegerv(GL_NUM_EXTENSIONS, &NumberOfExtensions);
for(int i=0; i<NumberOfExtensions; i++)
{
const GLubyte *ccc=glGetStringi(GL_EXTENSIONS, i);
//Now, do something with ccc
cout << ccc << endl;
}
system("pause");
return 0;
}