Эх сурвалжийг харах

remove duplicates

Former-commit-id: 6c2956ef66cb079fc79fc31fcecbf6f9c57aa6da
Alec Jacobson 8 жил өмнө
parent
commit
6aaaaf7843

+ 0 - 42
include/igl/opengl/compile_and_link_program.cpp

@@ -1,42 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#include "compile_and_link_program.h"
-#include "compile_shader.h"
-#include "report_gl_error.h"
-#include <iostream>
-#include <cassert>
-
-
-IGL_INLINE GLuint igl::opengl::compile_and_link_program(
-  const char * v_str, const char * f_str)
-{
-  GLuint vid = compile_shader(GL_VERTEX_SHADER,v_str);
-  GLuint fid = compile_shader(GL_FRAGMENT_SHADER,f_str);
-
-  GLuint prog_id = glCreateProgram();
-  assert(prog_id != 0 && "Failed to create shader.");
-  glAttachShader(prog_id,vid);
-  report_gl_error("glAttachShader (vid): ");
-  glAttachShader(prog_id,fid);
-  report_gl_error("glAttachShader (fid): ");
-
-  glLinkProgram(prog_id);
-  report_gl_error("glLinkProgram: ");
-
-  GLint status;
-  glGetProgramiv(prog_id, GL_LINK_STATUS, &status);
-  if (status != GL_TRUE)
-  {
-    char buffer[512];
-    glGetProgramInfoLog(prog_id, 512, NULL, buffer);
-    std::cerr << "Linker error: " << std::endl << buffer << std::endl;
-    prog_id = 0;
-  }
-  return prog_id;
-}
-

+ 0 - 32
include/igl/opengl/compile_and_link_program.h

@@ -1,32 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_OPENGL_COMPILE_AND_LINK_PROGRAM_H
-#define IGL_OPENGL_COMPILE_AND_LINK_PROGRAM_H
-#include "../igl_inline.h"
-#include "gl.h"
-namespace igl
-{
-  namespace opengl
-  {
-    // Compile and link very simple vertex/fragment shaders
-    //
-    // Inputs:
-    //   v_str  string of vertex shader contents
-    //   f_str  string of fragment shader contents
-    // Returns id of program
-    //
-    // Known bugs: this seems to duplicate `create_shader_program` with less
-    // functionality.
-    IGL_INLINE GLuint compile_and_link_program(
-      const char * v_str, const char * f_str);
-  }
-}
-#ifndef IGL_STATIC_LIBRARY
-#  include "compile_and_link_program.cpp"
-#endif
-#endif

+ 0 - 36
include/igl/opengl/compile_shader.cpp

@@ -1,36 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#include "compile_shader.h"
-#include "report_gl_error.h"
-#include <iostream>
-
-IGL_INLINE GLuint igl::opengl::compile_shader(
-  const GLint type, const char * str)
-{
-  GLuint id = glCreateShader(type);
-  report_gl_error("glCreateShader: ");
-  glShaderSource(id,1,&str,NULL);
-  report_gl_error("glShaderSource: ");
-  glCompileShader(id);
-  report_gl_error("glCompileShader: ");
-
-  GLint status;
-  glGetShaderiv(id, GL_COMPILE_STATUS, &status);
-  if (status != GL_TRUE)
-  {
-    char buffer[512];
-    if (type == GL_VERTEX_SHADER)
-      std::cerr << "Vertex shader:" << std::endl;
-    else if (type == GL_FRAGMENT_SHADER)
-      std::cerr << "Fragment shader:" << std::endl;
-    std::cerr << str << std::endl << std::endl;
-    glGetShaderInfoLog(id, 512, NULL, buffer);
-    std::cerr << "Error: " << std::endl << buffer << std::endl;
-  }
-  return id;
-}

+ 0 - 38
include/igl/opengl/compile_shader.h

@@ -1,38 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_OPENGL_COMPILE_SHADER_H
-#define IGL_OPENGL_COMPILE_SHADER_H
-#include "../igl_inline.h"
-#include "gl.h"
-namespace igl
-{
-  namespace opengl
-  {
-    // Compile a shader given type and string of shader code
-    //
-    // Inputs:
-    //   type  either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER
-    //   str  contents of shader code
-    // Returns result of glCreateShader (id of shader)
-    //
-    // Example:
-    //     GLuint vid = compile_shader(GL_VERTEX_SHADER,vertex_shader.c_str());
-    //     GLuint fid = compile_shader(GL_FRAGMENT_SHADER,fragment_shader.c_str());
-    //     GLuint prog_id = glCreateProgram();
-    //     glAttachShader(prog_id,vid);
-    //     glAttachShader(prog_id,fid);
-    //     glLinkProgram(prog_id);
-    //
-    // Known bugs: seems to be duplicate of `load_shader`
-    IGL_INLINE GLuint compile_shader(const GLint type, const char * str);
-  }
-}
-#ifndef IGL_STATIC_LIBRARY
-#  include "compile_shader.cpp"
-#endif
-#endif