本文整理汇总了Java中com.jme3.texture.FrameBuffer.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java FrameBuffer.getWidth方法的具体用法?Java FrameBuffer.getWidth怎么用?Java FrameBuffer.getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.texture.FrameBuffer
的用法示例。
在下文中一共展示了FrameBuffer.getWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateRenderBuffer
import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
private void updateRenderBuffer(FrameBuffer fb, RenderBuffer rb) {
int id = rb.getId();
if (id == -1) {
glGenRenderbuffersEXT(intBuf1);
id = intBuf1.get(0);
rb.setId(id);
}
if (context.boundRB != id) {
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, id);
context.boundRB = id;
}
if (fb.getWidth() > maxRBSize || fb.getHeight() > maxRBSize) {
throw new RendererException("Resolution " + fb.getWidth()
+ ":" + fb.getHeight() + " is not supported.");
}
TextureUtil.checkFormatSupported(rb.getFormat());
if (fb.getSamples() > 1 && GLContext.getCapabilities().GL_EXT_framebuffer_multisample) {
int samples = fb.getSamples();
if (maxFBOSamples < samples) {
samples = maxFBOSamples;
}
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,
samples,
TextureUtil.convertTextureFormat(rb.getFormat()),
fb.getWidth(),
fb.getHeight());
} else {
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
TextureUtil.convertTextureFormat(rb.getFormat()),
fb.getWidth(),
fb.getHeight());
}
}
示例2: updateRenderBuffer
import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
private void updateRenderBuffer(FrameBuffer fb, RenderBuffer rb) {
GL gl = GLContext.getCurrentGL();
int id = rb.getId();
if (id == -1) {
gl.glGenRenderbuffers(1, intBuf1);
id = intBuf1.get(0);
rb.setId(id);
}
if (context.boundRB != id) {
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, id);
context.boundRB = id;
}
if (fb.getWidth() > maxRBSize || fb.getHeight() > maxRBSize) {
throw new UnsupportedOperationException("Resolution " + fb.getWidth() + ":"
+ fb.getHeight() + " is not supported.");
}
if (fb.getSamples() > 0 && renderbufferStorageMultisample) {
int samples = fb.getSamples();
if (maxFBOSamples < samples) {
samples = maxFBOSamples;
}
gl.getGL2()
.glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples,
TextureUtil.convertTextureFormat(rb.getFormat()), fb.getWidth(),
fb.getHeight());
}
else {
gl.glRenderbufferStorage(GL.GL_RENDERBUFFER,
TextureUtil.convertTextureFormat(rb.getFormat()), fb.getWidth(), fb.getHeight());
}
}
示例3: copyFrameBuffer
import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth) {
if (GLContext.getCapabilities().GL_EXT_framebuffer_blit) {
int srcW = 0;
int srcH = 0;
int dstW = 0;
int dstH = 0;
int prevFBO = context.boundFBO;
if (src != null && src.isUpdateNeeded()) {
updateFrameBuffer(src);
}
if (dst != null && dst.isUpdateNeeded()) {
updateFrameBuffer(dst);
}
if (src == null) {
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
// srcW = viewWidth;
// srcH = viewHeight;
} else {
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, src.getId());
srcW = src.getWidth();
srcH = src.getHeight();
}
if (dst == null) {
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
// dstW = viewWidth;
// dstH = viewHeight;
} else {
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, dst.getId());
dstW = dst.getWidth();
dstH = dst.getHeight();
}
int mask = GL_COLOR_BUFFER_BIT;
if (copyDepth) {
mask |= GL_DEPTH_BUFFER_BIT;
}
glBlitFramebufferEXT(0, 0, srcW, srcH,
0, 0, dstW, dstH, mask,
GL_NEAREST);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prevFBO);
try {
checkFrameBufferError();
} catch (IllegalStateException ex) {
logger.log(Level.SEVERE, "Source FBO:\n{0}", src);
logger.log(Level.SEVERE, "Dest FBO:\n{0}", dst);
throw ex;
}
} else {
throw new RendererException("EXT_framebuffer_blit required.");
// TODO: support non-blit copies?
}
}
示例4: updateRenderBuffer
import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
private void updateRenderBuffer(FrameBuffer fb, RenderBuffer rb) {
int id = rb.getId();
if (id == -1) {
Gdx.gl20.glGenRenderbuffers(1, intBuf1);
// RendererUtil.checkGLError();
id = intBuf1.get(0);
rb.setId(id);
}
if (context.boundRB != id) {
Gdx.gl20.glBindRenderbuffer(GL20.GL_RENDERBUFFER, id);
// RendererUtil.checkGLError();
context.boundRB = id;
}
if (fb.getWidth() > maxRBSize || fb.getHeight() > maxRBSize) {
throw new RendererException("Resolution " + fb.getWidth()
+ ":" + fb.getHeight() + " is not supported.");
}
TextureUtilGdx.AndroidGLImageFormat imageFormat = TextureUtilGdx.getImageFormat(rb.getFormat());
if (imageFormat.renderBufferStorageFormat == 0) {
throw new RendererException("The format '" + rb.getFormat() + "' cannot be used for renderbuffers.");
}
// if (fb.getSamples() > 1 && GLContext.getCapabilities().GL_EXT_framebuffer_multisample) {
if (fb.getSamples() > 1) {
// // FIXME
throw new RendererException("Multisample FrameBuffer is not supported yet.");
// int samples = fb.getSamples();
// if (maxFBOSamples < samples) {
// samples = maxFBOSamples;
// }
// glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,
// samples,
// glFmt.internalFormat,
// fb.getWidth(),
// fb.getHeight());
} else {
Gdx.gl20.glRenderbufferStorage(GL20.GL_RENDERBUFFER,
imageFormat.renderBufferStorageFormat,
fb.getWidth(),
fb.getHeight());
// RendererUtil.checkGLError();
}
}
示例5: updateRenderBuffer
import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
private void updateRenderBuffer(FrameBuffer fb, RenderBuffer rb) {
int id = rb.getId();
if (id == -1) {
GLES20.glGenRenderbuffers(1, intBuf1);
// RendererUtil.checkGLError();
id = intBuf1.get(0);
rb.setId(id);
}
if (context.boundRB != id) {
GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, id);
// RendererUtil.checkGLError();
context.boundRB = id;
}
if (fb.getWidth() > maxRBSize || fb.getHeight() > maxRBSize) {
throw new RendererException("Resolution " + fb.getWidth()
+ ":" + fb.getHeight() + " is not supported.");
}
TextureUtil.AndroidGLImageFormat imageFormat = TextureUtil.getImageFormat(rb.getFormat());
if (imageFormat.renderBufferStorageFormat == 0) {
throw new RendererException("The format '" + rb.getFormat() + "' cannot be used for renderbuffers.");
}
// if (fb.getSamples() > 1 && GLContext.getCapabilities().GL_EXT_framebuffer_multisample) {
if (fb.getSamples() > 1) {
// // FIXME
throw new RendererException("Multisample FrameBuffer is not supported yet.");
// int samples = fb.getSamples();
// if (maxFBOSamples < samples) {
// samples = maxFBOSamples;
// }
// glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT,
// samples,
// glFmt.internalFormat,
// fb.getWidth(),
// fb.getHeight());
} else {
GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,
imageFormat.renderBufferStorageFormat,
fb.getWidth(),
fb.getHeight());
// RendererUtil.checkGLError();
}
}
示例6: copyFrameBuffer
import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst) {
if (framebufferBlit) {
int srcW = 0;
int srcH = 0;
int dstW = 0;
int dstH = 0;
int prevFBO = context.boundFBO;
if (src != null && src.isUpdateNeeded()) {
updateFrameBuffer(src);
}
if (dst != null && dst.isUpdateNeeded()) {
updateFrameBuffer(dst);
}
if (src == null) {
bindReadFramebuffer(0);
// srcW = viewWidth;
// srcH = viewHeight;
}
else {
bindReadFramebuffer(src.getId());
srcW = src.getWidth();
srcH = src.getHeight();
}
if (dst == null) {
bindDrawFramebuffer(0);
// dstW = viewWidth;
// dstH = viewHeight;
}
else {
bindDrawFramebuffer(dst.getId());
dstW = dst.getWidth();
dstH = dst.getHeight();
}
blitFramebuffer(0, 0, srcW, srcH, 0, 0, dstW, dstH, Helper.BufferBit.COLOR_BUFFER.getGLConstant()
| Helper.BufferBit.DEPTH_BUFFER.getGLConstant(), Helper.Filter.NEAREST.getGLConstant());
bindFramebuffer(prevFBO);
try {
checkFrameBufferError();
}
catch (IllegalStateException ex) {
logger.log(Level.SEVERE, "Source FBO:\n{0}", src);
logger.log(Level.SEVERE, "Dest FBO:\n{0}", dst);
throw ex;
}
}
else {
throw new UnsupportedOperationException("EXT_framebuffer_blit required.");
// TODO: support non-blit copies?
}
}