Results 1 to 2 of 2

Thread: no gl constants visible in code::blocks

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101

    no gl constants visible in code::blocks

    Hi fellow-newbs
    I've setup code::blocks and picked the opengl-project. It compiled and ran successfully at second attempt. Great!

    The main.c does not use the code suggested in SuperBible_5. I managed to get

    const char *verString = glGetString(GL_VERSION) ;
    and
    printf("verString: %s \n ", verString ) ;

    working.
    const char is a substitute for ubyte which the setup (MinGW, win7) did not recognize. But
    GL_MAJOR_VERSION and GL_MINOR_VERSION is not recognized either.

    As an aside: the version is 3.3 which I was going for.

    int MajorVer, MinorVer;
    glGetIntegerv(GL_MAJOR_VERSION, &MajorVer) ;
    glGetIntegerv(GL_MINOR_VERSION, &MinorVer) ;

    and the problem continues if I try (to ensure that I'll get the core-profile)

    GLint attribs[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
    WGL_CONTEXT_MINOR_VERSION_ARB, 3,
    WGL_CONTEXT_POFILE_MASK_ARB, WGL_CONTEXT_CORE_POFILE_BIT_ARB,
    WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT,
    0};
    hRC = wglCreateContextAttribsARB(*hDC, 0, attribs);

    First: Should I set wglCreateContextAttribsARB() atop my code as (a prototype) like:
    void EnableOpenGL(HWND hwnd, HDC*, HGLRC*);

    Second: Error-code from the compiler->
    ...
    F:\Projekter\OpenGL_02\main.c|172|note: each undeclared identifier is reported only once for each function it appears in|
    F:\Projekter\OpenGL_02\main.c|173|error: 'WGL_CONTEXT_MINOR_VERSION_ARB' undeclared (first use in this function)|
    F:\Projekter\OpenGL_02\main.c|174|error: 'WGL_CONTEXT_POFILE_MASK_ARB' undeclared (first use in this function)|
    F:\Projekter\OpenGL_02\main.c|174|error: 'WGL_CONTEXT_CORE_POFILE_BIT_ARB' undeclared (first use in this function)|
    F:\Projekter\OpenGL_02\main.c|175|error: 'WGL_CONTEXT_FLAGS_ARB' undeclared (first use in this function)|
    F:\Projekter\OpenGL_02\main.c|175|error: 'WGL_CONTEXT_DEBUG_BIT' undeclared (first use in this function)|
    F:\Projekter\OpenGL_02\main.c|177|warning: implicit declaration of function 'wglCreateContextAttribsARB' [-Wimplicit-function-declaration]|
    ...

    I would appreciate a comment

    I added
    #include <stdlib.h>
    and it stopped whining about printf(). [or did something else do the trick?]

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2013
    Posts
    101
    ok,
    I read further text where the code I use is following an initiation of Glew ... It makes sense why the constants and functions are missing then.

    Cheers all

Similar Threads

  1. Replies: 1
    Last Post: 10-15-2018, 08:56 AM
  2. Setting up OpenGl with Code::Blocks
    By dzzank in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-18-2014, 10:22 AM
  3. Windows OpenGl problem(C++ Code::Blocks)
    By Need4Sleep in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-13-2012, 04:55 PM
  4. Need Help with glut, [Code::Blocks and mingw]
    By GlennC++ in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 06-04-2009, 11:09 PM
  5. Replies: 14
    Last Post: 04-24-2008, 12:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean