/[zanavi_public1]/navit/navit/android/src/com/zoffcc/applications/zanavi/GlRenderer.java
ZANavi

Contents of /navit/navit/android/src/com/zoffcc/applications/zanavi/GlRenderer.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 41 - (show annotations) (download)
Tue Aug 11 18:50:37 2015 UTC (8 years, 8 months ago) by zoff99
File size: 1157 byte(s)
many fixes, and new features
1 package com.zoffcc.applications.zanavi;
2
3 import javax.microedition.khronos.egl.EGLConfig;
4 import javax.microedition.khronos.opengles.GL10;
5
6 import android.opengl.GLES20;
7 import android.opengl.GLSurfaceView.Renderer;
8
9 public class GlRenderer implements Renderer
10 {
11
12 @Override
13 public void onDrawFrame(GL10 gl)
14 {
15 }
16
17 @Override
18 public void onSurfaceChanged(GL10 gl, int width, int height)
19 {
20 }
21
22 @Override
23 public void onSurfaceCreated(GL10 gl, EGLConfig config)
24 {
25 }
26
27 public static int loadShader(int type, String shaderCode)
28 {
29
30 // create a vertex shader type (GLES20.GL_VERTEX_SHADER)
31 // or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
32 int shader = GLES20.glCreateShader(type);
33
34 // add the source code to the shader and compile it
35 GLES20.glShaderSource(shader, shaderCode);
36 GLES20.glCompileShader(shader);
37
38 return shader;
39 }
40
41 public static void checkGlError(String op)
42 {
43 int error;
44 while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR)
45 {
46 System.out.println("opengl:" + op + ": glError " + error);
47 throw new RuntimeException(op + ": glError " + error);
48 }
49 }
50 }

   
Visit the ZANavi Wiki