@Override public GroupLayer createGroupLayer() { return new GroupLayerGL(ctx); }
public AndroidGraphics(AndroidPlatform platform, AndroidGL20 gfx, Bitmap.Config bitmapConfig) { this.platform = platform; this.preferredBitmapConfig = bitmapConfig; ctx = new AndroidGLContext(platform, gfx); rootLayer = new GroupLayerGL(ctx); }
public AndroidGraphics(AndroidPlatform platform, AndroidGL20 gfx, Bitmap.Config bitmapConfig) { this.platform = platform; this.preferredBitmapConfig = bitmapConfig; ctx = new AndroidGLContext(platform, gfx); rootLayer = new GroupLayerGL(ctx); }
@Override public GroupLayer createGroupLayer() { return new GroupLayerGL(ctx()); }
public JavaGraphics(JavaPlatform platform, JavaPlatform.Config config) { this.platform = platform; // if we're being run in headless mode, create a stub GL context which does not trigger the // initialization of LWJGL; this allows tests to run against non-graphics services without // needing to configure LWJGL native libraries this.ctx = config.headless ? new GL20Context(platform, null, config.scaleFactor, false) : new JavaGLContext(platform, config.scaleFactor); this.rootLayer = new GroupLayerGL(ctx); // set up the dummy font contexts Graphics2D aaGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); aaGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); aaFontContext = aaGfx.getFontRenderContext(); Graphics2D aGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); aGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); aFontContext = aGfx.getFontRenderContext(); if (!config.headless) { setDisplayMode(ctx.scale.scaledCeil(config.width), ctx.scale.scaledCeil(config.height), config.fullscreen); } }
public JavaGraphics(JavaPlatform platform, JavaPlatform.Config config) { this.platform = platform; // if we're being run in headless mode, create a stub GL context which does not trigger the // initialization of LWJGL; this allows tests to run against non-graphics services without // needing to configure LWJGL native libraries this.ctx = config.headless ? new GL20Context(platform, null, config.scaleFactor, false) : new JavaGLContext(platform, config.scaleFactor); this.rootLayer = new GroupLayerGL(ctx); // set up the dummy font contexts Graphics2D aaGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); aaGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); aaFontContext = aaGfx.getFontRenderContext(); Graphics2D aGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); aGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); aFontContext = aGfx.getFontRenderContext(); if (!config.headless) { setDisplayMode(ctx.scale.scaledCeil(config.width), ctx.scale.scaledCeil(config.height), config.fullscreen); } }
public RoboGraphics(RoboPlatform platform, CGRect bounds) { this.platform = platform; float deviceScale = (float)((platform.osVersion >= 8) ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale()); boolean isPad = UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad; boolean useHalfSize = isPad && platform.config.iPadLikePhone; float viewScale = (useHalfSize ? 2 : 1) * deviceScale; this.deviceScale = deviceScale; ctx = new RoboGLContext(platform, new RoboGL20(), viewScale); setSize(bounds); rootLayer = new GroupLayerGL(ctx); }
HtmlGraphicsGL(HtmlPlatform platform, HtmlPlatform.Config config) throws RuntimeException { super(config); canvas = Document.get().createCanvasElement(); canvas.setWidth(rootElement.getOffsetWidth()); canvas.setHeight(rootElement.getOffsetHeight()); rootElement.appendChild(canvas); try { WebGLContextAttributes attrs = WebGLContextAttributes.create(); attrs.setAlpha(config.transparentCanvas); attrs.setAntialias(config.antiAliasing); // if this returns null, the browser doesn't support WebGL on this machine WebGLRenderingContext gl = WebGLRenderingContext.getContext(canvas, attrs); if (gl == null) throw new RuntimeException("Unable to create GL context"); // Some systems seem to have a problem where they return a non-null context, but it's in an // error state initially. We give up and fall back to Canvas in this case, because nothing // seems to work properly. int error = gl.getError(); if (error != WebGLRenderingContext.NO_ERROR) throw new RuntimeException("GL context started with errors [err=" + error + "]"); ctx = new HtmlGLContext(platform, config.scaleFactor, gl, canvas); rootLayer = new GroupLayerGL(ctx); } catch (RuntimeException re) { // Give up. HtmlPlatform will catch the exception and fall back to dom/canvas. rootElement.removeChild(canvas); throw re; } }