Package org.lwjgl

Examples of org.lwjgl.LWJGLException


      case LWJGLUtil.PLATFORM_MACOSX:
        libname = "OpenCL";
        library_names = new String[] { "OpenCL.dylib" }; // TODO: Fix this
        break;
      default:
        throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
    }

    final String[] oclPaths = LWJGLUtil.getLibraryPaths(libname, library_names, CL.class.getClassLoader());
    LWJGLUtil.log("Found " + oclPaths.length + " OpenCL paths");
    for ( String oclPath : oclPaths ) {
      try {
        nCreate(oclPath);
        created = true;
        break;
      } catch (LWJGLException e) {
        LWJGLUtil.log("Failed to load " + oclPath + ": " + e.getMessage());
      }
    }

    if ( !created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX ) {
      // Try to load OpenCL from the framework instead
      nCreateDefault();
      created = true;
    }

    if ( !created )
      throw new LWJGLException("Could not locate OpenCL library.");

    if ( !CLCapabilities.OpenCL10 )
      throw new RuntimeException("OpenCL 1.0 not supported.");
  }
View Full Code Here


    if ( window_created ) {
      return;
    }
    Canvas tmp_parent = isFullscreen() ? null : parent;
    if ( tmp_parent != null && !tmp_parent.isDisplayable() ) // Only a best effort check, since the parent can turn undisplayable hereafter
      throw new LWJGLException("Parent.isDisplayable() must be true");
    if ( tmp_parent != null ) {
      tmp_parent.addComponentListener(component_listener);
    }
    DisplayMode mode = getEffectiveMode();
    display_impl.createWindow(mode, tmp_parent, getWindowX(), getWindowY());
View Full Code Here

   * @param contrast   The contrast, larger than 0.0.
   */
  public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLException {
    synchronized ( GlobalLock.lock ) {
      if ( !isCreated() ) {
        throw new LWJGLException("Display not yet created.");
      }
      if ( brightness < -1.0f || brightness > 1.0f )
        throw new IllegalArgumentException("Invalid brightness value");
      if ( contrast < 0.0f )
        throw new IllegalArgumentException("Invalid contrast value");
      int rampSize = display_impl.getGammaRampLength();
      if ( rampSize == 0 ) {
        throw new LWJGLException("Display configuration not supported");
      }
      FloatBuffer gammaRamp = BufferUtils.createFloatBuffer(rampSize);
      for ( int i = 0; i < rampSize; i++ ) {
        float intensity = (float)i / (rampSize - 1);
        // apply gamma
View Full Code Here

  private static native void synchronize(long display, boolean synchronize);

  private static int globalErrorHandler(long display, long event_ptr, long error_display, long serial, long error_code, long request_code, long minor_code) throws LWJGLException {
    if (display == getDisplay()) {
      String error_msg = getErrorText(display, error_code);
      throw new LWJGLException("X Error - disp: 0x" + Long.toHexString(error_display) + " serial: " + serial + " error: " + error_msg + " request_code: " + request_code + " minor_code: " + minor_code);
    } else if (saved_error_handler != 0)
      return callErrorHandler(saved_error_handler, display, event_ptr);
    return 0;
  }
View Full Code Here

  }
  private static native int nGetGammaRampLength(long display, int screen) throws LWJGLException;

  public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException {
    if (!isXF86VidModeSupported())
      throw new LWJGLException("No gamma ramp support (Missing XF86VM extension)");
    doSetGamma(convertToNativeRamp(gammaRamp));
  }
View Full Code Here

      Compiz.init();

      delete_atom = internAtom("WM_DELETE_WINDOW", false);
      current_displaymode_extension = getBestDisplayModeExtension();
      if (current_displaymode_extension == NONE)
        throw new LWJGLException("No display mode extension is available");
      DisplayMode[] modes = getAvailableDisplayModes();
      if (modes == null || modes.length == 0)
        throw new LWJGLException("No modes available");
      switch (current_displaymode_extension) {
        case XRANDR:
          savedXrandrConfig = AccessController.doPrivileged(new PrivilegedAction<Screen[]>() {
            public Screen[] run() {
              return XRandR.getConfiguration();
            }
          });
          saved_mode = getCurrentXRandrMode();
          break;
        case XF86VIDMODE:
          saved_mode = modes[0];
          break;
        default:
          throw new LWJGLException("Unknown display mode extension: " + current_displaymode_extension);
      }
      current_mode = saved_mode;
      saved_gamma = getCurrentGammaRamp();
      current_gamma = saved_gamma;
      return saved_mode;
View Full Code Here

                  final List output = Compiz.run(
                    "dbus-send", "--print-reply", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.get"
                  );

                  if ( output == null || output.size() < 2 )
                    throw new LWJGLException("Invalid Dbus reply.");

                  String line = (String)output.get(0);

                  if ( !line.startsWith("method return") )
                    throw new LWJGLException("Invalid Dbus reply.");

                  line = ((String)output.get(1)).trim(); // value
                  if ( !line.startsWith("boolean") || line.length() < 12)
                    throw new LWJGLException("Invalid Dbus reply.");

                  return "true".equalsIgnoreCase(line.substring("boolean".length() + 1));
                }

                public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
                  if ( Compiz.run(
                    "dbus-send", "--type=method_call", "--dest=org.freedesktop.compiz", KEY, "org.freedesktop.compiz.set", "boolean:" + Boolean.toString(state)
                  ) == null )
                    throw new LWJGLException("Failed to apply Compiz LFS workaround.");
                }
              };
            } else {
              try {
                // Check if Gconf is available
                Runtime.getRuntime().exec("gconftool");

                providerName = "gconftool";
                provider = new Provider() {

                  private static final String KEY = "/apps/compiz/plugins/workarounds/allscreens/options/legacy_fullscreen";

                  public boolean hasLegacyFullscreenSupport() throws LWJGLException {
                    final List output = Compiz.run(new String[] {
                      "gconftool", "-g", KEY
                    });

                    if ( output == null || output.size() == 0 )
                      throw new LWJGLException("Invalid gconftool reply.");

                    return Boolean.parseBoolean(((String)output.get(0)).trim());
                  }

                  public void setLegacyFullscreenSupport(final boolean state) throws LWJGLException {
                    if ( Compiz.run(new String[] {
                      "gconftool", "-s", KEY, "-s", Boolean.toString(state), "-t", "bool"
                    }) == null )
                      throw new LWJGLException("Failed to apply Compiz LFS workaround.");

                    if ( state ) {
                      try {
                        // gconftool will not apply the workaround immediately, sleep a bit
                        // to make sure it will be ok when we create the window.
View Full Code Here

        try {
          final int exitValue = p.waitFor();
          if ( exitValue != 0 )
            return null;
        } catch (InterruptedException e) {
          throw new LWJGLException("Process interrupted.", e);
        }

        final BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));

        String line;
        while ( (line = br.readLine()) != null )
          output.add(line);

        br.close();
      } catch (final IOException e) {
        throw new LWJGLException("Process failed.", e);
      }

      return output;
    }
View Full Code Here

      if (equals(awt_mode, mode)) {
        requested_mode = awt_mode;
        return;
      }
    }
    throw new LWJGLException(mode + " is not supported");
  }
View Full Code Here

    this.parent = parent;
    hasParent = parent != null;
    long parent_hwnd = parent != null ? getHwnd(parent) : 0;
    this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), Display.isFullscreen() || isUndecorated(), parent != null, parent_hwnd);
    if (hwnd == 0) {
      throw new LWJGLException("Failed to create window");
    }
    this.hdc = getDC(hwnd);
    if (hdc == 0) {
      nDestroyWindow(hwnd);
      throw new LWJGLException("Failed to get dc");
    }
    try {
      int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true);
      WindowsPeerInfo.setPixelFormat(getHdc(), format);
      peer_info.initDC(getHwnd(), getHdc());
View Full Code Here

TOP

Related Classes of org.lwjgl.LWJGLException

Copyright © 2018 www.massapicom. 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.