OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 19 matching lines...) Expand all Loading... |
30 import android.opengl.GLES20; | 30 import android.opengl.GLES20; |
31 | 31 |
32 import java.nio.ByteBuffer; | 32 import java.nio.ByteBuffer; |
33 import java.nio.ByteOrder; | 33 import java.nio.ByteOrder; |
34 import java.nio.FloatBuffer; | 34 import java.nio.FloatBuffer; |
35 | 35 |
36 /** | 36 /** |
37 * Some OpenGL static utility functions. | 37 * Some OpenGL static utility functions. |
38 */ | 38 */ |
39 public class GlUtil { | 39 public class GlUtil { |
40 private static final String TAG = "GlUtil"; | |
41 private GlUtil() {} | 40 private GlUtil() {} |
42 | 41 |
43 // Assert that no OpenGL ES 2.0 error has been raised. | 42 // Assert that no OpenGL ES 2.0 error has been raised. |
44 public static void checkNoGLES2Error(String msg) { | 43 public static void checkNoGLES2Error(String msg) { |
45 int error = GLES20.glGetError(); | 44 int error = GLES20.glGetError(); |
46 if (error != GLES20.GL_NO_ERROR) { | 45 if (error != GLES20.GL_NO_ERROR) { |
47 throw new RuntimeException(msg + ": GLES20 error: " + error); | 46 throw new RuntimeException(msg + ": GLES20 error: " + error); |
48 } | 47 } |
49 } | 48 } |
50 | 49 |
(...skipping 16 matching lines...) Expand all Loading... |
67 final int textureId = textureArray[0]; | 66 final int textureId = textureArray[0]; |
68 GLES20.glBindTexture(target, textureId); | 67 GLES20.glBindTexture(target, textureId); |
69 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEA
R); | 68 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEA
R); |
70 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEA
R); | 69 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEA
R); |
71 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_
EDGE); | 70 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_
EDGE); |
72 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_
EDGE); | 71 GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_
EDGE); |
73 checkNoGLES2Error("generateTexture"); | 72 checkNoGLES2Error("generateTexture"); |
74 return textureId; | 73 return textureId; |
75 } | 74 } |
76 } | 75 } |
OLD | NEW |