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 3 of 3

Thread: wglGetProcAddress

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

    wglGetProcAddress

    Hi

    I am trying to use:
    wglGetProcAddress

    in Windows 8.1

    The errors I am getting are:
    error C2100: illegal indirection
    error C2064: term does not evaluate to a function taking 339 arguments

    I have no idea how to use this windows function

    Code :
     
    GLuint triangleVBO;
     
    	void *vPointer;
     
    	vPointer = GetAnyGLFuncAddress("glGenBuffers");
    	(*vPointer)(1, &triangleVBO);

    where
    Code :
    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;
    }

    Any help gratefully appreciated.

    MacSam

  2. #2
    Intern Newbie
    Join Date
    Jan 2013
    Posts
    45
    This never threw up any errors

    Code cpp:
    GLuint triangleVBO;
     
    PFNGLGENBUFFERSPROC vPointer = GetAnyGLFuncAddress("glGenBuffers");
     
    (vPointer)( 1, &triangleVBO);

    Am I on the right road?
    Last edited by Dark Photon; 11-01-2018 at 07:40 PM.

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,542
    Looks like it, yes.

    You should need a (PFNGLGENBUFFERSPROC) cast to convert the void * returned from GetAnyGLFuncAddress() though. See the example here for instance:

    Load OpenGL Functions#Function Retrieval

Posting Permissions

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