Examples of PixelFormat


Examples of org.lwjgl.opengl.PixelFormat

    }

    // create display with at least 8 bits alpha, 24 bits color, 1 bit
    // stencil buffer and desired samples
    try {
      Display.create(new PixelFormat(8, 24, 1, settings.getSamples()));
    } catch (LWJGLException e) {
      if (settings.getSamples() > 0 || !settings.getFullscreen()) {
        // probably the desired multisampling value is not supported
        // or desktop uses 16 bit colour and therefore cannot run in
        // windowed mode
        Sys.alert("Error", "Failed creating display. Now trying without anti-aliasing and in fullscreen mode.");
        settings.setSamples(0);
        settings.setFullscreen(true);

        try {
          Display.setFullscreen(true);
          Display.create(new PixelFormat(8, 24, 1, settings.getSamples()));
        } catch (LWJGLException e1) {
          Sys.alert("Fatal Error", "Failed creating display.");
          System.exit(1);
        }
      } else {
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

    initiateGLInstances();
  }

  private void createDisplayPixelFormat () {
    try {
      Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples));
      bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil, config.samples,
        false);
    } catch (Exception ex) {
      Display.destroy();
      try {
        Thread.sleep(200);
      } catch (InterruptedException ignored) {
      }
      try {
        Display.create(new PixelFormat(0, 16, 8));
        if (getDesktopDisplayMode().bitsPerPixel == 16) {
          bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 24) {
          bufferFormat = new BufferFormat(8, 8, 8, 0, 16, 8, 0, false);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 32) {
          bufferFormat = new BufferFormat(8, 8, 8, 8, 16, 8, 0, false);
        }
      } catch (Exception ex2) {
        Display.destroy();
        try {
          Thread.sleep(200);
        } catch (InterruptedException ignored) {
        }
        try {
          Display.create(new PixelFormat());
        } catch (Exception ex3) {
          if (ex3.getMessage().contains("Pixel format not accelerated"))
            throw new GdxRuntimeException("OpenGL is not supported by the video driver.", ex3);
          throw new GdxRuntimeException("Unable to create OpenGL display.", ex3);
        }
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

  public void createContext(int width, int height) {
   
    try {
     
      Display.setDisplayMode(new DisplayMode(width, height));
      Display.create(new PixelFormat(4, 8, 0));
 
      GL11.glViewport(0, 0, width, height);
      GL11.glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a);
      GL11.glClearDepth(1.0f);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

  }
 
  public static int main(String[] args, int width, int height, String title, DemoApplication demoApp) throws LWJGLException {
    Display.setDisplayMode(new DisplayMode(width, height));
    Display.setTitle(title);
    Display.create(new PixelFormat(0, 24, 0));
   
    Keyboard.create();
    Keyboard.enableRepeatEvents(true);
    Mouse.create();
   
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

    protected PixelFormat acquirePixelFormat(boolean forPbuffer){
        if (forPbuffer){
            // Use 0 samples for pbuffer format, prevents
            // crashes on bad drivers
            if (pbufferFormat == null){
                pbufferFormat = new PixelFormat(settings.getBitsPerPixel(),
                                                0,
                                                settings.getDepthBits(),
                                                settings.getStencilBits(),
                                                0, // samples
                                                0,
                                                0,
                                                0,
                                                settings.useStereo3D());
            }
            return pbufferFormat;
        }else{
            if (canvasFormat == null){
                int samples = getNumSamplesToUse();
                canvasFormat = new PixelFormat(settings.getBitsPerPixel(),
                                               0,
                                               settings.getDepthBits(),
                                               settings.getStencilBits(),
                                               samples,
                                               0,
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

        var5.printStackTrace();
      }
    }

    try {
      Display.create(AAHelper.setupPixelFormat((new PixelFormat()).withDepthBits(24)));
    } catch (LWJGLException var4) {
      var4.printStackTrace();

      try {
        Thread.sleep(1000L);
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

  private void createDisplayPixelFormat () {
    try {
      if (config.useGL30) {
        ContextAttribs context = new ContextAttribs(3, 2).withForwardCompatible(false).withProfileCore(true);
        try {
          Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
            config.samples), context);
        } catch (Exception e) {
          Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
            config.samples), context);
          System.out.println("LwjglGraphics: couldn't create OpenGL 3.2+ core profile context");
        }
        System.out.println("LwjglGraphics: created OpenGL 3.2+ core profile context. This is experimental!");
      } else {
        Display
          .create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples));
      }
      bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil, config.samples,
        false);
    } catch (Exception ex) {
      Display.destroy();
      try {
        Thread.sleep(200);
      } catch (InterruptedException ignored) {
      }
      try {
        Display.create(new PixelFormat(0, 16, 8));
        if (getDesktopDisplayMode().bitsPerPixel == 16) {
          bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 24) {
          bufferFormat = new BufferFormat(8, 8, 8, 0, 16, 8, 0, false);
        }
        if (getDesktopDisplayMode().bitsPerPixel == 32) {
          bufferFormat = new BufferFormat(8, 8, 8, 8, 16, 8, 0, false);
        }
      } catch (Exception ex2) {
        Display.destroy();
        try {
          Thread.sleep(200);
        } catch (InterruptedException ignored) {
        }
        try {
          Display.create(new PixelFormat());
        } catch (Exception ex3) {
          if (ex3.getMessage().contains("Pixel format not accelerated")) {
            if (!softwareMode && config.allowSoftwareMode) {
              softwareMode = true;
              System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

       * @throws Exception Failure to create display
       */
      private void createDisplay() throws Exception {
         try {
            // create display with alpha
            Display.create(new PixelFormat(8,8,0));
            alphaSupport = true;
         } catch (Exception e) {
            // if we couldn't get alpha, let us know
            alphaSupport = false;
             Display.destroy();
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

   *
   * @throws SlickException Indicates a failure to create the shared drawable
   */
  public static void enableSharedContext() throws SlickException {
    try {
      SHARED_DRAWABLE = new Pbuffer(64, 64, new PixelFormat(8, 0, 0), null);
    } catch (LWJGLException e) {
      throw new SlickException("Unable to create the pbuffer used for shard context, buffers not supported", e);
    }
  }
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

    Log.info("TargetDisplayMode: "+targetDisplayMode);
   
    AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
            try {
              PixelFormat format = new PixelFormat(8,8,0,samples);
             
              tryCreateDisplay(format);
              supportsMultiSample = true;
            } catch (Exception e) {
              Display.destroy();
             
              try {
                PixelFormat format = new PixelFormat(8,8,0);
               
                tryCreateDisplay(format);
                alphaSupport = false;
              } catch (Exception e2) {
                Display.destroy();
                // if we couldn't get alpha, let us know
                try {
                  tryCreateDisplay(new PixelFormat());
                } catch (Exception e3) {
                  Log.error(e3);
                }
              }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.