I want to use the cygwin32 compiler instead of mingw32. According to http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/glfw/ , the GLX programs of gl on cygwin don't work with glfw. So I tried to use mingw32 binaries of glfw3 in cygwin32, which gave errors like 'GL_ARRAY_BUFFER' was not declared in this scope. I solved that by linking with mingw32 binaries of glew32, which gave
/usr/include/w32api/GL/glu.h:68:79: error: expected ')' before '*' token
which I solved two different ways, by instead using the glew installed by cygwin or by linking to glew32s and pasting
#ifndef CALLBACK
#if defined(_ARM_)
#define CALLBACK
#else
#define CALLBACK __stdcall
#endif
#endif
#define GLEW_STATIC
If I used glew32 instead of glew32s, it would say undefined reference to 'glewInit', which I need to stop the segfault right before the glCreateShader and after glfwMakeContextCurrent. But this method gave Warning: resolving _glewInit by linking to _glewInit@0.
After all that, I got a lot of errors like undefined reference to 'glGenTextures' or 'glDrawElements', which I could only solve by linking to cygwin's gl, which I think is mixing GLX with WGL. According to glewInit() fails with "Missing GL version", SDL2 OpenGL context, cygwin compiler , I should just switch to mingw32 compiler, which I already have working, but I really want to use cygwin.
If I use cygwin's gl (-lGL) with glew32s, it compiles, runs, and segfaults with a stackdump at my glGenBuffers(1, &ibo); in my model class without glewinit() giving any errors.
model(vectx* vecticesd, unsigned int* indicesd,int vectsized,int indsized,GLuint texidd) :
vecticesarr(vecticesd), indicesarr(indicesd),texid(texidd),vectsize(vectsized),indsize(indsized){
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, vectsized, vecticesarr, GL_STATIC_DRAW);
glGenBuffers(1, &ibo); //here it crashes
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indsized, indicesd, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
If I use cygwin's glew instead, the glewinit() returns the error "Missing GL version". glfwMakeContextCurrent(window); is called BEFORE glewinit();. Here is my linkers and doubling them, so the orders don't matter, didn't change anything.
-lglfw3 -lglew32s -lopengl32 -lgdi32 -lGL
I tried mingw64 binaries with cygwin64 and it gave "___vsnprintf not found" and -lntdll didn't fix it.
--added more information--
I'm new to programming, so please forgive me if I say anything really dumb. For a test case, use the code at https://www.glfw.org/docs/3.0/quick.html . I get a black window with my cygwin32 build setup and the rotating triangle with my mingw32 build setup. I'm using sublime text on windows, if that matters. Can I use the pre-compiled binaries for mingw32 download from the glfw website, or do I have to use cmake with cygwin? When I tried cmake with cygwin by adding cygwin/bin to the environment system variable path, it said "Using Win32 for window creation", and both the cygwin/bin/make.exe and gnu windows make said
[ 16%] Linking C executable boing.exe ../src/glfw3.lib(win32_monitor.c.obj):win32_monitor.c:(.text+0x77): undefined reference to `_imp__CreateDCW@16' ... more errors
If I went into the cmakelist.txt in the glfw source and forced it to use X11, it said "Using X11 for window creation" and then make said X11/extensions/xf86vmode.h was missing and there wasn't a package for it in the setup-x86.exe thing for cygwin. I might of did something very wrong with the cmake, but I don't know. I was able to cmake, make, and make install with mingw32 as the native compiler in the environment system variable path.