Skip to content

Commit 4a368cb

Browse files
committed
updated to api33 and es 320 for objects.
1 parent 5e4bda6 commit 4a368cb

File tree

6 files changed

+32
-27
lines changed

6 files changed

+32
-27
lines changed

HelloOpenGLES32/.idea/gradle.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HelloOpenGLES32/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 32
4+
compileSdkVersion 33
55

66
defaultConfig {
77
applicationId "edu.cs4730.helloopengles32"
88
minSdkVersion 26
9-
targetSdkVersion 32
9+
targetSdkVersion 33
1010
versionCode 1
1111
versionName "1.0"
1212
}

HelloOpenGLES32/app/src/main/java/edu/cs4730/helloopengles32/Square.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,31 @@
2323
import android.opengl.GLES32;
2424

2525
/**
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.2.
2727
*/
2828
public class Square {
2929

3030
private final String vertexShaderCode =
3131
// This matrix member variable provides a hook to manipulate
3232
// the coordinates of the objects that use this vertex shader
33-
"uniform mat4 uMVPMatrix;" +
34-
"attribute vec4 vPosition;" +
35-
"void main() {" +
36-
// The matrix must be included as a modifier of gl_Position.
33+
"#version 320 es\n"+
34+
"uniform mat4 uMVPMatrix;\n" +
35+
"in vec4 vPosition;\n" +
36+
"void main() {\n" +
37+
// the matrix must be included as a modifier of gl_Position
3738
// Note that the uMVPMatrix factor *must be first* in order
3839
// for the matrix multiplication product to be correct.
39-
" gl_Position = uMVPMatrix * vPosition;" +
40-
"}";
40+
" gl_Position = uMVPMatrix * vPosition;\n" +
41+
"}\n";
4142

4243
private final String fragmentShaderCode =
43-
"precision mediump float;" +
44-
"uniform vec4 vColor;" +
45-
"void main() {" +
46-
" gl_FragColor = vColor;" +
47-
"}";
44+
"#version 320 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";
4851

4952
private final FloatBuffer vertexBuffer;
5053
private final ShortBuffer drawListBuffer;

HelloOpenGLES32/app/src/main/java/edu/cs4730/helloopengles32/Triangle.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,24 @@ public class Triangle {
2929
private final String vertexShaderCode =
3030
// This matrix member variable provides a hook to manipulate
3131
// the coordinates of the objects that use this vertex shader
32-
"uniform mat4 uMVPMatrix;" +
33-
"attribute vec4 vPosition;" +
34-
"void main() {" +
32+
"#version 320 es\n"+
33+
"uniform mat4 uMVPMatrix;\n" +
34+
"in vec4 vPosition;\n" +
35+
"void main() {\n" +
3536
// the matrix must be included as a modifier of gl_Position
3637
// Note that the uMVPMatrix factor *must be first* in order
3738
// for the matrix multiplication product to be correct.
38-
" gl_Position = uMVPMatrix * vPosition;" +
39-
"}";
39+
" gl_Position = uMVPMatrix * vPosition;\n" +
40+
"}\n";
4041

4142
private final String fragmentShaderCode =
42-
"precision mediump float;" +
43-
"uniform vec4 vColor;" +
44-
"void main() {" +
45-
" gl_FragColor = vColor;" +
46-
"}";
43+
"#version 320 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";
4750

4851
private final FloatBuffer vertexBuffer;
4952
private final int mProgram;

HelloOpenGLES32/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

HelloOpenGLES32/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
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

0 commit comments

Comments
 (0)