Skip to content

Commit 386a042

Browse files
committed
android opengl renderer sync
1 parent 94d55f7 commit 386a042

File tree

12 files changed

+2104
-1804
lines changed

12 files changed

+2104
-1804
lines changed

core/src/processing/core/PGraphics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public class PGraphics extends PImage implements PConstants {
526526
// ........................................................
527527

528528
protected boolean curveInited = false;
529-
protected int curveDetail = 20;
529+
public int curveDetail = 20;
530530
public float curveTightness = 0;
531531
// catmull-rom basis matrix, perhaps with optional s parameter
532532
protected PMatrix3D curveBasisMatrix;

core/src/processing/opengl/ColorVert.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020

2121
#define PROCESSING_COLOR_SHADER
2222

23-
uniform mat4 transform;
23+
uniform mat4 transformMatrix;
2424

25-
attribute vec4 vertex;
25+
attribute vec4 position;
2626
attribute vec4 color;
2727

2828
varying vec4 vertColor;
2929

3030
void main() {
31-
gl_Position = transform * vertex;
31+
gl_Position = transformMatrix * position;
3232

3333
vertColor = color;
3434
}

core/src/processing/opengl/LightVert.glsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
#define PROCESSING_LIGHT_SHADER
2222

23-
uniform mat4 modelview;
24-
uniform mat4 transform;
23+
uniform mat4 modelviewMatrix;
24+
uniform mat4 transformMatrix;
2525
uniform mat3 normalMatrix;
2626

2727
uniform int lightCount;
@@ -33,7 +33,7 @@ uniform vec3 lightSpecular[8];
3333
uniform vec3 lightFalloff[8];
3434
uniform vec2 lightSpot[8];
3535

36-
attribute vec4 vertex;
36+
attribute vec4 position;
3737
attribute vec4 color;
3838
attribute vec3 normal;
3939

@@ -75,10 +75,10 @@ float blinnPhongFactor(vec3 lightDir, vec3 vertPos, vec3 vecNormal, float shine)
7575

7676
void main() {
7777
// Vertex in clip coordinates
78-
gl_Position = transform * vertex;
78+
gl_Position = transformMatrix * position;
7979

8080
// Vertex in eye coordinates
81-
vec3 ecVertex = vec3(modelview * vertex);
81+
vec3 ecVertex = vec3(modelviewMatrix * position);
8282

8383
// Normal vector in eye coordinates
8484
vec3 ecNormal = normalize(normalMatrix * normal);

core/src/processing/opengl/LineVert.glsl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
#define PROCESSING_LINE_SHADER
2222

23-
uniform mat4 modelview;
24-
uniform mat4 projection;
23+
uniform mat4 modelviewMatrix;
24+
uniform mat4 projectionMatrix;
2525

2626
uniform vec4 viewport;
2727
uniform int perspective;
2828
uniform vec3 scale;
2929

30-
attribute vec4 vertex;
30+
attribute vec4 position;
3131
attribute vec4 color;
3232
attribute vec4 direction;
3333

@@ -45,20 +45,20 @@ vec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {
4545
}
4646

4747
void main() {
48-
vec4 posp = modelview * vertex;
48+
vec4 posp = modelviewMatrix * position;
4949

5050
// Moving vertices slightly toward the camera
5151
// to avoid depth-fighting with the fill triangles.
5252
// Discussed here:
5353
// http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848
5454
posp.xyz = posp.xyz * scale;
55-
vec4 clipp = projection * posp;
55+
vec4 clipp = projectionMatrix * posp;
5656
float thickness = direction.w;
5757

5858
if (thickness != 0.0) {
59-
vec4 posq = posp + modelview * vec4(direction.xyz, 0);
59+
vec4 posq = posp + modelviewMatrix * vec4(direction.xyz, 0);
6060
posq.xyz = posq.xyz * scale;
61-
vec4 clipq = projection * posq;
61+
vec4 clipq = projectionMatrix * posq;
6262

6363
vec3 window_p = clipToWindow(clipp, viewport);
6464
vec3 window_q = clipToWindow(clipq, viewport);

core/src/processing/opengl/PGL.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,11 @@ protected int getTextWidth(Object font, char buffer[], int start, int stop) {
19001900
}
19011901

19021902

1903+
protected Object getDerivedFont(Object font, float size) {
1904+
return null;
1905+
}
1906+
1907+
19031908
///////////////////////////////////////////////////////////
19041909

19051910
// Tessellator interface

core/src/processing/opengl/PGraphics2D.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void frustum(float left, float right, float bottom, float top,
119119

120120
@Override
121121
protected void defaultPerspective() {
122-
super.ortho(0, width, 0, height, -1, +1);
122+
super.ortho(width/2f, (3f/2f) * width, -height/2f, height/2f, -1, +1);
123123
}
124124

125125

@@ -156,7 +156,7 @@ public void camera(float eyeX, float eyeY, float eyeZ,
156156

157157
@Override
158158
protected void defaultCamera() {
159-
super.camera(width/2f, height/2f);
159+
resetMatrix();
160160
}
161161

162162

@@ -180,6 +180,12 @@ protected void end2D() {
180180
popProjection();
181181
}
182182

183+
// @Override
184+
// public void resetMatrix() {
185+
// super.resetMatrix();
186+
// defaultCamera();
187+
// }
188+
183189

184190
//////////////////////////////////////////////////////////////
185191

0 commit comments

Comments
 (0)