Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualVortez

Posted 11 May 2013 - 04:37 PM

Hi, i've been trying to add some code to my engine to create an opengl 3.1 context, to keep up to date with current technology. However, it's dosen't seem to do anything different... I though depreciated features where phased out in 3.1, and that you absolutely needed shaders to render anything, but all my old code still work and i can even render stuff without shaders. Is there a way to be sure the context i am creating is what i am trying to do?

 

For example, i added this pieces of code in my engine initialization procedure:

 

    if(!SetupPixelFormatDescriptor(hDC)){
	PostQuitMessage(0);
	return false;
    }

    #ifndef COMPILE_FOR_OPENGL_3_1_
        hRC = wglCreateContext(hDC);
        wglMakeCurrent(hDC, hRC);
    #else
        GLenum err = glewInit();
        HGLRC tempContext = wglCreateContext(hDC);
        wglMakeCurrent(hDC, tempContext);

	int attribs[] =
	{
        WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
        WGL_CONTEXT_MINOR_VERSION_ARB, 1,
        WGL_CONTEXT_FLAGS_ARB, 0,
        0};

	PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
	
        hRC = CreateContextAttribsARB(hDC, 0, attribs);
	wglMakeCurrent(NULL,NULL);
	wglDeleteContext(tempContext);
	wglMakeCurrent(hDC, hRC);
    #endif

 

But for the reasons listed above, it dosen't seem to do much... I followed the new red book instruction (OpenGL Programming guide 7th edition).

 

Am i doing this right?


#3Vortez

Posted 11 May 2013 - 04:36 PM

Hi, i've been trying to add some code to my engine to create an opengl 3.1 context, to keep up to date with current technology. However, it's dosen't seem to do anything different... I though depreciated features where phased out in 3.1, and that you absolutely needed shaders to render anything, but all my old code still work and i can even render stuff without shaders. Is there a way to be sure the context i am creating is what i am trying to do?

 

For example, i added this pieces of code in my engine initialization procedure:

 

    if(!SetupPixelFormatDescriptor(hDC)){
	PostQuitMessage(0);
	return false;
    }

    #ifndef COMPILE_FOR_OPENGL_3_1_
        hRC = wglCreateContext(hDC);
        wglMakeCurrent(hDC, hRC);
    #else
        GLenum err = glewInit();
        HGLRC tempContext = wglCreateContext(hDC);
        wglMakeCurrent(hDC, tempContext);

	int attribs[] =
	{
        WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
        WGL_CONTEXT_MINOR_VERSION_ARB, 1,
        WGL_CONTEXT_FLAGS_ARB, 0,
        0};

	PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB =         (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
	
        hRC = CreateContextAttribsARB(hDC, 0, attribs);
	wglMakeCurrent(NULL,NULL);
	wglDeleteContext(tempContext);
	wglMakeCurrent(hDC, hRC);
    #endif

 

But for the reasons listed above, it dosen't seem to do much... I followed the new red book instruction (OpenGL Programming guide 7th edition).

 

Am i doing this right?


#2Vortez

Posted 11 May 2013 - 04:36 PM

Hi, i've been trying to add some code to my engine to create an opengl 3.1 context, to keep up to date with current technology. However, it's dosen't seem to do anything different... I though depreciated features where phased out in 3.1, and that you absolutely need shaders to render anything, but all my old code still work and i can even render stuff without shaders. Is there a way to be sure the context i am creating is what i am trying to do?

 

For example, i added this pieces of code in my engine initialization procedure:

 

    if(!SetupPixelFormatDescriptor(hDC)){
	PostQuitMessage(0);
	return false;
    }

    #ifndef COMPILE_FOR_OPENGL_3_1_
        hRC = wglCreateContext(hDC);
        wglMakeCurrent(hDC, hRC);
    #else
        GLenum err = glewInit();
        HGLRC tempContext = wglCreateContext(hDC);
        wglMakeCurrent(hDC, tempContext);

	int attribs[] =
	{
        WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
        WGL_CONTEXT_MINOR_VERSION_ARB, 1,
        WGL_CONTEXT_FLAGS_ARB, 0,
        0};

	PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB =         (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
	
        hRC = CreateContextAttribsARB(hDC, 0, attribs);
	wglMakeCurrent(NULL,NULL);
	wglDeleteContext(tempContext);
	wglMakeCurrent(hDC, hRC);
    #endif

 

But for the reasons listed above, it dosen't seem to do much... I followed the new red book instruction (OpenGL Programming guide 7th edition).

 

Am i doing this right?


#1Vortez

Posted 11 May 2013 - 04:36 PM

Hi, i've been trying to add some code to my engine to create an opengl 3.1 context, to keep up to date with current technologie. However, it's dosen't seem to do anything different... I though depreciated features where phased out in 3.1, and that you absolutely need shaders to render anything, but all my old code still work and i can even render stuff without shaders. Is there a way to be sure the context i am creating is what i am trying to do?

 

For example, i added this pieces of code in my engine initialization procedure:

 

    if(!SetupPixelFormatDescriptor(hDC)){
	PostQuitMessage(0);
	return false;
    }

    #ifndef COMPILE_FOR_OPENGL_3_1_
        hRC = wglCreateContext(hDC);
        wglMakeCurrent(hDC, hRC);
    #else
        GLenum err = glewInit();
        HGLRC tempContext = wglCreateContext(hDC);
        wglMakeCurrent(hDC, tempContext);

	int attribs[] =
	{
        WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
        WGL_CONTEXT_MINOR_VERSION_ARB, 1,
        WGL_CONTEXT_FLAGS_ARB, 0,
        0};

	PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB =         (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
	
        hRC = CreateContextAttribsARB(hDC, 0, attribs);
	wglMakeCurrent(NULL,NULL);
	wglDeleteContext(tempContext);
	wglMakeCurrent(hDC, hRC);
    #endif

 

But for the reasons listed above, it dosen't seem to do much... I followed the new red book instruction (OpenGL Programming guide 7th edition).

 

Am i doing this right?


PARTNERS