GLEW_ERROR_NO_GL_VERSION的解决方法

  关于

GLenum err = glewInit();
	if (GLEW_OK != err)
		fprintf(stderr, "error initializaing GLew %s\n", glewGetErrorString(err));
返回:

      GLEW_ERROR_NO_GL_VERSION的解决方式


就是要先初始化窗体。就是要把

glutCreateWindow("ssss");


放在

GLenum err = glewInit();

以下演示的是一个代码的演示

#include<Gl/glew.h>
#include<Gl/gl.h>
#include<GL/GLU.h>
#include<Gl/glut.h>
#include<stdio.h>


int main(int argc,char**argv)
{
	glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGB);
	glutInit(&argc,argv);
	
	glutCreateWindow("ssss");

	//glm::vec4 position = glm::vec4(1, 0, 0, 1.0f);
	GLenum err = glewInit();
	if (GLEW_OK != err)
		fprintf(stderr, "error initializaing GLew %s\n", glewGetErrorString(err));
	const	GLubyte*renderer = glGetString(GL_RENDER);
	const	GLubyte *vendor = glGetString(GL_VENDOR);
	const	GLubyte *version = glGetString(GL_VERSION);
	const	GLubyte *glslVersion = glGetString(GL_SHADING_LANGUAGE_VERSION);
	GLint major, minor;
	glGetIntegerv(GL_MAJOR_VERSION, &major);
	glGetIntegerv(GL_MINOR_VERSION, &minor);
	printf("GL vendor:%s\n", vendor);
	printf("GL renderer:%s\n", renderer);
	printf("GL version(s):%s\n", version);
	printf("GL version(d):%d,%d\n", major,minor);
	printf("GL version:%s\n", glslVersion);

	return 0;
}

得到的结果:


GLEW_ERROR_NO_GL_VERSION的解决方法_第1张图片

   

你可能感兴趣的:(version)