Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSuperVGA

Posted 13 October 2012 - 04:52 PM

What do you mean by “restarting” OpenGL?

Ah, I knew that wording would come back and bite me, but it's just the glut and glee initialization, as well as glutGamemode and the setting of the gl callbacks.

Why do you need to “flush” your shaders?

I know that the program loses its references (at least, the gl names don't exist no more) to the video ram when "resetting" as described above,
so I thought I wanted to wipe them before doing so, and then reestablish them afterwards.

How does a shader get “replaced”?

if( vs != 0 ) { glDeleteShader(vs); vs = 0; }
if( fs != 0 ) { glDeleteShader(fs); fs = 0; }
vs = utility::shaders::create_glsl_shader(GL_VERTEX_SHADER, "shader_vtx.txt");
fs = utility::shaders::create_glsl_shader(GL_FRAGMENT_SHADER, "shader_frag.txt");

if( shader_program != 0 ) { glDeleteProgram(shader_program); shader_program = 0; }
shader_program = glCreateProgram();

If this happens frequently and at run-time...

You're right. It's a remainder from when changing the size of a window meant reload some places, but lately it started meaning reshape instead.
The reloading bit doesn't really happen so often, I just like spending much more time making things tidy than making things.

It's nice of you to relieve me of my paranoid memory management fears in relation to shaders. -Thanks! :D

#2SuperVGA

Posted 13 October 2012 - 04:50 PM

What do you mean by “restarting” OpenGL?

Ah, I knew that wording would come back and bite me, but it's just the glut and glee initialization, as well as glutGamemode and the setting of the gl callbacks.

Why do you need to “flush” your shaders?

I know that the program loses its references (at least, the gl names don't exist no more) to the video ram when "resetting" as described above,
so I thought I wanted to wipe them before doing so, and then reestablish them afterwards.

How does a shader get “replaced”?

if( vs != 0 ) { glDeleteShader(vs); vs = 0; }
if( fs != 0 ) { glDeleteShader(fs); fs = 0; }
vs = utility::shaders::create_glsl_shader(GL_VERTEX_SHADER, "shader_vtx.txt");
fs = utility::shaders::create_glsl_shader(GL_FRAGMENT_SHADER, "shader_frag.txt");

if( shader_program != 0 ) { glDeleteProgram(shader_program); shader_program = 0; }
shader_program = glCreateProgram();

If this happens frequently and at run-time...

You're right. It's a remainder from when changing the size of a window meant reload some places, but lately it started meaning reshape instead.
The reloading bit doesn't really happen so often, I just like spending much more time making things tidy than making things.

#1SuperVGA

Posted 13 October 2012 - 04:50 PM

What do you mean by “restarting” OpenGL?

Ah, I knew that wording would come back and bite me, but it's just the glut and glee initialization, as well as glutGamemode and the setting of the gl callbacks.

Why do you need to “flush” your shaders?

I know that the program loses its references (at least, the gl names don't exist no more) to the video ram when "resetting" as described above,
so I thought I wanted to wipe them before doing so, and then reestablish them afterwards.

How does a shader get “replaced”?

if( vs != 0 ) { glDeleteShader(vs); vs = 0; }
if( fs != 0 ) { glDeleteShader(fs); fs = 0; }
vs = utility::shaders::create_glsl_shader(GL_VERTEX_SHADER, "scripts/", "guielement_v.txt");
fs = utility::shaders::create_glsl_shader(GL_FRAGMENT_SHADER, "scripts/", "guielement_f.txt");
 
if( shader_program != 0 ) { glDeleteProgram(shader_program); shader_program = 0; }
shader_program = glCreateProgram();

If this happens frequently and at run-time...

You're right. It's a remainder from when changing the size of a window meant reload some places, but lately it started meaning reshape instead.
The reloading bit doesn't really happen so often, I just like spending much more time making things tidy than making things.

PARTNERS