Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/libEGL.dll
Binary file not shown.
Binary file added app/libGLESv2.dll
Binary file not shown.
Binary file added app/vulkan-1.dll
Binary file not shown.
41 changes: 41 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.internal.os.OperatingSystem

plugins {
id("java")
Expand Down Expand Up @@ -28,13 +29,53 @@ sourceSets{
}
}

val lwjglVersion = "3.3.6"

val lwjglNatives = Pair(
System.getProperty("os.name")!!,
System.getProperty("os.arch")!!
).let { (name, arch) ->
when {
arrayOf("Linux", "SunOS", "Unit").any { name.startsWith(it) } ->
if (arrayOf("arm", "aarch64").any { arch.startsWith(it) })
"natives-linux${if (arch.contains("64") || arch.startsWith("armv8")) "-arm64" else "-arm32"}"
else if (arch.startsWith("ppc"))
"natives-linux-ppc64le"
else if (arch.startsWith("riscv"))
"natives-linux-riscv64"
else
"natives-linux"
arrayOf("Mac OS X", "Darwin").any { name.startsWith(it) } ->
"natives-macos${if (arch.startsWith("aarch64")) "-arm64" else ""}"
arrayOf("Windows").any { name.startsWith(it) } ->
"natives-windows"
else ->
throw Error("Unrecognized or unsupported platform. Please set \"lwjglNatives\" manually")
}
}

dependencies {
implementation(libs.jogl)
implementation(libs.gluegen)

// TODO: Improve this
implementation(files("library/JavaANGLE.jar"))
testImplementation(libs.junit)

// LWJGL
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
implementation("org.lwjgl", "lwjgl")
implementation("org.lwjgl", "lwjgl-egl")
implementation("org.lwjgl", "lwjgl-glfw")
implementation("org.lwjgl", "lwjgl-opengles")
implementation ("org.lwjgl", "lwjgl", classifier = lwjglNatives)
implementation ("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)
implementation ("org.lwjgl", "lwjgl-opengles", classifier = lwjglNatives)

}



mavenPublishing{
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
Expand Down
2 changes: 2 additions & 0 deletions core/src/processing/core/PConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public interface PConstants {

String P2D = "processing.opengl.PGraphics2D";
String P3D = "processing.opengl.PGraphics3D";
String P2DANGLE = "processing.opengl.PGraphicsANGLE2D";
String P3DANGLE = "processing.opengl.PGraphicsANGLE3D";

// When will it be time to remove this?
@Deprecated
Expand Down
6 changes: 2 additions & 4 deletions core/src/processing/core/PGraphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@

// Used for color conversion functions
import java.awt.Color;

// Used for the 'image' object that's been here forever
import java.awt.Font;
import java.awt.Image;

import java.io.File;
import java.io.InputStream;
import java.util.Map;
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
Expand Down Expand Up @@ -7589,6 +7586,7 @@ public void colorMode(int mode,
colorModeDefault = (colorMode == RGB) &&
(colorModeA == 255) && (colorModeX == 255) &&
(colorModeY == 255) && (colorModeZ == 255);

}


Expand Down
8 changes: 4 additions & 4 deletions core/src/processing/opengl/FrameBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ protected void initDepthBuffer() {
} else if (depthBits == 24) {
glConst = PGL.DEPTH_COMPONENT24;
} else if (depthBits == 32) {
glConst = PGL.DEPTH_COMPONENT32;
glConst = PGL.DEPTH_COMPONENT32();
}

if (multisample) {
Expand Down Expand Up @@ -474,11 +474,11 @@ protected void initStencilBuffer() {

pgl.bindRenderbuffer(PGL.RENDERBUFFER, glStencil);

int glConst = PGL.STENCIL_INDEX1;
int glConst = PGL.STENCIL_INDEX1();
if (stencilBits == 1) {
glConst = PGL.STENCIL_INDEX1;
glConst = PGL.STENCIL_INDEX1();
} else if (stencilBits == 4) {
glConst = PGL.STENCIL_INDEX4;
glConst = PGL.STENCIL_INDEX4();
} else if (stencilBits == 8) {
glConst = PGL.STENCIL_INDEX8;
}
Expand Down
130 changes: 99 additions & 31 deletions core/src/processing/opengl/PGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ private void createDepthAndStencilBuffer(boolean multisample, int depthBits,
if (0 < depthBits) {
int depthComponent = DEPTH_COMPONENT16;
if (depthBits == 32) {
depthComponent = DEPTH_COMPONENT32;
depthComponent = DEPTH_COMPONENT32();
} else if (depthBits == 24) {
depthComponent = DEPTH_COMPONENT24;
//} else if (depthBits == 16) {
Expand All @@ -1141,11 +1141,11 @@ private void createDepthAndStencilBuffer(boolean multisample, int depthBits,
}

if (0 < stencilBits) {
int stencilIndex = STENCIL_INDEX1;
int stencilIndex = STENCIL_INDEX1();
if (stencilBits == 8) {
stencilIndex = STENCIL_INDEX8;
} else if (stencilBits == 4) {
stencilIndex = STENCIL_INDEX4;
stencilIndex = STENCIL_INDEX4();
//} else if (stencilBits == 1) {
//stencilIndex = STENCIL_INDEX1;
}
Expand Down Expand Up @@ -1195,7 +1195,7 @@ protected boolean contextIsCurrent(int other) {
protected void enableTexturing(int target) {
if (target == TEXTURE_2D) {
texturingTargets[0] = true;
} else if (target == TEXTURE_RECTANGLE) {
} else if (target == TEXTURE_RECTANGLE()) {
texturingTargets[1] = true;
}
}
Expand All @@ -1204,7 +1204,7 @@ protected void enableTexturing(int target) {
protected void disableTexturing(int target) {
if (target == TEXTURE_2D) {
texturingTargets[0] = false;
} else if (target == TEXTURE_RECTANGLE) {
} else if (target == TEXTURE_RECTANGLE()) {
texturingTargets[1] = false;
}
}
Expand All @@ -1213,7 +1213,7 @@ protected void disableTexturing(int target) {
protected boolean texturingIsEnabled(int target) {
if (target == TEXTURE_2D) {
return texturingTargets[0];
} else if (target == TEXTURE_RECTANGLE) {
} else if (target == TEXTURE_RECTANGLE()) {
return texturingTargets[1];
} else {
return false;
Expand All @@ -1226,7 +1226,7 @@ protected boolean textureIsBound(int target, int id) {

if (target == TEXTURE_2D) {
return boundTextures[activeTexUnit][0] == id;
} else if (target == TEXTURE_RECTANGLE) {
} else if (target == TEXTURE_RECTANGLE()) {
return boundTextures[activeTexUnit][1] == id;
} else {
return false;
Expand Down Expand Up @@ -1317,7 +1317,7 @@ public void drawTexture(int target, int id,int texW, int texH,
viewX, viewY, viewW, viewH, viewF,
texX0, texY0, texX1, texY1,
scrX0, scrY0, scrX1, scrY1);
} else if (target == TEXTURE_RECTANGLE) {
} else if (target == TEXTURE_RECTANGLE()) {
drawTextureRect(id, texW, texH,
viewX, viewY, viewW, viewH, viewF,
texX0, texY0, texX1, texY1,
Expand Down Expand Up @@ -1550,11 +1550,11 @@ protected void drawTextureRect(int id, int texW, int texH,

activeTexture(TEXTURE0);
boolean enabledTex = false;
if (!texturingIsEnabled(TEXTURE_RECTANGLE)) {
enableTexturing(TEXTURE_RECTANGLE);
if (!texturingIsEnabled(TEXTURE_RECTANGLE())) {
enableTexturing(TEXTURE_RECTANGLE());
enabledTex = true;
}
bindTexture(TEXTURE_RECTANGLE, id);
bindTexture(TEXTURE_RECTANGLE(), id);
uniform1i(ppgl.texRectSamplerLoc, 0);

texData.position(0);
Expand All @@ -1568,9 +1568,9 @@ protected void drawTextureRect(int id, int texW, int texH,

bindBuffer(ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point.

bindTexture(TEXTURE_RECTANGLE, 0);
bindTexture(TEXTURE_RECTANGLE(), 0);
if (enabledTex) {
disableTexturing(TEXTURE_RECTANGLE);
disableTexturing(TEXTURE_RECTANGLE());
}

disableVertexAttribArray(ppgl.texRectVertLoc);
Expand Down Expand Up @@ -2122,11 +2122,11 @@ protected int validateFramebuffer() {
System.err.printf((FRAMEBUFFER_ERROR) + "%n", "incomplete missing attachment");
} else if (status == FRAMEBUFFER_INCOMPLETE_DIMENSIONS) {
System.err.printf((FRAMEBUFFER_ERROR) + "%n", "incomplete dimensions");
} else if (status == FRAMEBUFFER_INCOMPLETE_FORMATS) {
} else if (status == FRAMEBUFFER_INCOMPLETE_FORMATS()) {
System.err.printf((FRAMEBUFFER_ERROR) + "%n", "incomplete formats");
} else if (status == FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER) {
} else if (status == FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER()) {
System.err.printf((FRAMEBUFFER_ERROR) + "%n", "incomplete draw buffer");
} else if (status == FRAMEBUFFER_INCOMPLETE_READ_BUFFER) {
} else if (status == FRAMEBUFFER_INCOMPLETE_READ_BUFFER()) {
System.err.printf((FRAMEBUFFER_ERROR) + "%n", "incomplete read buffer");
} else if (status == FRAMEBUFFER_UNSUPPORTED) {
System.err.printf((FRAMEBUFFER_ERROR) + "%n", "framebuffer unsupported");
Expand Down Expand Up @@ -2789,6 +2789,74 @@ protected interface FontOutline {
void next();
}

public static int ALPHA8() {
System.out.println("UNAVAILABLE ENUM ALPHA8");
return 0;
}
public static int GENERATE_MIPMAP_HINT() {
System.out.println("UNAVAILABLE ENUM GENERATE_MIPMAP_HINT");
return 0;
}
public static int TEXTURE_RECTANGLE() {
System.out.println("UNAVAILABLE ENUM TEXTURE_RECTANGLE");
return 0;
}
public static int TEXTURE_MAX_ANISOTROPY() {
System.out.println("UNAVAILABLE ENUM TEXTURE_MAX_ANISOTROPY");
return 0;
}
public static int MAX_TEXTURE_MAX_ANISOTROPY() {
System.out.println("UNAVAILABLE ENUM MAX_TEXTURE_MAX_ANISOTROPY");
return 0;
}

public static int DEPTH_COMPONENT32() {
System.out.println("UNAVAILABLE ENUM DEPTH_COMPONENT32");
return 0;
}

public static int STENCIL_INDEX1() {
System.out.println("UNAVAILABLE ENUM STENCIL_INDEX1");
return 0;
}

public static int STENCIL_INDEX4() {
System.out.println("UNAVAILABLE ENUM STENCIL_INDEX4");
return 0;
}
public static int FRAMEBUFFER_INCOMPLETE_FORMATS() {
System.out.println("UNAVAILABLE ENUM FRAMEBUFFER_INCOMPLETE_FORMATS");
return 0;
}

public static int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER() {
System.out.println("UNAVAILABLE ENUM FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER");
return 0;
}

public static int FRAMEBUFFER_INCOMPLETE_READ_BUFFER() {
System.out.println("UNAVAILABLE ENUM FRAMEBUFFER_INCOMPLETE_READ_BUFFER");
return 0;
}


public static int MULTISAMPLE() {
System.out.println("UNAVAILABLE ENUM MULTISAMPLE");
return 0;
}

public static int LINE_SMOOTH() {
System.out.println("UNAVAILABLE ENUM LINE_SMOOTH");
return 0;
}

public static int POLYGON_SMOOTH() {
System.out.println("UNAVAILABLE ENUM POLYGON_SMOOTH");
return 0;
}




//////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -2852,7 +2920,7 @@ protected interface FontOutline {
public static int RGB565;
public static int RGB8;
public static int RGBA8;
public static int ALPHA8;
// public static int ALPHA8;

public static int READ_ONLY;
public static int WRITE_ONLY;
Expand All @@ -2862,7 +2930,7 @@ protected interface FontOutline {
public static int TESS_WINDING_ODD;
public static int TESS_EDGE_FLAG;

public static int GENERATE_MIPMAP_HINT;
// public static int GENERATE_MIPMAP_HINT;
public static int FASTEST;
public static int NICEST;
public static int DONT_CARE;
Expand Down Expand Up @@ -2920,14 +2988,14 @@ protected interface FontOutline {
public static int PACK_ALIGNMENT;

public static int TEXTURE_2D;
public static int TEXTURE_RECTANGLE;
// public static int TEXTURE_RECTANGLE;

public static int TEXTURE_BINDING_2D;
public static int TEXTURE_BINDING_RECTANGLE;

public static int MAX_TEXTURE_SIZE;
public static int TEXTURE_MAX_ANISOTROPY;
public static int MAX_TEXTURE_MAX_ANISOTROPY;
// public static int TEXTURE_MAX_ANISOTROPY;
// public static int MAX_TEXTURE_MAX_ANISOTROPY;

public static int MAX_VERTEX_TEXTURE_IMAGE_UNITS;
public static int MAX_TEXTURE_IMAGE_UNITS;
Expand Down Expand Up @@ -3074,11 +3142,11 @@ protected interface FontOutline {
public static int DEPTH_COMPONENT;
public static int DEPTH_COMPONENT16;
public static int DEPTH_COMPONENT24;
public static int DEPTH_COMPONENT32;
// public static int DEPTH_COMPONENT32;

public static int STENCIL_INDEX;
public static int STENCIL_INDEX1;
public static int STENCIL_INDEX4;
// public static int STENCIL_INDEX1;
// public static int STENCIL_INDEX4;
public static int STENCIL_INDEX8;

public static int DEPTH_STENCIL;
Expand All @@ -3088,9 +3156,9 @@ protected interface FontOutline {
public static int FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
public static int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
public static int FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
public static int FRAMEBUFFER_INCOMPLETE_FORMATS;
public static int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER;
public static int FRAMEBUFFER_INCOMPLETE_READ_BUFFER;
// public static int FRAMEBUFFER_INCOMPLETE_FORMATS;
// public static int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER;
// public static int FRAMEBUFFER_INCOMPLETE_READ_BUFFER;
public static int FRAMEBUFFER_UNSUPPORTED;
public static int FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
public static int FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS;
Expand All @@ -3110,9 +3178,9 @@ protected interface FontOutline {
public static int RENDERBUFFER_STENCIL_SIZE;
public static int RENDERBUFFER_INTERNAL_FORMAT;

public static int MULTISAMPLE;
public static int LINE_SMOOTH;
public static int POLYGON_SMOOTH;
// public static int MULTISAMPLE;
// public static int LINE_SMOOTH;
// public static int POLYGON_SMOOTH;

public static int SYNC_GPU_COMMANDS_COMPLETE;
public static int ALREADY_SIGNALED;
Expand Down Expand Up @@ -3307,7 +3375,7 @@ public void bindTexture(int target, int texture) {

if (target == TEXTURE_2D) {
boundTextures[activeTexUnit][0] = texture;
} else if (target == TEXTURE_RECTANGLE) {
} else if (target == TEXTURE_RECTANGLE()) {
boundTextures[activeTexUnit][1] = texture;
}
}
Expand Down
Loading