Results 1 to 3 of 3

Thread: How to initialize GL 1.0 pointers with GL3.h

  1. #1
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    How to initialize GL 1.0 pointers with GL3.h

    How are you supposed to get opengl 1.1 function pointers if you use gl3.h?

    I want to divide all initialization in functions like so:
    Code :
    int InitGL_1_0()
    {
    	if(!(glCullFace =  (PFNGLCULLFACEPROC)wglGetProcAddress("glCullFace"))) return 0;
    	if(!(glFrontFace =  (PFNGLFRONTFACEPROC)wglGetProcAddress("glFrontFace"))) return 0;
    	if(!(glHint =  (PFNGLHINTPROC)wglGetProcAddress("glHint"))) return 0;
    	if(!(glLineWidth =  (PFNGLLINEWIDTHPROC)wglGetProcAddress("glLineWidth"))) return 0;
    ...

    But I get an error that function "glCullFace" cannot be found, how do I get it then?

    I don't want to include gl.h, only gl3.h for new prototypes.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2007
    Posts
    268

    Re: How to initialize GL 1.0 pointers with GL3.h

    By definition, if you use gl3.h it is because you restrain your code to use the core profile and get rid of the compatibility profile. So what you are asking does not make sense.

    If you still want to have access to 1.1 function pointers you need the legacy gl.h.

    Ref: section E.1 "Core and Compatibility Profiles" and the beginning of section E.2 "Deprecated and Removed Features" page 329 in "OpenGL 3.2 Core Profile Specification (August 3, 2009)"

    Ref: section I.2 "Header Files" of Appendix I "Extension Registry, Header Files, and ARB Extensions" page 352 in "OpenGL 3.2 Core Profile Specification (August 3, 2009)"

    http://www.opengl.org/registry/doc/g...e.20090803.pdf

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: How to initialize GL 1.0 pointers with GL3.h

    Yup, I am using 3.2, core FW compat, but things like glEnable(GL_CULL_FACE/GL_DEPTH_TEST) are still using glEnable and there are glTexImage1D/glTexImage2D/glHint/glViewport which are non-deprecated 1.0-ish calls...

    I guess I could resort to "discard" in fragment shaders for things like cull face or depth test, but I don't want to redo textures or viewports.

    I ended up copying all 1.0/1.1 calls from gl.h that are used in GL3.x to my headers, there are 64 of them. Still, a nicer way would be cool.

Similar Threads

  1. initialize window
    By kentut in forum OpenGL: Basic Coding
    Replies: 18
    Last Post: 07-14-2003, 10:17 AM
  2. could not initialize opengl
    By in forum OpenGL: User Software
    Replies: 2
    Last Post: 12-02-2001, 10:59 PM
  3. OpenGl 1.2.1 won't initialize for me!!!!
    By andsmith2 in forum OpenGL: macOS
    Replies: 8
    Last Post: 02-24-2001, 06:40 PM
  4. How to initialize and use Voodoo2??
    By HoHo in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 01-13-2001, 10:22 AM
  5. OpenGL won't initialize
    By in forum OpenGL: macOS
    Replies: 1
    Last Post: 01-10-2001, 11:52 AM

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