本文整理匯總了Java中javax.media.opengl.GLCapabilities.setDepthBits方法的典型用法代碼示例。如果您正苦於以下問題:Java GLCapabilities.setDepthBits方法的具體用法?Java GLCapabilities.setDepthBits怎麽用?Java GLCapabilities.setDepthBits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GLCapabilities
的用法示例。
在下文中一共展示了GLCapabilities.setDepthBits方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getOpenGLProblems
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public static String getOpenGLProblems()
{
GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setDepthBits(24);
caps.setDoubleBuffered(true);
GLCanvas canvas = new GLCanvas(caps);
OpenGLTestCapabilities testClass = new OpenGLTestCapabilities();
canvas.addGLEventListener(testClass);
return testClass.messages.toString();
}
示例2: testOpenGL
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private static boolean testOpenGL()
{
GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setDepthBits(24);
caps.setDoubleBuffered(true);
GLCanvas canvas = new GLCanvas(caps);
OpenGLTestCapabilities testClass = new OpenGLTestCapabilities();
canvas.addGLEventListener(testClass);
testedPreviously = true;
previouslyTestedAsOpenGLCapable = !testClass.fail;
return !testClass.fail;
}
示例3: MainWindow
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public MainWindow(CSpaceViewer viewer) {
GLProfile glp = GLProfile.get(GLProfile.GL2);
GLCapabilities glc = new GLCapabilities(glp);
glc.setSampleBuffers(true);
glc.setNumSamples(8);
glc.setDepthBits(32);
canvas = new GLCanvas(glc);
animator = new FPSAnimator(canvas, 60);
toolBar = new MainToolBar(viewer);
setTitle("Configuration Space Visualization");
setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1280, 720);
setLocationRelativeTo(null);
getContentPane().add(toolBar, BorderLayout.SOUTH);
getContentPane().add(canvas, BorderLayout.CENTER);
canvas.addGLEventListener(emptyScene);
animator.start();
}
示例4: Quantum
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public Quantum( )
{
GLCapabilities caps = new GLCapabilities();
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setAlphaBits(8);
caps.setDepthBits(16);
caps.setStencilBits(8);
caps.setDoubleBuffered(true);
canvas = new GLCanvas( caps );
canvas.addGLEventListener(this);
SoundManager.setBufferVolume( config.getVolumeSfx() );
setBounds( config.getX(), config.getY(), config.getWidth(), config.getHeight() );
setTitle("QUANTUM");
try {
this.setIconImage( ImageIO.read( FileManager.readFile( "icon.png" ) ) );
} catch (Exception e1) {
Log.println( "[Quantum] couldn't 'load icon.png'" );
}
getContentPane().add(canvas,BorderLayout.CENTER);
animator = new Animator( canvas );
animator.setRunAsFastAsPossible( true );
animator.start();
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
remove(canvas);
animator.stop();
closing( );
System.exit(0);
}
});
}
示例5: LocalTest
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
public LocalTest( )
{
sim = new Simulation( true );
for( int i = 0; i < 10; i++ )
{
Planet planet = new Planet( sim, new Vector2D( (float)Math.random() * 20000, (float)Math.random() *20000 ), 100, 1, 1, 1, 200 );
planet.setOwner( 1 );
sim.addObject( planet );
planet.spawnTree();
planet.spawnTree();
for( int j = 0; j < 100; j++ )
planet.spawnCreature();
}
GLCapabilities caps = new GLCapabilities();
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setAlphaBits(8);
caps.setDepthBits(16);
caps.setStencilBits(8);
caps.setNumSamples( 8 );
caps.setDoubleBuffered(true);
GLCanvas canvas = new GLCanvas( caps );
canvas.addGLEventListener(this);
setSize(1024,1024);
setTitle("CAV-Projekt: JOGL - Beispielszene");
getContentPane().add(canvas,BorderLayout.CENTER);
final Animator animator = new Animator( canvas );
animator.setRunAsFastAsPossible( true );
animator.start();
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
animator.stop();
System.exit(0);
}
});
}
示例6: initGLCanvas
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
protected void initGLCanvas(){
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GLCapabilities caps = new GLCapabilities();
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
caps.setStencilBits(settings.getStencilBits());
caps.setDepthBits(settings.getDepthBits());
if (settings.getSamples() > 1){
caps.setSampleBuffers(true);
caps.setNumSamples(settings.getSamples());
}
canvas = new GLCanvas(caps){
@Override
public void addNotify(){
super.addNotify();
onCanvasAdded();
}
@Override
public void removeNotify(){
onCanvasRemoved();
super.removeNotify();
}
};
if (settings.isVSync()){
canvas.getGL().setSwapInterval(1);
}
canvas.setFocusable(true);
canvas.setIgnoreRepaint(true);
canvas.addGLEventListener(this);
GL gl = canvas.getGL();
// if (false){
// trace mode
// jME already uses err stream, use out instead
// gl = new TraceGL(gl, System.out);
// }else if (false){
// debug mode
// gl = new DebugGL(gl);
// }else{
// production mode
// }
renderer = new JoglRenderer(gl);
}
示例7: initGLCanvas
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
protected void initGLCanvas() {
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
caps.setStencilBits(settings.getStencilBits());
caps.setDepthBits(settings.getDepthBits());
if (settings.getSamples() > 1) {
caps.setSampleBuffers(true);
caps.setNumSamples(settings.getSamples());
}
canvas = new GLCanvas(caps) {
@Override
public void addNotify() {
super.addNotify();
onCanvasAdded();
}
@Override
public void removeNotify() {
onCanvasRemoved();
super.removeNotify();
}
};
// TODO: add a check on the settings
// set the size of the canvas as early as possible to avoid further useless reshape attempts
canvas.setSize(settings.getWidth(), settings.getHeight());
if (settings.isVSync()) {
GLContext.getCurrentGL().setSwapInterval(1);
}
canvas.setFocusable(true);
canvas.setIgnoreRepaint(true);
canvas.addGLEventListener(this);
// N.B: it is too early to get the GL instance from the canvas
// if (false){
// trace mode
// jME already uses err stream, use out instead
// gl = new TraceGL(gl, System.out);
// }else if (false){
// debug mode
// gl = new DebugGL(gl);
// }else{
// production mode
// }
renderer = new JoglRenderer();
}