Examples of PixelFormat


Examples of org.lwjgl.opengl.PixelFormat

        Display.setTitle("Minecraft Minecraft 1.2.5");
        System.out.println((new StringBuilder()).append("LWJGL Version: ").append(Sys.getVersion()).toString());

        try
        {
            PixelFormat pixelformat = new PixelFormat();
            pixelformat = pixelformat.withDepthBits(24);
            Display.create(pixelformat);
        }
        catch (LWJGLException lwjglexception)
        {
            lwjglexception.printStackTrace();
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));
        } catch (Exception e) {
          Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
            config.samples));
          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

    static int stencilBits = 0;
    public static void createDisplay() throws LWJGLException
    {
        ImageIO.setUseCache(false); //Disable on-disc stream cache should speed up texture pack reloading.
        PixelFormat format = new PixelFormat().withDepthBits(24);
        if (!Boolean.parseBoolean(System.getProperty("forge.forceDisplayStencil", "false")))
        {
            //Creating the display with Stencil bits causes issues on some displays.
            //According to ChickenBones, Mumfrey and Pig The only real use is in the FBO.
            //So lets default to normal init to fix the issues yet add the bits to the FBO.
            Display.create(format);
            stencilBits = 0;
            return;
        }
        try
        {
            //TODO: Figure out how to determine the max bits.
            Display.create(format.withStencilBits(8));
            stencilBits = 8;
        }
        catch(LWJGLException e)
        {
            Display.create(format);
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

    private static class PixelFormatHandler implements JsonSerializer<PixelFormat>, JsonDeserializer<PixelFormat> {

        @Override
        public PixelFormat deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
            if (json.isJsonPrimitive() && json.getAsJsonPrimitive().isNumber()) {
                return new PixelFormat().withDepthBits(json.getAsInt());
            }
            return new PixelFormat().withDepthBits(24);
        }
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

                        setFullscreen(true);
                        setVSyncEnabled(true);
                    } else {
                        setDisplayMode(new DisplayMode(width, height));
                    }
                    create(new PixelFormat(8, 8, 8));
                    AspectRenderer.FBO_ENABLED = GLContext.getCapabilities().GL_EXT_framebuffer_object;

                    ShaderProgram.BLINN_PHONG = ShaderProgram.loadPrebuilt("blinn-phong");
                    //ShaderProgram.PHONG = ShaderProgram.loadPrebuilt("phong");
                    ShaderProgram.COLOR = ShaderProgram.loadPrebuilt("color");
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

  public static final boolean CAMERA_INVERT = true;

  public static void main(String[] argv) {
   
    // set opengl version
    PixelFormat pixelFormat = new PixelFormat();
    ContextAttribs contextAtrributes = new ContextAttribs(3, 0);
    contextAtrributes.withForwardCompatible(true);

    try {
      // initialize lwjgl
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));
        } catch (Exception e) {
          Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
            config.samples));
          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

  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));
        } catch (Exception e) {
          Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
            config.samples));
          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

  public LwjglAWTCanvas (ApplicationListener listener, LwjglAWTCanvas sharedContextCanvas) {
    LwjglNativesLoader.load();

    AWTGLCanvas sharedDrawable = sharedContextCanvas != null ? sharedContextCanvas.canvas : null;
    try {
      canvas = new AWTGLCanvas(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), new PixelFormat(),
        sharedDrawable) {
        private final Dimension minSize = new Dimension(0, 0);

        public Dimension getMinimumSize () {
          return minSize;
View Full Code Here

Examples of org.lwjgl.opengl.PixelFormat

    }

    private void setupDisplay() {
        // Setup an OpenGL context with API version 3.2
        try {
            PixelFormat pixelFormat = new PixelFormat();
            ContextAttribs contextAtrributes = new ContextAttribs(3, 2)
                    .withForwardCompatible(true)
                    .withProfileCore(true);

            Display.setDisplayMode(Display.getDesktopDisplayMode());
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.