Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: opengl newer version

  1. #1
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45

    opengl newer version

    Hi,
    my computer is a few years old, I have developed quite a bit of software using it seems version 1.0 of opengl. I think that is what comes with windows, I cannot remember how I installed the sdk, if I did.

    I want to start using vbo's, but my graphics card will not support 4.5. I would like to start with 3.1, where can I down load that? I am assuming when I install that it will fix this error
    error LNK2001: unresolved external symbol __imp___glewGenBuffers

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    Quote Originally Posted by macsam View Post
    my computer is a few years old, I have developed quite a bit of software using it seems version 1.0 of opengl.
    I think that is what comes with windows, I cannot remember how I installed the sdk, if I did.

    I want to start using vbo's, but my graphics card will not support 4.5.
    I would like to start with 3.1, where can I down load that?
    Just install the latest graphics drivers for your GPU. They implement the OpenGL API. See:


    I am assuming when I install that it will fix this error
    error LNK2001: unresolved external symbol __imp___glewGenBuffers
    No, this comes from the GLEW extension loader library. This layers on top of OpenGL to give you a simple mechanism to load and expose all of the core and extension APIs supported by your graphics drivers. Related: see this thread and this one.

  3. #3
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    Thanks for your help.

    It seems my laptop will not allow me to install 4.6. The graphics card is a GeForce GT 640M.

    I have found a version 3.2 sample and would like to use that. ( https://www.khronos.org/opengl/wiki/...ders_(C_/_SDL) ).

    I am stuck on the first hurdle - I cannot find GL3/gl3.h and possible the opengl library that goes with it.

    Any pointers gratefully appreciated.

    MacSam

  4. #4
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    should I be thinking of DirectX, is it easier?

  5. #5
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    Quote Originally Posted by macsam View Post
    I have found a version 3.2 sample and would like to use that. ( https://www.khronos.org/opengl/wiki/...ders_(C_/_SDL) ).

    I am stuck on the first hurdle - I cannot find GL3/gl3.h and possible the opengl library that goes with it.
    This thread describes gl3.h. It's not a standard header, but rather a paired down version of "gl.h" that tries to remove the declarations for much of the old pre-OpenGL 3.0 functionality.

    As the thread mentions, you can just ignore this header and use GLEW to declare and load your OpenGL functions and other declarations. For more on that, see OpenGL Loading Library in the OpenGL wiki.

    Here's a short, stand-alone GLEW + GLUT test program to help you get started:

    Code cpp:
    //------------------------------------------------------------------------------
    //  Stand-alone GLUT Test Program Shell
    //------------------------------------------------------------------------------
     
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <GL/glew.h>
    #include <GL/glut.h>
     
    //-----------------------------------------------------------------------
     
    void checkGLError( const char hdr[] )
    {
        bool  found = false;
        GLint err;
     
        while ( (err = glGetError()) != GL_NO_ERROR )
        {
            fprintf(stderr, "GL ERROR %s (at %s)\n", gluErrorString(err), hdr);
            found = true;
        }
     
        if ( found )
        {
            exit(1);
        }
    }
     
    //-----------------------------------------------------------------------
     
    void init()
    {
        //------------------------------------------------------------
        // Put your GL resource creation here
        //   (buffer objects, textures, etc.)
        //------------------------------------------------------------
     
        checkGLError( "init()" );
    }
     
    //-----------------------------------------------------------------------
     
    void reshape( int width, int height )
    {
        glViewport(0, 0, width, height);
    }
     
    //-----------------------------------------------------------------------
     
    void display()
    {
        // Clear screen
        glClearColor( 0.1f, 0.1f, 0.43f, 1.0f );
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
     
        // Load up PROJECTION and MODELVIEW
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(-2,2,-2,2,-2,2);
     
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
     
        //------------------------------------------------------------
        // Put your GL draw calls here.
        //------------------------------------------------------------
     
        // Swap
        glutSwapBuffers();
     
        // Cause display() to be called again.
        glutPostRedisplay();
        checkGLError( "display()" );
    }
     
    //-----------------------------------------------------------------------
     
    void keyboard( unsigned char key, int x, int y )
    {
        switch (key)
        {
            case 27:         // ESC quits
                exit(0);
                break;
        }
    }
     
    int main( int argc, char** argv )
    {
        // Init GLUT
        glutInit( &argc, argv );
        glutInitDisplayMode(  GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE  );
        glutCreateWindow( argv[0] );
     
        glutKeyboardFunc( keyboard );
        glutDisplayFunc( display );
        glutReshapeFunc( reshape );
     
        glutReshapeWindow( 400,400 );
     
        // Init GLEW
        GLenum err = glewInit();
        if ( err != GLEW_OK )
        {
            // Problem: glewInit failed, something is seriously wrong.
            fprintf( stderr, "Error: %s\n", glewGetErrorString(err) );
            exit(1);
        }
     
        printf( "GL_RENDERER = %s\n", glGetString( GL_RENDERER) );
     
        init();
     
        glutMainLoop();
        return 0;
    }
    Last edited by Dark Photon; 10-23-2018 at 06:28 AM.

  6. #6
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    thank you, I appreciate your post.

  7. #7
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    Hi,

    I still have this problem: error LNK2001: unresolved external symbol __imp___glewGenBuffers
    I use MFC static in a static library. I have the glew32sd.lib for the debug mode. I have added it to additional dependencies but still have the problem. I did try adding the glew.c to the project but it came up a lot of errors relating to DLL's.

    Any help gratefully appreciated

  8. #8
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    Quote Originally Posted by macsam View Post
    I still have this problem:
    Code :
    error LNK2001: unresolved external symbol __imp___glewGenBuffers
    I use MFC static in a static library. I have the glew32sd.lib for the debug mode.
    See:



    If this doesn't resolve your problem, please describe exactly:

    1. what compiler you're compiling and linking with
    2. what symbols you are defining when you compile, and
    3. exactly what libraries you are linking with (and the order that you are linking them).


    Other questions:

    1. You are linking with glew32sd.lib, so you are trying to link with GLEW statically, correct?
    2. Did you define GLEW_STATIC when you compiled?
    3. Did you verify that you are not linking with any other GLEW libraries?
    4. Did you verify that you are linking with the GLEW library of the correct architecture (32-bit or 64-bit)?
    5. Did you verify that you are trying to compile/link with MSVC and not MinGW?
    6. Did you verify that you are linking with the GLEW library before opengl32.lib?

  9. #9
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    Thank you again for your help

  10. #10
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    I eventualy got this to work, thanks to the help here and jamie King.( https://www.youtube.com/watch?annota...&v=-N-ncMdwfAU)

    I hope it helps someone.

    Code :
    //I needed to add this:
    #include <GL/gl.h> 
    #include <GL/glu.h>
    #include <GL/glext.h>
    #include <GL/glcorearb.h>
     
     
     
    PFNGLGENBUFFERSPROC glGenBuffers;
    PFNGLBINDBUFFERPROC glBindBuffer;
    PFNGLBUFFERDATAPROC glBufferData;
    PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
    PFNGLBINDVERTEXARRAYAPPLEPROC glBindVertexArray;
    PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
    PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
    PFNGLCREATESHADERPROC glCreateShader;
    PFNGLSHADERSOURCEPROC glShaderSource;
    PFNGLCOMPILESHADERPROC glCompileShader;
    PFNGLCREATEPROGRAMPROC glCreateProgram;
    PFNGLATTACHSHADERPROC glAttachShader;
    PFNGLLINKPROGRAMPROC glLinkProgram;
    PFNGLUSEPROGRAMPROC glUseProgram;
    PFNGLGETSHADERIVPROC glGetShaderiv;
    PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
     
     
     
    void *GetAnyGLFuncAddress(const char *name)
    {
    	void *p = (void *)wglGetProcAddress(name);
    	if (p == 0 ||
    		(p == (void*)0x1) || (p == (void*)0x2) || (p == (void*)0x3) ||
    		(p == (void*)-1))
    	{
    		HMODULE module = LoadLibraryA("opengl32.dll");
    		p = (void *)GetProcAddress(module, name);
    	}
     
    	return p;
    }
     
    void SetUpProcs(void)
    {
    	glGenBuffers = (PFNGLGENBUFFERSPROC)GetAnyGLFuncAddress("glGenBuffers");
    	glBindBuffer = (PFNGLBINDBUFFERPROC)GetAnyGLFuncAddress("glBindBuffer");
    	glBufferData = (PFNGLBUFFERDATAPROC)GetAnyGLFuncAddress("glBufferData");
    	glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)GetAnyGLFuncAddress("glGenVertexArrays");
    	glBindVertexArray = (PFNGLBINDVERTEXARRAYAPPLEPROC)GetAnyGLFuncAddress("glBindVertexArray");
    	glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)GetAnyGLFuncAddress("glEnableVertexAttribArray");
    	glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)GetAnyGLFuncAddress("glVertexAttribPointer");
    	glCreateShader = (PFNGLCREATESHADERPROC)GetAnyGLFuncAddress("glCreateShader");
    	glShaderSource = (PFNGLSHADERSOURCEPROC)GetAnyGLFuncAddress("glShaderSource");
    	glCompileShader = (PFNGLCOMPILESHADERPROC)GetAnyGLFuncAddress("glCompileShader");
    	glCreateProgram = (PFNGLCREATEPROGRAMPROC)GetAnyGLFuncAddress("glCreateProgram");
    	glAttachShader = (PFNGLATTACHSHADERPROC)GetAnyGLFuncAddress("glAttachShader");
    	glLinkProgram = (PFNGLLINKPROGRAMPROC)GetAnyGLFuncAddress("glLinkProgram");
    	glUseProgram = (PFNGLUSEPROGRAMPROC)GetAnyGLFuncAddress("glUseProgram");
    	glGetShaderiv = (PFNGLGETSHADERIVPROC)GetAnyGLFuncAddress("glGetShaderiv");
    	glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)GetAnyGLFuncAddress("glGetShaderInfoLog");
     
     
    }
     
    //this I got from msdn
     
    HDC   ghDC;
    HGLRC ghRC;
     
    void oncreateOpenGLVBO(HWND hwnd)
    {
    	// PAINTSTRUCT    ps; 
    	RECT rect;
    	BOOL bError;
    	DWORD dwErrorCode;
    	GLenum GLenumError;
    	bError = 0;
     
    	ghDC = GetDC(hwndThrd);//hwnd
     
    	bError = GetClientRect(hwndThrd, &rect);
    	if (bError == 0)
    		dwErrorCode = GetLastError();
    	if (CSetupPixelFormatComplted == 'y')
    	{
    		ghRC = wglCreateContext(ghDC);
    		bError = wglMakeCurrent(ghDC, ghRC);
     
    		//createObjects( hwnd ); 
    		initializeGLVBO(hwnd, rect.right, rect.bottom);
    		return;
    	}
     
     
    	CSetupPixelFormatComplted = 'y';
     
    	if (!bSetupPixelFormat(ghDC))
    		PostQuitMessage(0);
     
    	ghRC = wglCreateContext(ghDC);
    	if (ghRC == NULL)
    		ghRC = NULL;
    	bError = wglMakeCurrent(ghDC, ghRC);
     
     
     
     
    	GLenumError = glGetError();
    	if (GLenumError != GL_NO_ERROR)
    		OGLErrorCode(GLenumError);
     
     
     
    	drawsceneVBO(hwnd);
    	//initializeGLVBO(hwnd, rect.right, rect.bottom);
     
    	// createObjects( hwnd ); aready created in InitializeGL above
     
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •