Tabnine Logo
ShaderUtil.readRawTextFileFromAssets
Code IndexAdd Tabnine to your IDE (free)

How to use
readRawTextFileFromAssets
method
in
com.novoda.spikes.arcore.google.rendering.ShaderUtil

Best Java code snippets using com.novoda.spikes.arcore.google.rendering.ShaderUtil.readRawTextFileFromAssets (Showing top 2 results out of 315)

origin: novoda/spikes

/**
 * Converts a raw text file, saved as a resource, into an OpenGL ES shader.
 *
 * @param type     The type of shader we will be creating.
 * @param filename The filename of the asset file about to be turned into a shader.
 * @return The shader object handler.
 */
public static int loadGLShader(String tag, Context context, int type, String filename)
    throws IOException {
  String code = readRawTextFileFromAssets(context, filename);
  int shader = GLES20.glCreateShader(type);
  GLES20.glShaderSource(shader, code);
  GLES20.glCompileShader(shader);
  // Get the compilation status.
  final int[] compileStatus = new int[1];
  GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compileStatus, 0);
  // If the compilation failed, delete the shader.
  if (compileStatus[0] == 0) {
    Log.e(tag, "Error compiling shader: " + GLES20.glGetShaderInfoLog(shader));
    GLES20.glDeleteShader(shader);
    shader = 0;
  }
  if (shader == 0) {
    throw new RuntimeException("Error creating shader.");
  }
  return shader;
}
origin: novoda/spikes

/**
 * Converts a raw text file, saved as a resource, into an OpenGL ES shader.
 *
 * @param type     The type of shader we will be creating.
 * @param filename The filename of the asset file about to be turned into a shader.
 * @return The shader object handler.
 */
public static int loadGLShader(String tag, Context context, int type, String filename)
    throws IOException {
  String code = readRawTextFileFromAssets(context, filename);
  int shader = GLES20.glCreateShader(type);
  GLES20.glShaderSource(shader, code);
  GLES20.glCompileShader(shader);
  // Get the compilation status.
  final int[] compileStatus = new int[1];
  GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compileStatus, 0);
  // If the compilation failed, delete the shader.
  if (compileStatus[0] == 0) {
    Log.e(tag, "Error compiling shader: " + GLES20.glGetShaderInfoLog(shader));
    GLES20.glDeleteShader(shader);
    shader = 0;
  }
  if (shader == 0) {
    throw new RuntimeException("Error creating shader.");
  }
  return shader;
}
com.novoda.spikes.arcore.google.renderingShaderUtilreadRawTextFileFromAssets

Javadoc

Converts a raw text file into a string.

Popular methods of ShaderUtil

  • checkGLError
    Checks if we've had an error inside of OpenGL ES, and if so what that error is.
  • loadGLShader
    Converts a raw text file, saved as a resource, into an OpenGL ES shader.

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • JComboBox (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now