本文整理汇总了Java中com.jogamp.opengl.util.GLReadBufferUtil类的典型用法代码示例。如果您正苦于以下问题:Java GLReadBufferUtil类的具体用法?Java GLReadBufferUtil怎么用?Java GLReadBufferUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLReadBufferUtil类属于com.jogamp.opengl.util包,在下文中一共展示了GLReadBufferUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: display
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
public void display(GLAutoDrawable drawable) {
if (_runnable!=null) {
_runnable.run();
} else {
glPaint();
if (_fileName!=null) {
try {
File file = new File(_fileName);
int w = getWidth();
int h = getHeight();
//Screenshot.writeToFile(file,w,h); // deprecated
GLReadBufferUtil rbu = new GLReadBufferUtil(true,false);
rbu.readPixels(getGL(),false);
rbu.write(file);
} catch (Exception e) {
throw new RuntimeException(e);
}
_fileName = null;
}
if (_autoRepaint)
repaint();
}
}
开发者ID:MinesJTK,项目名称:jtk,代码行数:24,代码来源:GlCanvas.java
示例2: GPUUISceneGLListener0A
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
private GPUUISceneGLListener0A(final float noAADPIThreshold, final int renderModes, final boolean debug, final boolean trace) {
this.noAADPIThreshold = noAADPIThreshold;
this.rs = RenderState.createRenderState(SVertex.factory());
this.debug = debug;
this.trace = trace;
this.renderModes = renderModes;
try {
font = FontFactory.get(FontFactory.UBUNTU).getDefault();
} catch (final IOException ioe) {
throw new RuntimeException(ioe);
}
sceneUIController = new SceneUIController(sceneDist, zNear, zFar);
screenshot = new GLReadBufferUtil(false, false);
}
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:17,代码来源:GPUUISceneGLListener0A.java
示例3: saveFrameAsPng
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
/**
* This method has to be called at the end
* of {@link AbstractGLRenderer#display(javax.media.opengl.GLAutoDrawable)}
* @param drawable the drawable
* @param directory the directory where the output file will be stores
* @return the output file name
*/
public static File saveFrameAsPng( GLAutoDrawable drawable, File directory ) {
File outputFile = new File( directory, String.valueOf(System.nanoTime()) + ".png" );
// Do not overwrite existing image file.
if( outputFile.exists() ) {
return null;
}
logger.info("screenshot taken to {}", outputFile.getName());
GL2 gl = drawable.getGL().getGL2();
final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
if(screenshot.readPixels(gl, false)) {
screenshot.write(outputFile);
}
return outputFile;
}
开发者ID:momega,项目名称:spacesimulator,代码行数:24,代码来源:GLUtils.java
示例4: UIListenerBase01
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
public UIListenerBase01(final int renderModes, final RegionRenderer rRenderer, final boolean debug, final boolean trace) {
this.renderModes = renderModes;
this.rRenderer = rRenderer;
this.debug = debug;
this.trace = trace;
this.screenshot = new GLReadBufferUtil(false, false);
}
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:8,代码来源:UIListenerBase01.java
示例5: GPURendererListenerBase01
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
public GPURendererListenerBase01(final RegionRenderer renderer, final int renderModes, final boolean debug, final boolean trace) {
this.renderer = renderer;
this.renderModes = renderModes;
this.debug = debug;
this.trace = trace;
this.screenshot = new GLReadBufferUtil(false, false);
nearPlane1Box = new AABBox();
}
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:9,代码来源:GPURendererListenerBase01.java
示例6: testTextRendererImpl
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
void testTextRendererImpl(final Font[] fonts, final int renderModes, final int sampleCount, final boolean onlyIssues) throws InterruptedException, GLException, IOException {
final GLProfile glp;
if(forceGL3) {
glp = GLProfile.get(GLProfile.GL3);
} else if(forceES2) {
glp = GLProfile.get(GLProfile.GLES2);
} else {
glp = GLProfile.getGL2ES2();
}
final GLCapabilities caps = new GLCapabilities( glp );
caps.setAlphaBits(4);
if( 0 < sampleCount && !Region.isVBAA(renderModes) ) {
caps.setSampleBuffers(true);
caps.setNumSamples(sampleCount);
}
caps.setOnscreen(false);
System.err.println("Requested: "+caps);
System.err.println("Requested: "+Region.getRenderModeString(renderModes));
final int totalHeight = ( (int)fontSize + 1 ) * ( onlyIssues ? 3 : 6 ) * fonts.length;
final NEWTGLContext.WindowContext winctx =
NEWTGLContext.createWindow(caps, 800, totalHeight, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
System.err.println("Chosen: "+winctx.window.getChosenCapabilities());
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final RegionRenderer renderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
final TextRegionUtil textRenderUtil = new TextRegionUtil(renderModes);
// init
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
renderer.init(gl, 0);
rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f);
screenshot = new GLReadBufferUtil(false, false);
// reshape
gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
// renderer.reshapePerspective(gl, 45.0f, drawable.getWidth(), drawable.getHeight(), 0.1f, 1000.0f);
renderer.reshapeOrtho(drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), 0.1f, 1000.0f);
final int[] sampleCountIO = { sampleCount };
// display
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
for(int i=0; i<fonts.length; i++) {
final Font font = fonts[i];
renderString(drawable, gl, renderer, font, textRenderUtil, font.getFullFamilyName(null).toString()+": "+issues, 0, 0==i?0:-1, -1000, sampleCountIO);
if(!onlyIssues) {
renderString(drawable, gl, renderer, font, textRenderUtil, "012345678901234567890123456789", 0, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, font, textRenderUtil, "abcdefghijklmnopqrstuvwxyz", 0, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, font, textRenderUtil, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, -1, -1000, sampleCountIO);
}
renderString(drawable, gl, renderer, font, textRenderUtil, "", 0, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, font, textRenderUtil, "", 0, -1, -1000, sampleCountIO);
}
drawable.swapBuffers();
printScreen(renderModes, drawable, gl, false, sampleCount);
sleep();
// dispose
screenshot.dispose(gl);
renderer.destroy(gl);
NEWTGLContext.destroyWindow(winctx);
}
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:74,代码来源:TestTextRendererNEWTBugXXXX.java
示例7: testTextRendererImpl
import com.jogamp.opengl.util.GLReadBufferUtil; //导入依赖的package包/类
void testTextRendererImpl(final int renderModes, final int sampleCount) throws InterruptedException, GLException, IOException {
final GLProfile glp;
if(forceGL3) {
glp = GLProfile.get(GLProfile.GL3);
} else if(forceES2) {
glp = GLProfile.get(GLProfile.GLES2);
} else {
glp = GLProfile.getGL2ES2();
}
final GLCapabilities caps = new GLCapabilities( glp );
caps.setAlphaBits(4);
if( 0 < sampleCount && !Region.isVBAA(renderModes) ) {
caps.setSampleBuffers(true);
caps.setNumSamples(sampleCount);
}
System.err.println("Requested: "+caps);
System.err.println("Requested: "+Region.getRenderModeString(renderModes));
final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(caps, 800, 400, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
System.err.println("Chosen: "+winctx.window.getChosenCapabilities());
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final RegionRenderer renderer = RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);
final TextRegionUtil textRenderUtil = new TextRegionUtil(renderModes);
// init
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
renderer.init(gl, 0);
rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f);
screenshot = new GLReadBufferUtil(false, false);
// reshape
gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
// renderer.reshapePerspective(gl, 45.0f, drawable.getWidth(), drawable.getHeight(), 0.1f, 1000.0f);
renderer.reshapeOrtho(drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), 0.1f, 1000.0f);
final int[] sampleCountIO = { sampleCount };
// display
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if( null == customStr ) {
renderString(drawable, gl, renderer, textRenderUtil, "012345678901234567890123456789", 0, 0, -1000, sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 0, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "Hello World", 0, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "4567890123456", 4, -1, -1000,sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "I like JogAmp", 4, -1, -1000, sampleCountIO);
int c = 0;
renderString(drawable, gl, renderer, textRenderUtil, "GlueGen", c++, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "JOAL", c++, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "JOGL", c++, -1, -1000, sampleCountIO);
renderString(drawable, gl, renderer, textRenderUtil, "JOCL", c++, -1, -1000, sampleCountIO);
} else {
renderString(drawable, gl, renderer, textRenderUtil, customStr, 0, 0, -1000, sampleCountIO);
}
drawable.swapBuffers();
printScreen(renderModes, drawable, gl, false, sampleCount);
sleep();
// dispose
screenshot.dispose(gl);
renderer.destroy(gl);
NEWTGLContext.destroyWindow(winctx);
}
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:74,代码来源:TestTextRendererNEWT10.java
注:本文中的com.jogamp.opengl.util.GLReadBufferUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论