LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Maetschl on May 15, 2016, 15:16:14

Title: Combine old OpenGl with GLSL Version 330 or more
Post by: Maetschl on May 15, 2016, 15:16:14
Hi everyone,

::) Me again, im new on "new opengl" (>1.5) and my code is mixed, VBO and glBegin, etc..

I want implement shaders version 330 or 400, but context only can compile GLSL 1.2 and on new context mi "old opengl code" dont works.

I tried change context with this:


        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);


The question is, it's posible mix both? OldGl & "new" Shaders ?

Thanks guys!
Title: Re: Combine old OpenGl with GLSL Version 330 or more
Post by: Kai on May 15, 2016, 16:37:32
Only, if you are not on Mac OS X and when using the compatibility profile (and not forward compatibility).
So, do the following:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
Title: Re: Combine old OpenGl with GLSL Version 330 or more
Post by: Maetschl on May 15, 2016, 17:00:59
SGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above

:-\

im on mac, so i can't?   :'(
Title: Re: Combine old OpenGl with GLSL Version 330 or more
Post by: Kai on May 15, 2016, 17:19:54
I'm afraid, yes. OS X is the only platform that does not support/implement the compatibility profile, which you need when you want to have both legacy OpenGL (immediate mode, client-side vertex arrays, ...) as well as modern OpenGL (i.e. everything starting with version 3.0).
Title: Re: Combine old OpenGl with GLSL Version 330 or more
Post by: Maetschl on May 15, 2016, 17:40:54
Thanks Kai !

I think I'll pass all code to modern GL :) cry.  :'(