diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp index da5c1f962..1c44efff0 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp @@ -21,6 +21,9 @@ namespace NL3D if( !program->isLinked() ) return false; + + // Release previous program + releaseProgram(); nglUseProgram( program->getProgramId() ); @@ -208,11 +211,12 @@ namespace NL3D void CDriverGL3::releaseProgram() { - delete p; - p = NULL; - vp = NULL; - pp = NULL; + if( currentProgram == NULL ) + return; + + delete currentProgram; currentProgram = NULL; + #ifndef GLSL _VertexProgramEnabled = false; #endif