Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 88cf8d5

Browse files
authored
Merge pull request #47 from LabyMod/develop
Release 0.4.1
2 parents 8b35c89 + a4e83d2 commit 88cf8d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4736
-236
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Using the library with maven:
3838
<groupId>com.labymedia</groupId>
3939
<artifactId>ultralight-java-base</artifactId>
4040
<!-- Replace with latest version from https://search.maven.org/artifact/com.labymedia/ultralight-java-base !-->
41-
<version>0.3.4</version>
41+
<version>0.4.1</version>
4242
</dependency>
4343
```
4444

@@ -48,19 +48,19 @@ If you need Javascript interop:
4848
<groupId>com.labymedia</groupId>
4949
<artifactId>ultralight-java-databind</artifactId>
5050
<!-- Replace with latest version from https://search.maven.org/artifact/com.labymedia/ultralight-java-databind !-->
51-
<version>0.3.4</version>
51+
<version>0.4.1</version>
5252
</dependency>
5353
```
5454

5555
### Gradle
5656
```kotlin
5757
dependencies {
5858
// Replace with latest version from https://search.maven.org/artifact/com.labymedia/ultralight-java-base
59-
implementation("com.labymedia", "ultralight-java-base", "0.3.4")
59+
implementation("com.labymedia", "ultralight-java-base", "0.4.1")
6060

6161
// // Replace with latest version from https://search.maven.org/artifact/com.labymedia/ultralight-java-databind
6262
// Remove the comments if you need Javascript interop
63-
// implementation("com.labymedia", "ultralight-java-databind", "0.3.4")
63+
// implementation("com.labymedia", "ultralight-java-databind", "0.4.1")
6464
}
6565
```
6666

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.4.1

example/lwjgl3-opengl/build.gradle

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.apache.tools.ant.taskdefs.condition.Os
2+
import groovy.json.JsonOutput
23

34
plugins {
45
id 'application'
@@ -34,6 +35,7 @@ dependencies {
3435

3536
implementation group: 'org.lwjgl', name: 'lwjgl-glfw', version: '3.2.2'
3637
runtimeOnly group: 'org.lwjgl', name: 'lwjgl-glfw', version: '3.2.2', classifier: lwjglClassifier()
38+
3739
}
3840

3941
def runDir = file("run")
@@ -70,4 +72,97 @@ task copyResources(type: Copy) {
7072
into runDir
7173
}
7274

75+
task printRunCmd {
76+
doLast {
77+
println tasks.run.commandLine.join(" ")
78+
}
79+
}
80+
7381
run.dependsOn copyResources
82+
83+
84+
def platformExtension() {
85+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
86+
return ".exe"
87+
} else {
88+
return ""
89+
}
90+
}
91+
92+
def findRenderdoc() {
93+
def qRenderdoc = "qrenderdoc${platformExtension()}"
94+
95+
for (String pathEntry : System.getenv("PATH").split(File.pathSeparator)) {
96+
def qRenderdocEntryFile = file("${pathEntry}${File.separator}${qRenderdoc}")
97+
if (qRenderdocEntryFile.exists()) {
98+
return qRenderdocEntryFile.absolutePath
99+
}
100+
}
101+
102+
if (Os.isFamily(Os.FAMILY_UNIX)) {
103+
def qRenderdocDefaultFile = file("/usr/bin/qrenderdoc")
104+
if (qRenderdocDefaultFile.exists()) {
105+
return qRenderdocDefaultFile.absolutePath
106+
}
107+
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
108+
def qRenderdocDefaultFile = file("C:\\Program Files\\RenderDoc\\qrenderdoc.exe")
109+
if (qRenderdocDefaultFile.exists()) {
110+
return qRenderdocDefaultFile.absolutePath
111+
}
112+
}
113+
114+
throw new IllegalStateException("Failed to find qrenderdoc, searched PATH and, if available, standard locations")
115+
}
116+
117+
task runWithRenderdoc {
118+
dependsOn build
119+
doLast {
120+
File.createTempFile("temp", ".cap").with { renderdocCaptureFile ->
121+
renderdocCaptureFile.deleteOnExit()
122+
123+
def commandLine = tasks.run.getCommandLine()
124+
def executable = commandLine.get(0)
125+
def args = commandLine.subList(1, commandLine.size())
126+
127+
def environmentVars = tasks.run.getEnvironment().collect { key, value ->
128+
return [
129+
separator: "Platform style",
130+
type : "Set",
131+
value : value,
132+
variable : key
133+
]
134+
}
135+
136+
renderdocCaptureFile.text = JsonOutput.toJson([
137+
rdocCaptureSettings: 1,
138+
settings : [
139+
autoStart : true,
140+
commandLine : "${args.join(" ")}",
141+
environment : environmentVars,
142+
executable : "${executable}",
143+
inject : false,
144+
numQueuedFrames: 0,
145+
options : [
146+
allowFullscreen : true,
147+
allowVSync : true,
148+
apiValidation : false,
149+
captureAllCmdLists : false,
150+
captureCallstacks : false,
151+
captureCallstacksOnlyDraws: false,
152+
debugOutputMute : true,
153+
delayForDebugger : 0,
154+
hookIntoChildren : false,
155+
refAllResources : false,
156+
verifyBufferAccess : false
157+
],
158+
queueFrameCap : 0,
159+
workingDir : "${tasks.run.getWorkingDir().absolutePath}"
160+
]
161+
])
162+
163+
exec {
164+
it.commandLine findRenderdoc(), renderdocCaptureFile.absolutePath
165+
}
166+
}
167+
}
168+
}

example/lwjgl3-opengl/src/main/java/com/labymedia/ultralight/lwjgl3/opengl/ExampleApplication.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
*/
4343
public class ExampleApplication {
4444
private final long window;
45-
private final InputAdapter inputAdapter;
4645
private final CursorAdapter cursorManager;
4746
private final WebController webController;
4847

@@ -68,17 +67,8 @@ public ExampleApplication() {
6867

6968
// Set up various internal controllers
7069
this.cursorManager = new CursorAdapter(window);
71-
this.webController = new WebController(cursorManager);
72-
this.inputAdapter = webController.getInputAdapter();
70+
this.webController = new WebController(cursorManager, window);
7371

74-
// Register all the GLFW callbacks required by this application
75-
setCallback(GLFW::glfwSetWindowContentScaleCallback, inputAdapter::windowContentScaleCallback);
76-
setCallback(GLFW::glfwSetKeyCallback, inputAdapter::keyCallback);
77-
setCallback(GLFW::glfwSetCharCallback, inputAdapter::charCallback);
78-
setCallback(GLFW::glfwSetCursorPosCallback, inputAdapter::cursorPosCallback);
79-
setCallback(GLFW::glfwSetMouseButtonCallback, inputAdapter::mouseButtonCallback);
80-
setCallback(GLFW::glfwSetScrollCallback, inputAdapter::scrollCallback);
81-
setCallback(GLFW::glfwSetWindowFocusCallback, inputAdapter::focusCallback);
8272
}
8373

8474
/**
@@ -162,11 +152,25 @@ public void stop() {
162152
public void run() {
163153
// Make the window's OpenGL context the current one
164154
glfwMakeContextCurrent(window);
165-
glfwSwapInterval(1);
155+
glfwSwapInterval(0);
166156

167157
// Initialize OpenGL capabilities
168158
GL.createCapabilities();
169159

160+
webController.initGPUDriver();
161+
162+
InputAdapter inputAdapter = webController.getInputAdapter();
163+
164+
// Register all the GLFW callbacks required by this application
165+
setCallback(GLFW::glfwSetWindowContentScaleCallback, inputAdapter::windowContentScaleCallback);
166+
setCallback(GLFW::glfwSetKeyCallback, inputAdapter::keyCallback);
167+
setCallback(GLFW::glfwSetCharCallback, inputAdapter::charCallback);
168+
setCallback(GLFW::glfwSetCursorPosCallback, inputAdapter::cursorPosCallback);
169+
setCallback(GLFW::glfwSetMouseButtonCallback, inputAdapter::mouseButtonCallback);
170+
setCallback(GLFW::glfwSetScrollCallback, inputAdapter::scrollCallback);
171+
setCallback(GLFW::glfwSetWindowFocusCallback, inputAdapter::focusCallback);
172+
173+
170174
// Manually update focus for the first time
171175
inputAdapter.focusCallback(window, glfwGetWindowAttrib(window, GLFW_FOCUSED) != 0);
172176

example/lwjgl3-opengl/src/main/java/com/labymedia/ultralight/lwjgl3/opengl/ExampleMain.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.nio.file.Path;
2929
import java.nio.file.Paths;
3030
import java.nio.file.StandardCopyOption;
31-
import java.util.concurrent.CountDownLatch;
3231

3332
/**
3433
* Entry pointer for the example application.

example/lwjgl3-opengl/src/main/java/com/labymedia/ultralight/lwjgl3/opengl/drawing/OpenGLDrawer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ public class OpenGLDrawer {
3333
public void draw() {
3434
glDisable(GL_DEPTH_TEST);
3535
glEnable(GL_ALPHA_TEST);
36-
36+
glUseProgram(0);
3737
glPushMatrix();
38-
glRotatef(rotation++, 0, 0, 1);
38+
rotation += 0.01;
39+
glRotatef(rotation, 0, 0, 1);
3940
glBegin(GL_TRIANGLES);
4041

4142

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Ultralight Java - Java wrapper for the Ultralight web engine
3+
* Copyright (C) 2020 - 2021 LabyMedia and contributors
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation; either
8+
* version 3 of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
*/
19+
20+
package com.labymedia.ultralight.lwjgl3.opengl.gpu;
21+
22+
public class FBOEntry {
23+
long fboId;
24+
long msaaFboId;
25+
boolean needsResolve;
26+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Ultralight Java - Java wrapper for the Ultralight web engine
3+
* Copyright (C) 2020 - 2021 LabyMedia and contributors
4+
*
5+
* This program is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU Lesser General Public
7+
* License as published by the Free Software Foundation; either
8+
* version 3 of the License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public License
16+
* along with this program; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
*/
19+
20+
package com.labymedia.ultralight.lwjgl3.opengl.gpu;
21+
22+
public class GPUContextGL {
23+
private long window;
24+
25+
public boolean msaaEnabled() {
26+
return false;
27+
}
28+
29+
public boolean isEnableOffscreenGl() {
30+
return false;
31+
}
32+
33+
public long getActiveWindow() {
34+
return window;
35+
}
36+
37+
public void setActiveWindow(long window){
38+
this.window = window;
39+
}
40+
}

0 commit comments

Comments
 (0)