This code
#include <cstdio>
#include <cstdlib>
#include <iostream>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GL/glfw3.h>
int main(void)
{
GLFWwindow* window;
// Initialize the library
if (!glfwInit())
return -1;
// Create a windowed mode window and its OpenGL context
window = glfwCreateWindow(320, 240, "Treball Recerca", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
// Make the window's context current
glfwMakeContextCurrent(window);
//Start of GLEW thing
glewExperimental = GL_TRUE;
glewInit();
GLuint vertexBuffer;
glGenBuffers( 00001, &vertexBuffer );
printf( "%u
", vertexBuffer );
//End of GLEW thing
// Loop until the user closes the window
while (!glfwWindowShouldClose(window))
{
// Render here
// Swap front and back buffers
glfwSwapBuffers(window);
// Poll for and process events
glfwPollEvents();
}
glfwTerminate();
return 0;
}
Runs well.
But this:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GL/glfw3.h>
int main()
{
glfwInit();
glewExperimental = GL_TRUE;
glewInit();
GLuint vertexBuffer;
glGenBuffers( 1, &vertexBuffer );
printf( "%u
", vertexBuffer );
while( glfwGetWindowParam( GLFW_OPENED ) )
{
glfwSwapBuffers();
if ( glfwGetKey( GLFW_KEY_ESC ) == GLFW_PRESS )
break;
}
glfwOpenWindowHint( GLFW_OPENGL_VERSION_MAJOR, 3 );
glfwOpenWindowHint( GLFW_OPENGL_VERSION_MINOR, 2 );
glfwOpenWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
glfwOpenWindowHint( GLFW_WINDOW_NO_RESIZE, GL_TRUE );
glfwOpenWindow( 800, 600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW );
glfwSetWindowTitle( "OpenGL" );
glfwTerminate();
return 0;
}
Is giving me this:
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp||In function ‘int main()’
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|21|error: ‘GLFW_OPENED’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|21|error: ‘glfwGetWindowParam’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|23|error: too few arguments to function ‘void glfwSwapBuffers(GLFWwindow*)’|
c:\archivos de programa\codeblocks\mingw\bin…\lib\gcc\mingw32\4.7.1…\include\GL\glfw3.h|2171|note: declared here|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|24|error: ‘GLFW_KEY_ESC’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|28|error: ‘GLFW_OPENGL_VERSION_MAJOR’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|28|error: ‘glfwOpenWindowHint’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|29|error: ‘GLFW_OPENGL_VERSION_MINOR’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|32|error: ‘GLFW_WINDOW_NO_RESIZE’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|33|error: ‘GLFW_WINDOW’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|33|error: ‘glfwOpenWindow’ was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++ est glfw\main.cpp|34|error: cannot convert ‘const char*’ to ‘GLFWwindow*’ for argument ‘1’ to ‘void glfwSetWindowTitle(GLFWwindow*, const char*)’|
||=== Build finished: 11 errors, 0 warnings (0 minutes, 0 seconds) ===|
Wich code is better, and if the better is the second, how i could fix it? I linked this libraries:
glew32.lib, glew32s.lib, libglfw.a, libopengl32.a and glew32s is in the top of the list.
So much thank you to everyone,
Marc