Пример #1
0
 public static void deleteCGResource(Object id, int type) {
   if (type == CG_CONTEXT) {
     if (cgContexts.contains(id)) {
       CgGL.cgDestroyContext((CGcontext) id);
       cgContexts.remove(id);
     }
   } else if (type == CG_PROGRAM) {
     if (cgPrograms.contains(id)) {
       CgGL.cgDestroyProgram((CGprogram) id);
       cgPrograms.remove(id);
     }
   } else if (type == CG_EFFECT) {
     if (cgEffects.contains(id)) {
       CgGL.cgDestroyEffect((CGeffect) id);
       cgEffects.remove(id);
     }
   }
 }
Пример #2
0
 public static void deleteGLResource(int id, int type) {
   if (type == GL_TEXTURE_OBJECT) {
     if (glTextureObjects.contains(id)) {
       int[] temp = {id};
       gl.glDeleteTextures(1, temp, 0);
       glTextureObjects.remove(id);
     }
   } else if (type == GL_VERTEX_BUFFER) {
     if (glVertexBuffers.contains(id)) {
       int[] temp = {id};
       gl.glDeleteBuffersARB(1, temp, 0);
       glVertexBuffers.remove(id);
     }
   } else if (type == GL_FRAME_BUFFER) {
     if (glFrameBuffers.contains(id)) {
       int[] temp = {id};
       gl.glDeleteFramebuffersEXT(1, temp, 0);
       glFrameBuffers.remove(id);
     }
   } else if (type == GL_RENDER_BUFFER) {
     if (glRenderBuffers.contains(id)) {
       int[] temp = {id};
       gl.glDeleteRenderbuffersEXT(1, temp, 0);
       glRenderBuffers.remove(id);
     }
   } else if (type == GLSL_PROGRAM) {
     if (glslPrograms.contains(id)) {
       gl.glDeleteProgram(id);
       glslPrograms.remove(id);
     }
   } else if (type == GLSL_SHADER) {
     if (glslShaders.contains(id)) {
       gl.glDeleteShader(id);
       glslShaders.remove(id);
     }
   }
 }