Skip to content
Merged
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
20 changes: 20 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,26 @@ dependencies {
implementation(libs.jogl)
implementation(libs.gluegen)

val lwjglVersion = "3.3.6"
val lwjglNatives = when {
System.getProperty("os.name").lowercase().contains("mac") -> {
if (System.getProperty("os.arch").contains("aarch64")) {
"natives-macos-arm64"
} else {
"natives-macos"
}
}
System.getProperty("os.name").lowercase().contains("win") -> "natives-windows"
System.getProperty("os.name").lowercase().contains("linux") -> "natives-linux"
else -> "natives-linux"
}

implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))
implementation("org.lwjgl", "lwjgl")
implementation("org.lwjgl", "lwjgl-glfw")
runtimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)

testImplementation(libs.junit)
}

Expand Down
8 changes: 4 additions & 4 deletions core/src/processing/core/PApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -9981,10 +9981,6 @@ static public void runSketch(final String[] args,
}
break;

case ARGS_DISABLE_AWT:
disableAWT = true;
break;

case ARGS_WINDOW_COLOR:
if (value.charAt(0) == '#' && value.length() == 7) {
value = value.substring(1);
Expand Down Expand Up @@ -10036,6 +10032,10 @@ static public void runSketch(final String[] args,
fullScreen = true;
break;

case ARGS_DISABLE_AWT:
disableAWT = true;
break;

default:
name = args[argIndex];
break label; // because of break, argIndex won't increment again
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 @@ -72,6 +72,8 @@ public interface PConstants {
// Experimental JavaFX renderer; even better 2D performance
String FX2D = "processing.javafx.PGraphicsFX2D";

String WEBGPU = "processing.webgpu.PGraphicsWebGPU";

String PDF = "processing.pdf.PGraphicsPDF";
String SVG = "processing.svg.PGraphicsSVG";
String DXF = "processing.dxf.RawDXF";
Expand Down
39 changes: 38 additions & 1 deletion core/src/processing/webgpu/PGraphicsWebGPU.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
package processing.webgpu;

public class PGraphicsWebGPU {
import processing.core.PGraphics;
import processing.core.PSurface;

public class PGraphicsWebGPU extends PGraphics {
private long windowId = 0;

@Override
public PSurface createSurface() {
return surface = new PSurfaceGLFW(this);
}

protected void initWebGPUSurface(long windowHandle, int width, int height, float scaleFactor) {
windowId = PWebGPU.createSurface(windowHandle, width, height, scaleFactor);
if (windowId == 0) {
System.err.println("Failed to create WebGPU surface");
}
}

@Override
public void setSize(int w, int h) {
super.setSize(w, h);
if (windowId != 0) {
PWebGPU.windowResized(windowId, pixelWidth, pixelHeight);
}
}

@Override
public void endDraw() {
super.endDraw();
PWebGPU.update();
}

@Override
public void dispose() {
super.dispose();

PWebGPU.exit();
}
}
Loading