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

Commit f76c332

Browse files
authored
Merge pull request #64 from LabyMod/develop
Release 0.4.10
2 parents 22b212d + dea5be5 commit f76c332

File tree

2 files changed

+47
-51
lines changed

2 files changed

+47
-51
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.9
1+
0.4.10

ultralight-java-glfw-opengl-util/src/main/java/com/labymedia/ultralight/util/UltralightGlfwOpenGLGPUDriver.java

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,70 +19,66 @@
1919

2020
package com.labymedia.ultralight.util;
2121

22-
import com.labymedia.ultralight.gpu.UltralightGPUDriverNativeUtil;
2322
import com.labymedia.ultralight.gpu.UltralightOpenGLGPUDriverNative;
2423
import org.lwjgl.glfw.GLFW;
2524
import org.lwjgl.opengl.GL11;
26-
import org.lwjgl.opengl.GL11C;
2725

2826
/**
2927
* GPU Driver implementation of {@link com.labymedia.ultralight.plugin.render.UltralightGPUDriver}.
3028
*/
3129
public class UltralightGlfwOpenGLGPUDriver implements UltralightOpenGLGPUDriver {
3230

33-
private final boolean msaa;
34-
private UltralightOpenGLGPUDriverNative driverNative;
35-
private UltralightGlfwOpenGLContext context;
36-
private Long renderTargetId;
31+
private final boolean msaa;
32+
private UltralightOpenGLGPUDriverNative driverNative;
33+
private UltralightGlfwOpenGLContext context;
3734

38-
private UltralightGlfwOpenGLGPUDriver(boolean msaa) {
39-
this.msaa = msaa;
40-
}
35+
private UltralightGlfwOpenGLGPUDriver(boolean msaa) {
36+
this.msaa = msaa;
37+
}
4138

42-
/**
43-
* Set the {@link UltralightOpenGLGPUDriverNative} instance to the {@link com.labymedia.ultralight.UltralightPlatform}.
44-
*/
45-
@Override
46-
public void initialize(UltralightGlfwOpenGLContext context) {
47-
this.driverNative = new UltralightOpenGLGPUDriverNative(context.getMainWindow().getWindowHandle(), this.msaa, GLFW.Functions.GetProcAddress);
48-
this.context = context;
49-
this.context.getPlatform().setGPUDriver(this.driverNative);
50-
}
39+
/**
40+
* Set the {@link UltralightOpenGLGPUDriverNative} instance to the {@link com.labymedia.ultralight.UltralightPlatform}.
41+
*/
42+
@Override
43+
public void initialize(UltralightGlfwOpenGLContext context) {
44+
this.driverNative = new UltralightOpenGLGPUDriverNative(context.getMainWindow().getWindowHandle(), this.msaa, GLFW.Functions.GetProcAddress);
45+
this.context = context;
46+
this.context.getPlatform().setGPUDriver(this.driverNative);
47+
}
5148

52-
/**
53-
* {@inheritDoc}
54-
*/
55-
@Override
56-
public void renderTexture(UltralightGlfwOpenGLWindow window) {
57-
this.context.postAndWait(() -> {
58-
this.driverNative.setActiveWindow(window.getWindowHandle());
49+
/**
50+
* {@inheritDoc}
51+
*/
52+
@Override
53+
public void renderTexture(UltralightGlfwOpenGLWindow window) {
54+
this.context.postAndWait(() -> {
55+
this.driverNative.setActiveWindow(window.getWindowHandle());
5956

60-
UltralightRendererInstanceHolder.getRenderer().render();
61-
if (this.driverNative.hasCommandsPending()) {
62-
this.driverNative.drawCommandList();
63-
}
64-
this.renderTargetId = window.getView().renderTarget().getTextureId();
65-
GL11.glFinish();
66-
});
67-
}
57+
UltralightRendererInstanceHolder.getRenderer().render();
58+
if (this.driverNative.hasCommandsPending()) {
59+
this.driverNative.drawCommandList();
60+
}
61+
GL11.glFinish();
62+
});
63+
}
6864

6965

70-
/**
71-
* {@inheritDoc}
72-
*/
73-
@Override
74-
public void bindTexture(UltralightGlfwOpenGLWindow window) {
75-
this.driverNative.bindTexture(0, this.renderTargetId);
76-
}
66+
/**
67+
* {@inheritDoc}
68+
*/
69+
@Override
70+
public void bindTexture(UltralightGlfwOpenGLWindow window) {
71+
this.driverNative.bindTexture(0, window.postAndWait(() -> window.getView().renderTarget().getTextureId()));
72+
}
7773

78-
/**
79-
* Create a new instance of {@link UltralightGlfwOpenGLGPUDriver}.
80-
* Should only be called once, since the {@link UltralightGlfwOpenGLContext} can also only be instantiated once due to some Ultralight limitations.
81-
*
82-
* @param msaa define if MSAA should active for the new driver
83-
* @return the constructed driver instance
84-
*/
85-
public static UltralightGlfwOpenGLGPUDriver create(boolean msaa) {
86-
return new UltralightGlfwOpenGLGPUDriver(msaa);
87-
}
74+
/**
75+
* Create a new instance of {@link UltralightGlfwOpenGLGPUDriver}.
76+
* Should only be called once, since the {@link UltralightGlfwOpenGLContext} can also only be instantiated once due to some Ultralight limitations.
77+
*
78+
* @param msaa define if MSAA should active for the new driver
79+
* @return the constructed driver instance
80+
*/
81+
public static UltralightGlfwOpenGLGPUDriver create(boolean msaa) {
82+
return new UltralightGlfwOpenGLGPUDriver(msaa);
83+
}
8884
}

0 commit comments

Comments
 (0)