protected void initContextFirstTime() { final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3));
protected void initContextFirstTime() { final GLCapabilities capabilities = createCapabilities(!renderer.equals(AppSettings.LWJGL_OPENGL2));
/** * Creates a new {@link GLCapabilities} instance for the OpenGL context that is current in the current thread. * * <p>Depending on the current context, the instance returned may or may not contain the deprecated functionality removed since OpenGL version 3.1.</p> * * <p>This method calls {@link #setCapabilities(GLCapabilities)} with the new instance before returning.</p> * * @return the GLCapabilities instance */ public static GLCapabilities createCapabilities() { return createCapabilities(false); }
@MainThread protected ContextCapabilities createContextCapabilities() { return new Lwjgl3ContextCapabilities(GL.createCapabilities()); }
/** * <p> This method makes the OpenGL context of this window current on the calling thread. A context can only be made * current on a single thread at a time and each thread can have only a single current context at a time.</p> * * <p> By default, making a context non-current implicitly forces a pipeline flush. On machines that support * {@code GL_KHR_context_flush_control}, you can control whether a context performs this flush by setting the * {@code GLFW_CONTEXT_RELEASE_BEHAVIOR} window hint.</p> */ public void makeCurrent() { glfwMakeContextCurrent(handle); if (windowCapabilities == null) windowCapabilities = GL.createCapabilities(); else GL.setCapabilities(windowCapabilities); }
GL.setCapabilities(this.capabilities); } else { this.capabilities = GL.createCapabilities();
GL.setCapabilities(this.capabilities); } else { this.capabilities = GL.createCapabilities();
public void wrapNewContext() { if(cc instanceof JAWTContextCreator) ((JAWTContextCreator)cc).makeCurrent(true); if(context != null) context.disposeAll(); GLCapabilities caps = GL.createCapabilities(); if(caps.OpenGL20) { context = new LWJGL20DrawContext(caps, debug); } else if(caps.OpenGL15 && caps.GL_ARB_texture_non_power_of_two) { context = new LWJGL15DrawContext(caps, debug); } else { context = null; errorGLVersion(); } }
public SWTGraphics (SWTPlatform splat, final Composite comp) { super(splat); this.plat = splat; boolean isMac = "Mac OS X".equals(System.getProperty("os.name")); final Hack hack = isMac ? new SWTMacHack() : new Hack(); // special scale fiddling on Mac scaleChanged(hack.hackScale()); // create our GLCanvas GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data); hack.hackCanvas(canvas); canvas.setCurrent(); GL.createCapabilities(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); canvas.setCurrent(); hack.convertToBacking(canvas, bounds); viewportChanged(bounds.width, bounds.height); } }); plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height); setSize(plat.config.width, plat.config.height, plat.config.fullscreen); }
public SWTGraphics (SWTPlatform splat, final Composite comp) { super(splat); this.plat = splat; boolean isMac = "Mac OS X".equals(System.getProperty("os.name")); final Hack hack = isMac ? new SWTMacHack() : new Hack(); // special scale fiddling on Mac scaleChanged(hack.hackScale()); // create our GLCanvas GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data); hack.hackCanvas(canvas); canvas.setCurrent(); GL.createCapabilities(); comp.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { // resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets // can be overlaid on top of our GLCanvas Rectangle bounds = comp.getBounds(); comp.setBounds(bounds); canvas.setBounds(bounds); canvas.setCurrent(); hack.convertToBacking(canvas, bounds); viewportChanged(bounds.width, bounds.height); } }); plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height); setSize(plat.config.width, plat.config.height, plat.config.fullscreen); }
public void create() { glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); setId(glfwCreateWindow(getWidth(), getHeight(), getTitle(), 0, 0)); if(getId() == 0) { throw new RuntimeException("Failed to create window"); } setIcon("textures/logo/oreon_lwjgl_icon32.png"); glfwMakeContextCurrent(getId()); glfwSwapInterval(0); GL.createCapabilities(); }
glfwShowWindow(window); GL.createCapabilities();