如何将lwjgl应用程序放入Javafx/swing画布中



是否可以将lwjgl显示放在Jframe Form中创建的画布上?我使用的是Netbeans IDE v8.2和lwjgl 2.9.3。谢谢你的帮助!以下是我在DisplayManager中的一些代码,它是从MainLoop调用的。

public class DisplayManager{
private static final int WIDTH = 800;
private static final int HEIGHT = 600;
private static final int FPS_CAP = 120;
private static long lastFrameTime;
private static float delta;
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3,2).withForwardCompatible(true).withProfileCore(true);

try { 
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create(new PixelFormat(), attribs);
Display.setTitle("Coffee Beans V1");
Display.setParent(EditorGUI.canvas1);
new EditorGUI().setVisible(true);

} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0,0,WIDTH,HEIGHT);
lastFrameTime = getCurrentTime();
}

是的,通过org.lwjgl.ongle.Display.setPrent(java.awt.Canvas(.

最新更新