|
23 | 23 | import android.opengl.GLES30;
|
24 | 24 |
|
25 | 25 | /**
|
26 |
| - * A two-dimensional square for use as a drawn object in OpenGL ES 3.1. |
27 |
| - * I actually can get 3.0 to work. confusing. |
| 26 | + * A two-dimensional square for use as a drawn object in OpenGL ES 3.0. |
28 | 27 | */
|
29 | 28 | public class Square {
|
30 | 29 |
|
31 | 30 | private final String vertexShaderCode =
|
32 |
| - // This matrix member variable provides a hook to manipulate |
33 |
| - // the coordinates of the objects that use this vertex shader |
34 |
| - "#version 310 es\n"+ |
35 |
| - "uniform mat4 uMVPMatrix;\n" + |
36 |
| - "in vec4 vPosition;\n" + |
37 |
| - "void main() {\n" + |
38 |
| - // The matrix must be included as a modifier of gl_Position. |
39 |
| - // Note that the uMVPMatrix factor *must be first* in order |
40 |
| - // for the matrix multiplication product to be correct. |
41 |
| - " gl_Position = uMVPMatrix * vPosition;\n" + |
42 |
| - "}\n"; |
| 31 | + "#version 300 es \n" |
| 32 | + + "uniform mat4 uMVPMatrix; \n" |
| 33 | + + "in vec4 vPosition; \n" |
| 34 | + + "void main() \n" |
| 35 | + + "{ \n" |
| 36 | + + " gl_Position = uMVPMatrix * vPosition; \n" |
| 37 | + + "} \n"; |
43 | 38 |
|
44 | 39 | private final String fragmentShaderCode =
|
45 |
| - "#version 310 es \n"+ |
46 |
| - "precision mediump float; \n" + |
47 |
| - "in uniform vec4 vColor;\n" + |
48 |
| - "out vec4 gl_FragColor;\n" + |
49 |
| - "void main() {\n" + |
50 |
| - " gl_FragColor = vColor;\n" + |
51 |
| - "}\n"; |
| 40 | + "#version 300 es \n" |
| 41 | + + "precision mediump float; \n" |
| 42 | + + "uniform vec4 vColor; \n" |
| 43 | + + "out vec4 fragColor; \n" |
| 44 | + + "void main() \n" |
| 45 | + + "{ \n" |
| 46 | + + " fragColor = vColor; \n" |
| 47 | + + "} \n"; |
52 | 48 |
|
53 | 49 | private final FloatBuffer vertexBuffer;
|
54 | 50 | private final ShortBuffer drawListBuffer;
|
|
0 commit comments