File tree Expand file tree Collapse file tree 6 files changed +31
-26
lines changed
src/main/java/edu/cs4730/helloopengles31 Expand file tree Collapse file tree 6 files changed +31
-26
lines changed Original file line number Diff line number Diff line change 1
1
apply plugin : ' com.android.application'
2
2
3
3
android {
4
- compileSdkVersion 32
4
+ compileSdkVersion 33
5
5
6
6
defaultConfig {
7
7
applicationId " edu.cs4730.helloopengles31"
8
8
minSdkVersion 26
9
- targetSdkVersion 32
9
+ targetSdkVersion 33
10
10
versionCode 1
11
11
versionName " 1.0"
12
12
}
Original file line number Diff line number Diff line change 23
23
import android .opengl .GLES31 ;
24
24
25
25
/**
26
- * A two-dimensional square for use as a drawn object in OpenGL ES 2.0.
26
+ * A two-dimensional square for use as a drawn object in OpenGL ES 3.1
27
27
*/
28
28
public class Square {
29
29
30
30
private final String vertexShaderCode =
31
31
// This matrix member variable provides a hook to manipulate
32
32
// the coordinates of the objects that use this vertex shader
33
- "uniform mat4 uMVPMatrix;" +
34
- "attribute vec4 vPosition;" +
35
- "void main() {" +
33
+ "#version 310 es\n " +
34
+ "uniform mat4 uMVPMatrix;\n " +
35
+ "in vec4 vPosition;\n " +
36
+ "void main() {\n " +
36
37
// The matrix must be included as a modifier of gl_Position.
37
38
// Note that the uMVPMatrix factor *must be first* in order
38
39
// for the matrix multiplication product to be correct.
39
- " gl_Position = uMVPMatrix * vPosition;" +
40
- "}" ;
40
+ " gl_Position = uMVPMatrix * vPosition;\n " +
41
+ "}\n " ;
41
42
42
43
private final String fragmentShaderCode =
43
- "precision mediump float;" +
44
- "uniform vec4 vColor;" +
45
- "void main() {" +
46
- " gl_FragColor = vColor;" +
47
- "}" ;
44
+ "#version 310 es \n " +
45
+ "precision mediump float; \n " +
46
+ "in uniform vec4 vColor;\n " +
47
+ "out vec4 gl_FragColor;\n " +
48
+ "void main() {\n " +
49
+ " gl_FragColor = vColor;\n " +
50
+ "}\n " ;
48
51
49
52
private final FloatBuffer vertexBuffer ;
50
53
private final ShortBuffer drawListBuffer ;
Original file line number Diff line number Diff line change @@ -29,21 +29,24 @@ public class Triangle {
29
29
private final String vertexShaderCode =
30
30
// This matrix member variable provides a hook to manipulate
31
31
// the coordinates of the objects that use this vertex shader
32
- "uniform mat4 uMVPMatrix;" +
33
- "attribute vec4 vPosition;" +
34
- "void main() {" +
32
+ "#version 310 es\n " +
33
+ "uniform mat4 uMVPMatrix;\n " +
34
+ "in vec4 vPosition;\n " +
35
+ "void main() {\n " +
35
36
// the matrix must be included as a modifier of gl_Position
36
37
// Note that the uMVPMatrix factor *must be first* in order
37
38
// for the matrix multiplication product to be correct.
38
- " gl_Position = uMVPMatrix * vPosition;" +
39
- "}" ;
39
+ " gl_Position = uMVPMatrix * vPosition;\n " +
40
+ "}\n " ;
40
41
41
42
private final String fragmentShaderCode =
42
- "precision mediump float;" +
43
- "uniform vec4 vColor;" +
44
- "void main() {" +
45
- " gl_FragColor = vColor;" +
46
- "}" ;
43
+ "#version 310 es \n " +
44
+ "precision mediump float; \n " +
45
+ "in uniform vec4 vColor;\n " +
46
+ "out vec4 gl_FragColor;\n " +
47
+ "void main() {\n " +
48
+ " gl_FragColor = vColor;\n " +
49
+ "}\n " ;
47
50
48
51
private final FloatBuffer vertexBuffer ;
49
52
private final int mProgram ;
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ buildscript {
6
6
google()
7
7
}
8
8
dependencies {
9
- classpath ' com.android.tools.build:gradle:7.1.2 '
9
+ classpath ' com.android.tools.build:gradle:7.4.0 '
10
10
11
11
// NOTE: Do not place your application dependencies here; they belong
12
12
// in the individual module build.gradle files
Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3
3
distributionPath =wrapper/dists
4
4
zipStoreBase =GRADLE_USER_HOME
5
5
zipStorePath =wrapper/dists
6
- distributionUrl =https\://services.gradle.org/distributions/gradle-7.2 -all.zip
6
+ distributionUrl =https\://services.gradle.org/distributions/gradle-7.5 -all.zip
You can’t perform that action at this time.
0 commit comments