2016-06-27 10 views
0

Ich habe Probleme, wenn ich versuche, in meinem SDL2-Projekt von gl3w wegzukommen. Der Grund, warum ich darüber nachdenke, ist einfach, weil ich bemerkt habe, dass meine Version von gl3w "glAlphaFunc" nicht enthält, aber SDL_opengl_glext.h.SDL2 und SDL_opengl_glext.h undefined external

Es scheint, ich brauche folgendes zu definieren:

#define GL_GLEXT_PROTOTYPES 
#define GLX_GLEXT_PROTOTYPES 

So, nachdem ich bemerkt SDL_opengl_glext.h existiert ich dachte, vielleicht könnte ich einfach schließen SDL_opengl.h und SDL_opengl_glext.h (wie ich auf iOS tun: SDL_opengl .h und SDL_opengles.h), aber jetzt bekomme ich Probleme mit undefinierten Externals.

Die lib Dateien, die ich zur Zeit bin Referenzierung:

opengl32.lib; GLu32.lib; SDL2.lib; SDL2main.lib; SDL2test.lib; SDL2_image.lib; SDL2_ttf.lib; SDL2_mixer.lib; libboost_filesystem -vc140-mt-1_58.lib; libboost_system-vc140-mt-1_58.lib; libpq.lib; ssleay32.lib; libeay32.lib;% (AdditionalDependencies)

Meine Frage lautet: Mit SDL2 kann ich einen Link andere Lib-Dateien, um dieses Problem zu beheben, wie verwende ich SDL_opengl_glext.h? Ich sehe keine eindeutige Dokumentation zu diesem Thema im Besonderen.

Fehler Spew:

1>emitter.obj : error LNK2019: unresolved external symbol __imp_glBindBuffer referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glBindBuffer 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glBindBuffer 
1>emitter.obj : error LNK2019: unresolved external symbol __imp_glGenBuffers referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glGenBuffers 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glGenBuffers 
1>emitter.obj : error LNK2019: unresolved external symbol __imp_glBufferData referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glBufferData 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glBufferData 
1>emitter.obj : error LNK2019: unresolved external symbol __imp_glDisableVertexAttribArray referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glDisableVertexAttribArray 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glDisableVertexAttribArray 
1>emitter.obj : error LNK2019: unresolved external symbol __imp_glEnableVertexAttribArray referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glEnableVertexAttribArray 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glEnableVertexAttribArray 
1>emitter.obj : error LNK2019: unresolved external symbol __imp_glUseProgram referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glUseProgram 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glUseProgram 
1>emitter.obj : error LNK2019: unresolved external symbol __imp_glVertexAttribPointer referenced in function "protected: virtual void __cdecl MV::Scene::Emitter::defaultDrawImplementation(void)" ([email protected]@[email protected]@@MEAAXXZ) 
1>drawable.obj : error LNK2001: unresolved external symbol __imp_glVertexAttribPointer 
1>spineMV.obj : error LNK2001: unresolved external symbol __imp_glVertexAttribPointer 
1>render.obj : error LNK2019: unresolved external symbol __imp_glActiveTexture referenced in function "public: void __cdecl MV::Shader::set(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::shared_ptr<class MV::TextureDefinition> const &,unsigned int)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glBlendFuncSeparate referenced in function "public: void __cdecl MV::Draw2D::defaultBlendFunction(void)" ([email protected]@[email protected]@QEAAXXZ) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glBlendEquationSeparate referenced in function "public: void __cdecl MV::glExtensionBlendMode::setBlendEquation(unsigned int,unsigned int)" ([email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glAttachShader referenced in function "public: class MV::Shader * __cdecl MV::Draw2D::loadShaderCode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glCompileShader referenced in function "private: void __cdecl MV::Draw2D::loadPartOfShader(unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glCreateProgram referenced in function "public: class MV::Shader * __cdecl MV::Draw2D::loadShaderCode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glCreateShader referenced in function "public: class MV::Shader * __cdecl MV::Draw2D::loadShaderCode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGetActiveUniform referenced in function "public: __cdecl MV::Shader::Shader(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,bool)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGetProgramiv referenced in function "public: __cdecl MV::Shader::Shader(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,bool)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGetShaderiv referenced in function "private: void __cdecl MV::Draw2D::validateShaderStatus(unsigned int,bool)" ([email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGetShaderInfoLog referenced in function "private: void __cdecl MV::Draw2D::validateShaderStatus(unsigned int,bool)" ([email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGetUniformLocation referenced in function "public: __cdecl MV::Shader::Shader(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,bool)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glIsProgram referenced in function "public: __cdecl MV::Shader::Shader(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,bool)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glLinkProgram referenced in function "public: class MV::Shader * __cdecl MV::Draw2D::loadShaderCode(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glShaderSource referenced in function "private: void __cdecl MV::Draw2D::loadPartOfShader(unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glUniform1i referenced in function "public: void __cdecl MV::Shader::set(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::shared_ptr<class MV::TextureDefinition> const &,unsigned int)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glUniform1fv referenced in function "public: void __cdecl MV::Shader::set(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,float)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glUniformMatrix4fv referenced in function "public: void __cdecl MV::Shader::set(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class MV::TransformMatrix const &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glBindRenderbuffer referenced in function "public: void __cdecl MV::glExtensionFramebufferObject::startUsingFramebuffer(class std::weak_ptr<class MV::Framebuffer>,bool)" ([email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glDeleteRenderbuffers referenced in function "public: __cdecl MV::Framebuffer::~Framebuffer(void)" ([email protected]@@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGenRenderbuffers referenced in function "public: class std::shared_ptr<class MV::Framebuffer> __cdecl MV::glExtensionFramebufferObject::makeFramebuffer(class MV::Point<int> const &,class MV::Size<int> const &,unsigned int,class MV::Color const &)" ([email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glRenderbufferStorage referenced in function "public: void __cdecl MV::glExtensionFramebufferObject::startUsingFramebuffer(class std::weak_ptr<class MV::Framebuffer>,bool)" ([email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glBindFramebuffer referenced in function "public: void __cdecl MV::glExtensionFramebufferObject::startUsingFramebuffer(class std::weak_ptr<class MV::Framebuffer>,bool)" ([email protected]@[email protected]@[email protected]@MV@@@[email protected]@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glDeleteFramebuffers referenced in function "public: __cdecl MV::Framebuffer::~Framebuffer(void)" ([email protected]@@[email protected]) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glGenFramebuffers referenced in function "public: class std::shared_ptr<class MV::Framebuffer> __cdecl MV::glExtensionFramebufferObject::makeFramebuffer(class MV::Point<int> const &,class MV::Size<int> const &,unsigned int,class MV::Color const &)" ([email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@Z) 
1>render.obj : error LNK2019: unresolved external symbol __imp_glFramebufferTexture2D referenced in function "public: void __cdecl MV::glExtensionFramebufferObject::startUsingFramebuffer(class std::weak_ptr<class MV::Framebuffer>,bool)" ([email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]) 
1>C:\git\MoonDog\x64\Release\M2tMLibrary.exe : fatal error LNK1120: 33 unresolved externals 

Antwort

1

So verwenden Sie OpenGL-Erweiterungen nicht. Sie müssen Erweiterungsfunktionen zur Laufzeit mit SDL_GL_GetProcAddress laden oder eine der vorhandenen opengl loaders verwenden.

Wenn Sie nur diese eine Funktion benötigen, können Sie ihren Prototyp selbst definieren oder zur Laufzeit laden. Beachten Sie, dass neuere GL-Versionen AlphaFunc verwarfen (was der Grund ist, warum gl3w es nicht hat - da es GL 3 oder höher anvisiert), so dass Sie es nicht verwenden können, wenn Sie diese Versionen als Ziel haben.

+0

Ja, das ist mir auch bekannt, und ich habe gl3w als opengl loader verwendet. Es sah so aus, als ob SDL2 einen OpenGL-Loader enthielt (das dachte ich SDL_opengl_glext.h). Ich dachte mir, dass mir ein Funktionsaufruf ähnlich wie gl3wInit() gefehlt hätte; aber war nicht sicher. Wissen Sie, was SDL_opengl_glext.h sein soll, wenn nicht opengl loading? Danke für die Köpfe auf AlphaFunc, also sollte ich das nur in meine Shader aufnehmen! Ich kann nur bei gl3w bleiben, wenn SDL2 keinen OpenGL-Loader hat, ich möchte Ihnen eine Chance geben, diesen Kommentar zu lesen, aber ich kann Ihre Antwort bisher akzeptieren – M2tM

+1

'SDL_opengl.h' und' SDL_opengl_glext.h' sind nur portable Ersatz für 'gl.h' und' glext.h'. 'glext.h' selbst wird selten verwendet, noch mehr mit' GL_GLEXT_PROTOTYPES' default aktiv (ohne es gibt es Typdefinitionen für Funktionszeiger - kann nützlich sein, wenn Sie Ihren eigenen Extension Loader schreiben). Ich bin mir ziemlich sicher, dass Sie gl3w mit SDL verwenden können, da sie sehr unterschiedliche Dinge lösen (SDL + glew ist auch sehr verbreitet). Alles, was SDL in Bezug auf das Laden von GL-Funktionen zur Verfügung stellt, ist die portierbare 'SDL_GL_GetProcAddress', aber andererseits interessiert es Sie nur, wenn Sie Extension Loader schreiben. – keltar

+0

Vielen Dank, das löscht etwas Verwirrung. Ich habe meine eigenen Extensions geladen und vor ein paar Jahren zu gl3w gewechselt, um es für mich zu machen, und ich habe nicht wieder daran gedacht, bis AlphaFunc in einem Beispiel mit Stencil Buffern kam und ich mir überlegte, wie ich diese Funktion laden könnte (was ich nicht brauche, da es sowieso veraltet ist und ich kann es in meinen Shadern machen). Danke vielmals! – M2tM