本文整理匯總了Java中javax.media.opengl.GLCapabilities.setSampleBuffers方法的典型用法代碼示例。如果您正苦於以下問題:Java GLCapabilities.setSampleBuffers方法的具體用法?Java GLCapabilities.setSampleBuffers怎麽用?Java GLCapabilities.setSampleBuffers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GLCapabilities
的用法示例。
在下文中一共展示了GLCapabilities.setSampleBuffers方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCaps
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private GLCapabilities getCaps() {
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
// Anti-aliasing using Multisampling
if (AA_MULTISAMPLING) {
try {
caps.setAlphaBits(ALPHA_BITS);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setSampleBuffers(true);
caps.setNumSamples(8);
caps.setAccumAlphaBits(ALPHA_BITS);
caps.setAccumBlueBits(ALPHA_BITS);
caps.setAccumGreenBits(ALPHA_BITS);
caps.setAccumRedBits(ALPHA_BITS);
} catch (javax.media.opengl.GLException ex) {
ex.printStackTrace();
}
}
return caps;
}
示例2: initUI
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private void initUI() {
this.width = 600;
this.height = 400;
GLCapabilities config = new GLCapabilities(GLProfile.get(GLProfile.GL2));
config.setSampleBuffers(true);
config.setNumSamples(4);
GLCanvas canvas = new GLCanvas(config);
canvas.addGLEventListener(this);
usi.init(canvas);
JFrame frame = new JFrame("JOGL-JOCL Interoperability Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(canvas);
frame.setSize(width, height);
frame.setVisible(true);
}
示例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: init
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
private void init(GLComponentType glComponentType, GLProfile profile, Map3DModel model) {
GLCapabilities caps = new GLCapabilities(profile);
// use sample buffers for antialiasing
caps.setSampleBuffers(true);
// set the number of supersampling for antialising
caps.setNumSamples(Map3DOptionsPanel.getAntialiasingLevel());
if (glComponentType == GLComponentType.GL_Swing) {
this.component = new GLJPanel(caps);
} else {
this.component = new GLCanvas(caps);
}
this.drawable = (GLAutoDrawable)this.component;
this.component.setSize(1024, 768);
//((Component) this.component).setIgnoreRepaint(true);
this.drawable.addGLEventListener(this);
if (model == null) {
model = new Map3DModelVBOShader();
if (!model.canRun()) {
model = new Map3DModelVBO();
}
if (!model.canRun()) {
model = new Map3DModelVertexArrays();
}
}
//model = new Map3DModelVertexArrays();
this.model = model;
this.texture = new Map3DTexture();
this.setAnimation(new Map3DRotationAnimation(this.drawable));
mouseHandler = new Map3DMouseHandler(this);
this.component.addMouseMotionListener(mouseHandler);
this.component.addMouseListener(mouseHandler);
this.component.addMouseWheelListener(mouseHandler);
}
示例5: NeonNewtWindow
import javax.media.opengl.GLCapabilities; //導入方法依賴的package包/類
/**
* Constructor for this class. Sets up the window and enables common
* features like anti-aliasing and hardware acceleration.
*
* @param forceGL2ES2
* Force GL2ES2 support (default on), currently Unused
* @param inputHandler
* A predefined InputHandler that is added as event handler for
* input events.
* @param glEventListener
* A predefined GLEventListener that is added as event handler
* for openGL events.
* @param width
* The initial window width.
* @param height
* The initial window height.
* @param windowTitle
* The window title.
*/
public NeonNewtWindow(boolean forceGL2ES2, InputHandler inputHandler, final GLEventListener glEventListener,
int width, int height, String windowTitle) {
GLProfile.initSingleton();
final GLProfile glp;
glp = GLProfile.get(GLProfile.GL3);
// Set up the GL context
final GLCapabilities caps = new GLCapabilities(glp);
caps.setBackgroundOpaque(true);
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
// Add Anti-Aliasing
caps.setSampleBuffers(true);
caps.setAlphaBits(4);
caps.setNumSamples(4);
GLWindow window = GLWindow.create(caps);
window.addGLEventListener(glEventListener);
window.addWindowListener(new QuitListener());
window.setAutoSwapBufferMode(true);
window.setSize(width, height);
window.setTitle(windowTitle);
window.addMouseListener(inputHandler);
window.addKeyListener(inputHandler);
Animator animator = new Animator();
animator.add(window);
animator.start();
animator.setUpdateFPSFrames(60, null);
window.setVisible(true);
}
示例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();
}