glewInit() Failed, OpenGL App - Stack Overflow
文章推薦指數: 80 %
Call glewInit once for each rendering context? or exactly once ...
Home
Public
Questions
Tags
Users
Companies
Collectives
ExploreCollectives
Teams
StackOverflowforTeams
–Startcollaboratingandsharingorganizationalknowledge.
CreateafreeTeam
WhyTeams?
Teams
CreatefreeTeam
Collectives™onStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
glewInit()Failed,OpenGLApp
AskQuestion
Asked
9years,5monthsago
Modified
2years,4monthsago
Viewed
42ktimes
10
3
I'mtryingtobuildanOpenGLAppwithglew/glfw.I'vedownloadedthebinaries,placedthemintherootofmyfolder,addedthepathstotheincludeandlibdirectoriesandtoldmyprojecttorequireglew32.lib,GLFW.libandopengl32.lib.
Ievencopiedglew32.libtotherootdirectorybecausemyprojectcouldn'tseeit.
ImustkeepallthedependenciesintheprojectdirectorysinceIwillbedistributingthis.I'mataloss.
NowwhenIrunmyprogram,itfailsatglewInit()
Thisismyimplementationsofar:
#include"Common.h"
GameEngine::GameEngine()
{
InitWithSize(1024,768);
InitInput();
}
voidGameEngine::InitWithSize(int_width,int_height)
{
try{
//InitialiseGLFW
if(!glfwInit())
throwstd::exception("FailedtoinitializeGLFW\n");
//glfwOpenWindowHint(GLFW_FSAA_SAMPLES,4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR,3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR,3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);
//OpenawindowandcreateitsOpenGLcontext
if(!glfwOpenWindow(_width,_height,0,0,0,0,32,0,GLFW_WINDOW))
throwstd::exception("FailedtoinitializeGLFW\n");
glfwSetWindowTitle("Tutorial01");
//InitializeGLEW
if(glewInit()!=GLEW_OK)
throwstd::exception("FailedtoinitializeGLEW\n");
}catch(std::system_errorconst&err){
fprintf(stdout,"SystemError:%s",err.what());
glfwTerminate();//Freeglfwifithasbeenallocated
//TryAgain
this->InitWithSize(_width,_height);
}catch(std::exceptionconst&err){
fprintf(stdout,"ExceptionFound:%s",err.what());
}catch(...){
fprintf(stdout,"UnknownExceptionOccurred\n");
}
}
voidGameEngine::InitInput()
{
//Ensurewecancapturetheescapekeybeingpressedbelow
glfwEnable(GLFW_STICKY_KEYS);
}
voidGameEngine::StartGameLoop()
{
do{
//Drawnothing,seeyouintutorial2!
//Swapbuffers
glfwSwapBuffers();
}//CheckiftheESCkeywaspressedorthewindowwasclosed
while(glfwGetKey(GLFW_KEY_ESC)!=GLFW_PRESS&&
glfwGetWindowParam(GLFW_OPENED));
}
voidGameEngine::InitTestData()
{
//Anarrayof3vectorswhichrepresents3vertices
staticconstGLfloatg_vertex_buffer_data[]={
-1.0f,-1.0f,0.0f,
1.0f,-1.0f,0.0f,
0.0f,1.0f,0.0f,
};
}
WithmyCommonHeader:
#ifndef_COMMON_H
#define_COMMON_H
//OpenGLLibraries
#defineGLEW_STATIC
//#pragmacomment(lib,"glew32.lib")
#include
延伸文章資訊
- 1C++ (Cpp) glewInit Examples - HotExamples
C++ (Cpp) glewInit - 30 examples found. These are the top rated real world C++ (Cpp) examples of ...
- 2openGL 调用glewInit()失败2022-03-21 10:00:29 - ICode9
openGL 调用glewInit()失败2022-03-21 10:00:29. openGL系列文章目录` 文章目录openGL系列文章目录前言一、glew官网二、glew库初始化调用失败1.
- 3glewInit() Failed, OpenGL App - Stack Overflow
Call glewInit once for each rendering context? or exactly once ...
- 4openGL 中的glewInit()
我的OpenGL 游戏出现了非常奇怪的错误. 我想使用着色器,但是我不能包含glew.h 文件. 我在glut.h 之前包含了glew.h,在我的init 函数中我只写了glewInit() 来...
- 5c - glewInit Segfault與GLEW 2.0 - Code Examples
"Intel GPUs don't support 3.3\n"); glfwTerminate(); return -1; } glfwMakeContextCurrent(window); ...