Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: working with OGL 3.x

  1. #1
    Member Contributor
    Join Date
    Oct 2007
    Location
    persia,tabriz
    Posts
    71

    working with OGL 3.x

    hi

    i want to start working with OpenGL 3.x, and i have some questions?

    1. how can i detcet the version of OGL driver before creating context?

    2. how can i create OpenGL3.x context? ( in WIN32 and linux)

  2. #2
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,294

    Re: working with OGL 3.x

    Code :
    ...
    wglMakeCurrent(hDC,hRC); // from your existing code
     
    // from now on, it's GL3.x initialization	
     
    	PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
    	if(!wglCreateContextAttribsARB){
    		MessageBoxA(0,"OpenGL3.0 not supported or enabled in NVemulate",0,0);
    	}else{
    		int attribs[] = {
    			WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
    			WGL_CONTEXT_MINOR_VERSION_ARB, 0,
    			WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 
    			0
    		};
     
    		HGLRC gl3Ctx = wglCreateContextAttribsARB(hDC, 0, attribs);
    		if(gl3Ctx){
    			wglDeleteContext(hRC);
    			hRC =gl3Ctx;
    			wglMakeCurrent(hDC,hRC);
    			//prints("opengl3 success");
    			//prints((char*)glGetString(GL_VERSION));
    		}else{
    			MessageBoxA(0,"OpenGL3.0 context did not init, staying in 2.1",0,0);
    		}
    	}

  3. #3
    Senior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    CA
    Posts
    408

    Re: working with OGL 3.x

    1. to get the driver version try:
    Code :
    printf ("Version: %s\n", glGetString (GL_VERSION));

    2. In linux to create an OpenGL3.x context, I use freeglut:

    Code :
     glutInit( &argc, argv );
     glutInitContextVersion( 3, 0 );

    This should be valid in windows also since freeglut is cross-platform but I am not a windows user so haven't tested it there.

    You will have to use the Testing Release: Freeglut 2.6.0 Release Candidate 1 rather than the standard vanilla version. If you want to see more of how they actually do that under the hood, you could probably look at their code since it is open.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,651

    Re: working with OGL 3.x

    Quote Originally Posted by Pswin
    2. how can i create OpenGL3.x context? ( in WIN32 and linux)
    For beginning OpenGL, definitely use freeglut as mentioned.

    Thought if you'd rather glX/wgl, I can post you a short Xlib/glX code to create a GL window and GL3.x context in Linux.

    Just let us know.

  5. #5
    Member Contributor
    Join Date
    Oct 2007
    Location
    persia,tabriz
    Posts
    71

    Re: working with OGL 3.x

    Quote Originally Posted by Dark Photon
    Quote Originally Posted by Pswin
    2. how can i create OpenGL3.x context? ( in WIN32 and linux)
    For beginning OpenGL, definitely use freeglut as mentioned.

    Thought if you'd rather glX/wgl, I can post you a short Xlib/glX code to create a GL window and GL3.x context in Linux.

    Just let us know.
    thanks, but i am not beginner in OpenGL. just i dont know features and changes of OGL 3.x and how to work with it.

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    744

    Re: working with OGL 3.x

    Quote Originally Posted by Pswin
    thanks, but i am not beginner in OpenGL. just i dont know features and changes of OGL 3.x and how to work with it.
    http://www.flashbang.se - for a few tutorials on how to switch to 3.x

    for the rest you can read whats new in this forum section, it's not really that much new stuff, mainly it's a lot of ext stuff that went core like fbo texture arrays, geometry shaders, instancing, VAO, and so on.
    The most important thing is what got removed.
    As usual it's all in the registry.

  7. #7
    Member Contributor
    Join Date
    Oct 2007
    Location
    persia,tabriz
    Posts
    71

    Re: working with OGL 3.x

    good tutorial , thanks

  8. #8
    Member Contributor
    Join Date
    Oct 2007
    Location
    persia,tabriz
    Posts
    71

    Re: working with OGL 3.x

    how can i get opengl version before creating context and window?
    ( glGetString(GL_VERSION) dose not work before creating context)

    (i need to get minor version for put it in the:
    WGL_CONTEXT_MINOR_VERSION_ARB)

  9. #9
    Senior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: working with OGL 3.x

    You can't. You need to create temporary window and context, if you need something like that.

  10. #10
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,214

    Re: working with OGL 3.x

    Quote Originally Posted by Pswin
    ...
    (i need to get minor version for put it in the:
    WGL_CONTEXT_MINOR_VERSION_ARB)
    And be aware that although spec states that the previous implementations of OpenGL (<3.2) ignore WGL_CONTEXT_PROFILE_MASK_ARB attribute, I have realized that it is not (always) true and have a problem to create GL 3.0 context with WGL_CONTEXT_PROFILE_MASK_ARB attribute included into attribute list.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 04-27-2018, 08:20 PM
  2. GL_SMOOTH not working (was working before...)
    By paulg568 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-06-2012, 05:11 PM
  3. Replies: 1
    Last Post: 11-18-2011, 08:13 AM
  4. VBO not working
    By Dice1 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-29-2009, 06:35 PM
  5. not working
    By Sergiu in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-30-2009, 02:42 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