org.lwjgl.opengl.Display.create()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.lwjgl.opengl.Display.create()方法的一些代码示例,展示了Display.create()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Display.create()方法的具体详情如下:
包路径:org.lwjgl.opengl.Display
类名称:Display
方法名:create

Display.create介绍

暂无

代码示例

代码示例来源:origin: MovingBlocks/Terasology

try {
  ContextAttribs ctxAttribs = new ContextAttribs().withDebug(true);
  Display.create(config.getPixelFormat(), ctxAttribs);
  Display.create(config.getPixelFormat()); // Create a normal context instead
Display.create(config.getPixelFormat());

代码示例来源:origin: libgdx/libgdx

.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) {
} else {
  Display
    .create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples));
  usingGL30 = false;
  Display.create(new PixelFormat(0, 16, 8));
  if (getDisplayMode().bitsPerPixel == 16) {
    bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false);
    Display.create(new PixelFormat());
  } catch (Exception ex3) {
    if (!softwareMode && config.allowSoftwareMode) {

代码示例来源:origin: libgdx/libgdx

.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) {
} else {
  Display
    .create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples));
  usingGL30 = false;
  Display.create(new PixelFormat(0, 16, 8));
  if (getDisplayMode().bitsPerPixel == 16) {
    bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false);
    Display.create(new PixelFormat());
  } catch (Exception ex3) {
    if (!softwareMode && config.allowSoftwareMode) {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Display.create(acquirePixelFormat(false), pbuffer);
}else{
  Display.create(acquirePixelFormat(false));

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

ContextAttribs attr = createContextAttribs();
if (attr != null) {
  Display.create(pixelFormat, attr);
} else {
  Display.create(pixelFormat);

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * Try creating a display with the given format
 * 
 * @param format The format to attempt
 * @throws LWJGLException Indicates a failure to support the given format
 */
private void tryCreateDisplay(PixelFormat format) throws LWJGLException {
  if (SHARED_DRAWABLE == null) 
  {
    Display.create(format);
  }
  else
  {
    Display.create(format, SHARED_DRAWABLE);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

/**
 * Create the LWJGL display
 * 
 * @throws Exception Failure to create display
 */
private void createDisplay() throws Exception {
  try {
   // create display with alpha
   Display.create(new PixelFormat(8,8,GameContainer.stencil ? 8 : 0));
   alphaSupport = true;
  } catch (Exception e) {
   // if we couldn't get alpha, let us know
   alphaSupport = false;
    Display.destroy();
    // create display without alpha
   Display.create();
  }
}

代码示例来源:origin: playn/playn

public LWJGLGraphics(JavaPlatform plat) {
 super(plat, new LWJGLGL20(), Scale.ONE); // have to get scale after Display.create()
 setDisplayMode(plat.config.width, plat.config.height, plat.config.fullscreen);
 try {
  System.setProperty("org.lwjgl.opengl.Display.enableHighDPI", "true");
  Display.create();
  checkScaleFactor();
 } catch (LWJGLException e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: monster860/FastDMM

private void init() throws LWJGLException {
  String path = System.getProperty("user.home") + File.separator + ".fastdmm" + File.separator;
  Path AppDataPath = Paths.get(path);
  if (Files.notExists(AppDataPath)) {
    new File(path).mkdirs();
  }
  String dummy = System.getProperty("user.home") + File.separator + ".fastdmm" + File.separator + "dummy";
  File dummyFile = new File(dummy);
  if (!dummyFile.exists()) {
    convertintojson();
  }
  try {
    synchronized (this) {
      while (filters == null) {
        wait(1000);
      }
    }
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
  setVisible(true);
  // Display.setDisplayMode(new DisplayMode(640, 480));
  // Display.setResizable(true);
  Display.setParent(canvas);
  Display.create();
  this.setTitle("FastDMM");
  if (interface_dmi != null) {
    interface_dmi.createGL();
  }
}

代码示例来源:origin: com.ardor3d/ardor3d-lwjgl

public void init() {
  if (_inited) {
    return;
  }
  // create the Display.
  final PixelFormat format = new PixelFormat(_settings.getAlphaBits(), _settings.getDepthBits(),
      _settings.getStencilBits()).withSamples(_settings.getSamples()).withStereo(_settings.isStereo());
  try {
    Display.setParent(_canvas);
    // NOTE: Workaround for possible lwjgl "pixel not accelerated" bug, as suggested by user "faust"
    try {
      Display.create(format);
    } catch (final LWJGLException e) {
      // failed to create Display, apply workaround (sleep for 1 second) and try again
      Thread.sleep(1000);
      Display.create(format);
    }
  } catch (final Exception e) {
    logger.severe("Cannot create window");
    logger.logp(Level.SEVERE, this.getClass().toString(), "initDisplay()", "Exception", e);
    throw new Ardor3dException("Cannot create window: " + e.getMessage());
  }
  _canvasRenderer.init(_settings, true); // true - do swap in renderer.
  _inited = true;
}

代码示例来源:origin: MrCrayfish/ModelCreator

Display.create((new PixelFormat()).withDepthBits(24));
return;
Display.create();

代码示例来源:origin: org.ode4j/demo

Display.setTitle("Simulation");
  Display.setVSyncEnabled(true);  //for VSync (TZ)
  Display.create();
} catch (LWJGLException e) {
  throw new RuntimeException(e);

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

.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) {
} else {
  Display
    .create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples));
  usingGL30 = false;
  Display.create(new PixelFormat(0, 16, 8));
  if (getDisplayMode().bitsPerPixel == 16) {
    bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false);
    Display.create(new PixelFormat());
  } catch (Exception ex3) {
    if (!softwareMode && config.allowSoftwareMode) {

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

Display.create(acquirePixelFormat(false), pbuffer);
}else{
  Display.create(acquirePixelFormat(false));

代码示例来源:origin: threerings/playn

@Override
public void run(final Game game) {
 if (!config.headless) {
  try {
   Display.create();
  } catch (LWJGLException e) {
   throw new RuntimeException(e);
  }
 }
 init(game);
 boolean wasActive = Display.isActive();
 while (!Display.isCloseRequested()) {
  // Notify the app if lose or regain focus (treat said as pause/resume).
  boolean newActive = Display.isActive();
  if (wasActive != newActive) {
   if (wasActive)
    onPause();
   else
    onResume();
   wasActive = newActive;
  }
  // Process frame, if we don't need to provide true pausing
  if (newActive || !config.truePause)
   processFrame(game);
  Display.update();
  // Sleep until it's time for the next frame.
  Display.sync(60);
 }
 shutdown();
}

代码示例来源:origin: com.googlecode.playn/playn-java

@Override
public void run(final Game game) {
 if (!config.headless) {
  try {
   Display.create();
  } catch (LWJGLException e) {
   throw new RuntimeException(e);
  }
 }
 init(game);
 boolean wasActive = Display.isActive();
 while (!Display.isCloseRequested()) {
  // Notify the app if lose or regain focus (treat said as pause/resume).
  boolean newActive = Display.isActive();
  if (wasActive != newActive) {
   if (wasActive)
    onPause();
   else
    onResume();
   wasActive = newActive;
  }
  // Process frame, if we don't need to provide true pausing
  if (newActive || !config.truePause)
   processFrame(game);
  Display.update();
  // Sleep until it's time for the next frame.
  Display.sync(60);
 }
 shutdown();
}

代码示例来源:origin: com.ardor3d/ardor3d-lwjgl

Display.setDisplayMode(mode);
  Display.setFullscreen(_settings.isFullScreen());
  Display.create(format);
} catch (final Exception e) {
  logger.severe("Cannot create window");

代码示例来源:origin: CallForSanity/Gaalop

/**
 * Starts the lwjgl engine and shows a window, where the point clouds are rendered
 */
public void startEngine() {
  int width = 800;
  int height = 600;
  
  try {
    Display.setDisplayMode(new DisplayMode(width, height));
    Display.setFullscreen(false);
    Display.setTitle("Gaalop Visualization Window");
    Display.create();
  } catch (LWJGLException e) {
    e.printStackTrace();
    System.exit(0);
  }
  
  GL11.glEnable(GL11.GL_DEPTH_TEST);
  GL11.glShadeModel(GL11.GL_SMOOTH);
  changeSize(width, height);
  GL11.glDisable(GL11.GL_LIGHTING);
  // init OpenGL
  GL11.glViewport(0, 0, width, height);
  GL11.glMatrixMode(GL11.GL_PROJECTION);
  GL11.glLoadIdentity();
  GLU.gluPerspective((float) 65.0, (float) width / (float) height, (float) 0.1, 100);
  GL11.glMatrixMode(GL11.GL_MODELVIEW);
  
  
}

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

ContextAttribs attr = createContextAttribs();
if (attr != null) {
  Display.create(pixelFormat, attr);
} else {
  Display.create(pixelFormat);

相关文章