Hi Guys,
So I have this code:
#include "glfw3.h"
int main()
{
GLFWwindow* window;
/*Initialize the library*/
if(!glfwInit())
{
return -1;
}
/*Create a windowed mode window and its OpenGL context*/
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if(!window)
{
glfwTerminate();
return -1;
}
/*Make the window's context current*/
glfwMakeContextCurrent(window);
/*Loop until the user closes the window*/
while(!glfwWindowShouldClose(window))
{
/*Render here*/
/*Swap front and back buffers*/
glfwSwapBuffers(window);
/*Poll for an process events*/
glfwPollEvents();
}
glfwTerminate();
return 0;
}
It launches a new window just fine with a black blank screen.
However the moment I add glew, the window stops appearing:
#include <stdio.h>
#include <stdlib.h>
#include "glew.h"
#include "glfw3.h"
int main()
{
GLFWwindow* window;
/*Initialize the library*/
if(!glfwInit())
{
fprintf(stderr, "GLFW failed to initialise");
return -1;
}
/*Create a windowed mode window and its OpenGL context*/
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if(!window)
{
glfwTerminate();
return -1;
}
/*Make the window's context current*/
glfwMakeContextCurrent(window);
if(glewInit() != GLEW_OK)
{
fprintf(stderr, "GLEW failed to initialise");
glfwTerminate();
return -1;
}
/*Loop until the user closes the window*/
while(!glfwWindowShouldClose(window))
{
/*Render here*/
/*Swap front and back buffers*/
glfwSwapBuffers(window);
/*Poll for an process events*/
glfwPollEvents();
}
glfwTerminate();
return 0;
}
This code results in no compilation or linker errors, but nothing happens, the window stops appearing.
Any ideas as to what is going on?
As a side note that might give suggestions as to what might be going on, it also doesn’t compile if I add glewExperimetnal = true;
#include <stdio.h>
#include <stdlib.h>
#include "glew.h"
#include "glfw3.h"
int main()
{
GLFWwindow* window;
/*Initialize the library*/
if(!glfwInit())
{
fprintf(stderr, "GLFW failed to initialise");
return -1;
}
/*Create a windowed mode window and its OpenGL context*/
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if(!window)
{
glfwTerminate();
return -1;
}
/*Make the window's context current*/
glfwMakeContextCurrent(window);
glewExperimental = true;
if(glewInit() != GLEW_OK)
{
fprintf(stderr, "GLEW failed to initialise");
glfwTerminate();
return -1;
}
/*Loop until the user closes the window*/
while(!glfwWindowShouldClose(window))
{
/*Render here*/
/*Swap front and back buffers*/
glfwSwapBuffers(window);
/*Poll for an process events*/
glfwPollEvents();
}
glfwTerminate();
return 0;
}
It spits out undefined reference to ‘imp__glewExperimental’
collect2: Id returned 1 exit status
so maybe there’s something wrong with the .lib??? Or maybe I’ve used the wrong one in my project??? I tried different .libs that were in the pack and I get even more compile errors then, so not sure what’s going on.