Opengl test code with GLFW & GLEW compile errors

Jul 7, 2013 at 3:15pm
Hey there! I'm learning OpenGL 3.2+ with GLFW and GLEW.

I'm learning it through this series of tutorials http://open.gl/context but when I run the first code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <cstdlib>
#include <GL/glfw.h>
#define GLEW_STATIC
#include <GL/glew.h>


int main()
{
    glfwInit();
    glewExperimental = GL_TRUE;
    glewInit();

    GLuint vertexBuffer;
    glGenBuffers( 1, &vertexBuffer );

    printf( "%u\n", vertexBuffer );

    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" );

    while( glfwGetWindowParam( GLFW_OPENED ) )
        {
        glfwSwapBuffers();
        if ( glfwGetKey( GLFW_KEY_ESC ) == GLFW_PRESS )
        break;
        }


    glfwTerminate();


    return 0;
}


(Then i have the glew.h that is about 17000 lines of code)

I get this errors:

c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|84|error: #error gl.h included before glew.h|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1793|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1804|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1805|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1807|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1808|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1810|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1811|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1813|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|1823|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2146|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2158|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2162|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2169|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2343|error: 'GLint64' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2344|error: 'GLint64' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2529|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2533|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2534|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2633|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|2635|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3205|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3206|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3226|error: typedef 'GLsync' is initialized (use decltype instead)|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3226|error: expected primary-expression before '__attribute__'|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3399|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3403|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|3404|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4265|error: 'GLint64' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4658|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4659|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4660|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4661|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4864|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|4867|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5319|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5320|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5323|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5324|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5379|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5380|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5381|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5381|error: 'GLchar' has not been declared|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5382|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5383|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5384|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5384|error: 'GLchar' does not name a type|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5462|error: typedef 'PFNGLCLIENTWAITSYNCPROC' is initialized (use decltype instead)|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5462|error: 'GLsync' was not declared in this scope|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|5462|error: expected primary-expression before 'flags'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 2 seconds) ===|


What I'm doing wrong?

I have been for 7 days trying to make it work but it seems impossible, I wish to start building my own engine but I can't due to problems like this.

Thank you,


Marc
Jul 7, 2013 at 4:00pm
The first error seems to be pretty clear:

c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glew.h|84|error: #error gl.h included before glew.h|


The error is telling you that glew.h must be included before gl.h. Since you are not including gl.h in your code, it's safe to assume that glfw.h is including it.

So change your includes so that glew.h is included before glfw.h
Jul 7, 2013 at 5:24pm
Now i only get "PRINTF was not declared in this scope"

I just changed the include order, anything more.

How I declare printf?
Jul 7, 2013 at 7:07pm
printf is defined in the <cstdio> header.

#include <cstdio>
Jul 7, 2013 at 8:12pm
Okay, I placed #include <cstdio> on the top of the includes:

#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <GL/glew.h>
#include <GL/glfw.h>
#define GLEW_STATIC



And now I get:

||=== test glfw, Debug ===|
obj\Debug\main.o||In function `main':|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|14|undefined reference to `_imp__glewExperimental'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|18|undefined reference to `_imp____glewGenBuffers'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|22|undefined reference to `glfwOpenWindowHint'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|23|undefined reference to `glfwOpenWindowHint'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|24|undefined reference to `glfwOpenWindowHint'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|26|undefined reference to `glfwOpenWindowHint'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|27|undefined reference to `glfwOpenWindow'|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|30|undefined reference to `glfwGetWindowParam'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(window.c.obj):window.c|| undefined reference to `glClear@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(context.c.obj):context.c|| undefined reference to `glGetIntegerv@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(context.c.obj):context.c|| undefined reference to `glGetString@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(context.c.obj):context.c|| undefined reference to `glGetString@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(context.c.obj):context.c|| undefined reference to `glGetIntegerv@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(context.c.obj):context.c|| undefined reference to `glGetIntegerv@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(context.c.obj):context.c|| undefined reference to `glGetIntegerv@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_monitor.c.obj):win32_monitor.c|| undefined reference to `_imp__CreateDCW@16'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_monitor.c.obj):win32_monitor.c|| undefined reference to `_imp__GetDeviceCaps@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_monitor.c.obj):win32_monitor.c|| undefined reference to `_imp__DeleteDC@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_gamma.c.obj):win32_gamma.c|| undefined reference to `_imp__CreateDCW@16'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_gamma.c.obj):win32_gamma.c|| undefined reference to `_imp__GetDeviceGammaRamp@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_gamma.c.obj):win32_gamma.c|| undefined reference to `_imp__DeleteDC@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_gamma.c.obj):win32_gamma.c|| undefined reference to `_imp__CreateDCW@16'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_gamma.c.obj):win32_gamma.c|| undefined reference to `_imp__SetDeviceGammaRamp@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(win32_gamma.c.obj):win32_gamma.c|| undefined reference to `_imp__DeleteDC@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__DescribePixelFormat@16'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__DescribePixelFormat@16'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__DescribePixelFormat@16'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__SetPixelFormat@12'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglMakeCurrent@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglGetProcAddress@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglCreateContext@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglShareLists@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglDeleteContext@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglMakeCurrent@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglMakeCurrent@8'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__SwapBuffers@4'|
C:\Archivos de programa\CodeBlocks\MinGW\lib\libglfw3.a(wgl_context.c.obj):wgl_context.c|| undefined reference to `_imp__wglGetProcAddress@4'|
||=== Build finished: 37 errors, 0 warnings (0 minutes, 2 seconds) ===|

It seems I'm not made for coding in OpenGL
Jul 7, 2013 at 8:17pm
Oh, and I should build glew?
Jul 7, 2013 at 8:26pm
I don't think that you should have to build glew. Make sure that you linked all the necessary libraries in your project.
Jul 7, 2013 at 10:07pm
Well, i have puted all the libraries and includes on MinGW and Win system32 libs and include folders, and I still have problems

What could I have missed?

Now I have this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <GL/glew.h>
#include <GL/glfw.h>
#define GLEW_STATIC




int main()
{
    glfwInit();
    glewExperimental = GL_TRUE;
    glewInit();

    GLuint vertexBuffer;
    glGenBuffers( 1, &vertexBuffer );

    printf( "%u\n", 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;
}


and I get this errors:

C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp||In function 'int main()':|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|23|error: 'GLFW_OPENED' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|23|error: 'glfwGetWindowParam' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|25|error: too few arguments to function 'void glfwSwapBuffers(GLFWwindow*)'|
c:\archivos de programa\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\..\include\GL\glfw.h|2171|note: declared here|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|26|error: 'GLFW_KEY_ESC' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|30|error: 'GLFW_OPENGL_VERSION_MAJOR' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|30|error: 'glfwOpenWindowHint' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|31|error: 'GLFW_OPENGL_VERSION_MINOR' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|34|error: 'GLFW_WINDOW_NO_RESIZE' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|35|error: 'GLFW_WINDOW' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|35|error: 'glfwOpenWindow' was not declared in this scope|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|36|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) ===|
Last edited on Jul 7, 2013 at 10:13pm
Jul 7, 2013 at 10:17pm
If I run this:

1
2
3
4
5
6
7
8
9
10
11
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <GL/glfw.h>

int main()
{
    glfwInit();
    glfwSleep( 1.0 );
    glfwTerminate();
}


I get:

C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp||In function 'int main()':|
C:\Documents and Settings\marc\Escritorio\C++\test glfw\main.cpp|9|error: 'glfwSleep' was not declared in this scope|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|


Jul 7, 2013 at 10:24pm
YEAH

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <cstdio>
#include <cstdlib>
#include <iostream>
#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(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 and process events */
        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}


Runs a blank window finally, now I'm looking how to make work the GLM and the GLEW on it
Jul 7, 2013 at 10:42pm
This code works well with GLFW and GLEW

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#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( 1, &vertexBuffer );

    printf( "%u\n", 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;
}



Now I have a question, will I have problems with this tutorials?

http://open.gl/context

The first one (the one that is on the link) makes GLFW and GLEW work in a different way.

I just want to know if I can start coding or if I still have something wrong in my pc and I should fic it


Thank you
Jul 8, 2013 at 10:13am
up!
Aug 12, 2013 at 12:56am
Hey marc i was wondering hows your coding going so far?
I started working in c++ myself.
Just curious how far have u reached in your game?
Best of luck, and i hope i get to see it soon.
Topic archived. No new replies allowed.