Open PonchoBob opened 5 years ago
With your include of GLFW/glfw3.h
, the glfw3 library tries to provide OpenGL symbols as well.
You can tell glfw3 that this should nat happen using the compile-time definition GLFW_INCLUDE_NONE
.
We have this constant in use within all of our examples (e.g., https://github.com/cginternals/globjects/blob/master/source/examples/texture/CMakeLists.txt#L94)
A quick fix for you may be the following:
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
Hello, and thank you very much for your fast reply. I didn't know about this GLFW define. According to my second question... I had a closer look at glfwGetProcAddress and make it work for my own use case where the opengl context has not been created by glfw. In a windows world, the solution here is, that glfwGetProcAddress returns a function pointer from wglGetProcAddress or from GetProcAddress. This should be considered when providing other "getProcAddr" functions to the globjects::init function.
kind regards, PonchoBob
It seems like I missed your second question. The actual line of the compiler error would help to provide a minimal solution. However, introducing reinterpret casts should do the trick:
// Omitting includes here
globjects::init([](const char* name)
{
return reinterpret_cast<glbinding::GetProcAddress>(wglGetProcAddress(name));
});
If you create your context using GLFW, you can use the initialization routine from the globjects examples:
// Omitting includes here
globjects::init([](const char * name) {
return glfwGetProcAddress(name);
});
The idea of the function pointer you pass to globjects/glbinding is to be such a wrapper function you suggested.
Hello, I'm new to globjects and glbindings and it's an awesome library. I have a question according to the examples and the general use of globjects with glfw. There has to be a certain order of including the need header files as I can see in all examples.
Taken from texture example.
include <glm/vec2.hpp>
include <glbinding/gl/gl.h>
include <glbinding/Version.h>
include <glbinding-aux/ContextInfo.h>
include <glbinding-aux/types_to_string.h>
include <GLFW/glfw3.h>
include <globjects/globjects.h>
include <globjects/base/File.h>
include <globjects/logging.h>
include <globjects/Texture.h>
include "ScreenAlignedQuad.h"
using namespace gl;
For example this piece of code won't compile, because GL_TEXTURE_2D is ambigious. It's wether the GL_TEXTURE_2D somewhere defined in gl.h or it's the enum from globjects -> gl::GLenum::GL_TEXTURE_2D
globjects::Texture::createDefault(GL_TEXTURE_2D)
Even if I remove the using namespace globjects, this line won't compile. I have to explicitly cast
globjects::Texture::createDefault((gl::GLenum)GL_TEXTURE_2D);
And how can I use the following with wglGetProcAddress instead of glfwGetProcAddress ?
This doesnt work. The compiler complains about invalid or incompatible types. globjects::init([](const char* name) { return wglGetProcAddress(name); });
Kind regards, PonchoBob