From 8949675c20e3fc064d170b509391fadbdb970611 Mon Sep 17 00:00:00 2001 From: sg215889 Date: Mon, 27 Jul 2009 19:25:33 -0700 Subject: Add Custom NativeWindow Type 'BroadcomEGL' (-Dnativewindow.ws.name=BroadcomEGL): 1st Draft of supporting broadcom's proprietary EGL mapping --- .../sun/opengl/impl/egl/EGLGraphicsConfiguration.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java') diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java index 4f04bb57a..08fbae5bc 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java @@ -37,6 +37,7 @@ package com.sun.opengl.impl.egl; import java.util.*; import javax.media.nativewindow.*; +import javax.media.nativewindow.egl.*; import javax.media.opengl.*; import com.sun.opengl.impl.*; import com.sun.gluegen.runtime.NativeLibrary; @@ -52,15 +53,29 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple return configID; } - public EGLGraphicsConfiguration(AbstractGraphicsScreen screen, + public EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser, _EGLConfig cfg, int cfgID) { - super(screen, capsChosen, capsRequested); + super(absScreen, capsChosen, capsRequested); this.chooser = chooser; _config = cfg; configID = cfgID; } + public static EGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen absScreen, int cfgID) { + AbstractGraphicsDevice absDevice = absScreen.getDevice(); + if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { + throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); + } + long dpy = absDevice.getHandle(); + if (dpy == EGL.EGL_NO_DISPLAY) { + throw new GLException("Invalid EGL display: "+absDevice); + } + _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID); + GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg); + return new EGLGraphicsConfiguration(absScreen, caps, caps, new DefaultGLCapabilitiesChooser(), _cfg, cfgID); + } + public Object clone() { return super.clone(); } -- cgit v1.2.3 From 0a92a47567cfa36b33590bacf4c782c0ec4f9eaf Mon Sep 17 00:00:00 2001 From: sg215889 Date: Tue, 28 Jul 2009 15:49:12 -0700 Subject: Fix BroadcomEGL: Proper EGLGraphicsConfiguration at creation time --- .../com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java | 5 +++-- .../com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java') diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java index 08fbae5bc..574c3c8cf 100644 --- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java @@ -62,7 +62,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple configID = cfgID; } - public static EGLGraphicsConfiguration create(GLProfile glp, AbstractGraphicsScreen absScreen, int cfgID) { + public static EGLGraphicsConfiguration create(GLCapabilities capsRequested, AbstractGraphicsScreen absScreen, int cfgID) { AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); @@ -71,9 +71,10 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple if (dpy == EGL.EGL_NO_DISPLAY) { throw new GLException("Invalid EGL display: "+absDevice); } + GLProfile glp = capsRequested.getGLProfile(); _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID); GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg); - return new EGLGraphicsConfiguration(absScreen, caps, caps, new DefaultGLCapabilitiesChooser(), _cfg, cfgID); + return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), _cfg, cfgID); } public Object clone() { diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java index a91a91598..9b790bd1f 100755 --- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java @@ -50,8 +50,12 @@ public class BCEGLWindow extends Window { } protected void createNative(Capabilities caps) { - // just save the GLProfile here, create window later .. - glProfile = ((GLCapabilities)caps).getGLProfile(); + // query a good configuration .. even thought we drop this one + // and reuse the EGLUtil choosen one later. + config = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice()).chooseGraphicsConfiguration(caps, null, getScreen().getGraphicsScreen()); + if (config == null) { + throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); + } } protected void closeNative() { @@ -115,12 +119,12 @@ public class BCEGLWindow extends Window { private void windowCreated(int cfgID, int width, int height) { this.width = width; this.height = height; - config = EGLGraphicsConfiguration.create(glProfile, screen.getGraphicsScreen(), cfgID); + GLCapabilities capsReq = (GLCapabilities) config.getRequestedCapabilities(); + config = EGLGraphicsConfiguration.create(capsReq, screen.getGraphicsScreen(), cfgID); if (config == null) { throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this); } } private long windowHandleClose; - private GLProfile glProfile; } -- cgit v1.2.3