com.badlogic.gdx.Graphics.isGL30Available()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(120)

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

Graphics.isGL30Available介绍

[英]Returns whether OpenGL ES 3.0 is available. If it is you can get an instance of GL30 via #getGL30() to access OpenGL ES 3.0 functionality. Note that this functionality will only be available if you instructed the Application instance to use OpenGL ES 3.0!
[中]返回OpenGL ES 3.0是否可用。如果是,您可以通过#getGL30()获取GL30实例以访问OpenGL ES 3.0功能。请注意,仅当您指示应用程序实例使用OpenGL ES 3.0时,此功能才可用!

代码示例

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

private void checkValidBuilder () {
  boolean runningGL30 = Gdx.graphics.isGL30Available();
  if (!runningGL30) {
    if (bufferBuilder.hasPackedStencilDepthRenderBuffer) {
      throw new GdxRuntimeException("Packed Stencil/Render render buffers are not available on GLES 2.0");
    }
    if (bufferBuilder.textureAttachmentSpecs.size > 1) {
      throw new GdxRuntimeException("Multiple render targets not available on GLES 2.0");
    }
    for (FrameBufferTextureAttachmentSpec spec : bufferBuilder.textureAttachmentSpecs) {
      if (spec.isDepth) throw new GdxRuntimeException("Depth texture FrameBuffer Attachment not available on GLES 2.0");
      if (spec.isStencil) throw new GdxRuntimeException("Stencil texture FrameBuffer Attachment not available on GLES 2.0");
      if (spec.isFloat) {
        if (!Gdx.graphics.supportsExtension("OES_texture_float")) {
          throw new GdxRuntimeException("Float texture FrameBuffer Attachment not available on GLES 2.0");
        }
      }
    }
  }
}

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

private void checkValidBuilder () {
  boolean runningGL30 = Gdx.graphics.isGL30Available();
  if (!runningGL30) {
    if (bufferBuilder.hasPackedStencilDepthRenderBuffer) {
      throw new GdxRuntimeException("Packed Stencil/Render render buffers are not available on GLES 2.0");
    }
    if (bufferBuilder.textureAttachmentSpecs.size > 1) {
      throw new GdxRuntimeException("Multiple render targets not available on GLES 2.0");
    }
    for (FrameBufferTextureAttachmentSpec spec : bufferBuilder.textureAttachmentSpecs) {
      if (spec.isDepth) throw new GdxRuntimeException("Depth texture FrameBuffer Attachment not available on GLES 2.0");
      if (spec.isStencil) throw new GdxRuntimeException("Stencil texture FrameBuffer Attachment not available on GLES 2.0");
      if (spec.isFloat) {
        if (!Gdx.graphics.supportsExtension("OES_texture_float")) {
          throw new GdxRuntimeException("Float texture FrameBuffer Attachment not available on GLES 2.0");
        }
      }
    }
  }
}

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

@Override
public void consumeCustomData (int target) {
  if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS
    || Gdx.app.getType() == ApplicationType.WebGL) {
    if (!Gdx.graphics.supportsExtension("OES_texture_float"))
      throw new GdxRuntimeException("Extension OES_texture_float not supported!");
    // GLES and WebGL defines texture format by 3rd and 8th argument,
    // so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there.
    Gdx.gl.glTexImage2D(target, 0, GL20.GL_RGBA, width, height, 0, GL20.GL_RGBA, GL20.GL_FLOAT, buffer);
  } else {
    if (!Gdx.graphics.isGL30Available()) {
      if (!Gdx.graphics.supportsExtension("GL_ARB_texture_float"))
        throw new GdxRuntimeException("Extension GL_ARB_texture_float not supported!");
    }
    // in desktop OpenGL the texture format is defined only by the third argument,
    // hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL)
    Gdx.gl.glTexImage2D(target, 0, internalFormat, width, height, 0, format, GL20.GL_FLOAT, buffer);
  }
}

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

@Override
public void consumeCustomData (int target) {
  if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS
    || Gdx.app.getType() == ApplicationType.WebGL) {
    if (!Gdx.graphics.supportsExtension("OES_texture_float"))
      throw new GdxRuntimeException("Extension OES_texture_float not supported!");
    // GLES and WebGL defines texture format by 3rd and 8th argument,
    // so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there.
    Gdx.gl.glTexImage2D(target, 0, GL20.GL_RGBA, width, height, 0, GL20.GL_RGBA, GL20.GL_FLOAT, buffer);
  } else {
    if (!Gdx.graphics.isGL30Available()) {
      if (!Gdx.graphics.supportsExtension("GL_ARB_texture_float"))
        throw new GdxRuntimeException("Extension GL_ARB_texture_float not supported!");
    }
    // in desktop OpenGL the texture format is defined only by the third argument,
    // hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL)
    Gdx.gl.glTexImage2D(target, 0, internalFormat, width, height, 0, format, GL20.GL_FLOAT, buffer);
  }
}

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

private void checkValidBuilder () {
  boolean runningGL30 = Gdx.graphics.isGL30Available();
  if (!runningGL30) {
    if (bufferBuilder.hasPackedStencilDepthRenderBuffer) {
      throw new GdxRuntimeException("Packed Stencil/Render render buffers are not available on GLES 2.0");
    }
    if (bufferBuilder.textureAttachmentSpecs.size > 1) {
      throw new GdxRuntimeException("Multiple render targets not available on GLES 2.0");
    }
    for (FrameBufferTextureAttachmentSpec spec : bufferBuilder.textureAttachmentSpecs) {
      if (spec.isDepth) throw new GdxRuntimeException("Depth texture FrameBuffer Attachment not available on GLES 2.0");
      if (spec.isStencil) throw new GdxRuntimeException("Stencil texture FrameBuffer Attachment not available on GLES 2.0");
      if (spec.isFloat) {
        if (!Gdx.graphics.supportsExtension("OES_texture_float")) {
          throw new GdxRuntimeException("Float texture FrameBuffer Attachment not available on GLES 2.0");
        }
      }
    }
  }
}

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

@Override
public void consumeCustomData (int target) {
  if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.iOS
    || Gdx.app.getType() == ApplicationType.WebGL) {
    if (!Gdx.graphics.supportsExtension("OES_texture_float"))
      throw new GdxRuntimeException("Extension OES_texture_float not supported!");
    // GLES and WebGL defines texture format by 3rd and 8th argument,
    // so to get a float texture one needs to supply GL_RGBA and GL_FLOAT there.
    Gdx.gl.glTexImage2D(target, 0, GL20.GL_RGBA, width, height, 0, GL20.GL_RGBA, GL20.GL_FLOAT, buffer);
  } else {
    if (!Gdx.graphics.isGL30Available()) {
      if (!Gdx.graphics.supportsExtension("GL_ARB_texture_float"))
        throw new GdxRuntimeException("Extension GL_ARB_texture_float not supported!");
    }
    // in desktop OpenGL the texture format is defined only by the third argument,
    // hence we need to use GL_RGBA32F there (this constant is unavailable in GLES/WebGL)
    Gdx.gl.glTexImage2D(target, 0, internalFormat, width, height, 0, format, GL20.GL_FLOAT, buffer);
  }
}

相关文章