Skip to content

Commit 0bda61b

Browse files
committed
fixed it, back to 3.0 es code.
1 parent 3519bdf commit 0bda61b

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

HelloOpenGLES30/app/src/main/java/com/example/android/opengl30/Square.java

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,28 @@
2323
import android.opengl.GLES30;
2424

2525
/**
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.
2827
*/
2928
public class Square {
3029

3130
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";
4338

4439
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";
5248

5349
private final FloatBuffer vertexBuffer;
5450
private final ShortBuffer drawListBuffer;

HelloOpenGLES30/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
9+
classpath 'com.android.tools.build:gradle:7.4.0'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files

0 commit comments

Comments
 (0)