我在屏幕上画了一个白色三角形(WIDTH = 800,HEIGHT = 600)。我得到了白屏大小的三角形,与OpenGl版本4.2.0完美搭配 - Build 10.18.10.3496(当前版本)
但是当我切换到3.3.0 - Build 10.18.10.3496时 我什么都没有,但黑色的空白屏幕。当我再次使用4.2.0时,一切正常。 我不知道发生了什么事?
public abstract class Window {
public static void createNormalVersion(int width,int height,String title){
try {
Display.setDisplayMode(new DisplayMode(width, height));
Display.setTitle(title);
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
}
public static void createSpecifiedVersion
(int width,int height,String title,int firstVer,int secondVer){
try{
PixelFormat pixel=new PixelFormat();
ContextAttribs context=new ContextAttribs(firstVer,secondVer)
.withForwardCompatible(true)
.withProfileCore(true);
Display.setDisplayMode(new DisplayMode(width,height));
Display.setTitle(title);
Display.create(pixel,context);
}catch(LWJGLException e){
e.printStackTrace();
}
}
// I choose the version from main method
public static void main(String[] args) {
Window.createSpecifiedVersion(WIDTH, HEIGHT, TITLE, 3, 3);
MainComponent game = new MainComponent();
game.start();
}