Combine old OpenGl with GLSL Version 330 or more

Started by Maetschl, May 15, 2016, 15:16:14

Previous topic - Next topic

Maetschl

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!

Kai

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);

Maetschl

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?   :'(

Kai

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).

Maetschl

Thanks Kai !

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