本文整理汇总了Java中com.jogamp.opengl.GLCapabilities.setAlphaBits方法的典型用法代码示例。如果您正苦于以下问题:Java GLCapabilities.setAlphaBits方法的具体用法?Java GLCapabilities.setAlphaBits怎么用?Java GLCapabilities.setAlphaBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GLCapabilities
的用法示例。
在下文中一共展示了GLCapabilities.setAlphaBits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createOpenGLCanvas
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
private void createOpenGLCanvas() {
if (trackDisplay != null)
{
trackPanel.remove(trackDisplay);
}
else {
// design capabilities of opengl canvas
GLCapabilities caps = new GLCapabilities(null);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
trackDisplay = new RaceDisplay(caps);
trackPanel.add(trackDisplay);
}
}
示例2: createDrawable
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public GLAutoDrawable createDrawable(final Composite parent) {
final GLProfile profile = GLProfile.getDefault();
final GLCapabilities cap = new GLCapabilities(profile);
cap.setDepthBits(24);
// cap.setBackgroundOpaque(true);
cap.setDoubleBuffered(true);
cap.setHardwareAccelerated(true);
cap.setSampleBuffers(true);
cap.setAlphaBits(8);
cap.setNumSamples(8);
canvas = new GLCanvas(parent, SWT.NONE, cap, null);
canvas.setAutoSwapBufferMode(true);
final SWTGLAnimator animator = new SWTGLAnimator(canvas);
// animator.setIgnoreExceptions(!GamaPreferences.Runtime.ERRORS_IN_DISPLAYS.getValue());
animator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null);
canvas.addGLEventListener(this);
final FillLayout gl = new FillLayout();
canvas.setLayout(gl);
return canvas;
}
示例3: createGLCapabilities
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
/**
* Converts a Capability object to an GLCapability object
* @return GLCapability object
* @param a The Capability object
*/
public static GLCapabilities createGLCapabilities(Capabilities a) {
GLCapabilities capabilities = new GLCapabilities(null);
capabilities.setRedBits(a.r);
capabilities.setBlueBits(a.b);
capabilities.setGreenBits(a.g);
capabilities.setAlphaBits(a.a);
capabilities.setDoubleBuffered(a.doubleBuffered);
return capabilities;
}
示例4: createOpenGLCanvas
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
/** Factory method for creating an ImageDisplay with following capabilities:
* <pre>
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
</pre>
*
* @return a new ImageDisplay
*/
public static ImageDisplay createOpenGLCanvas() {
// design capabilities of opengl canvas
GLCapabilities caps = new GLCapabilities(null);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
ImageDisplay trackDisplay = new ImageDisplay(caps);
return trackDisplay;
}
示例5: createOpenGLCanvas
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public static ImageDisplayWriter createOpenGLCanvas() {
// design capabilities of opengl canvas
GLCapabilities caps = new GLCapabilities(null);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
ImageDisplayWriter trackDisplay = new ImageDisplayWriter(caps);
return trackDisplay;
}
示例6: createOpenGLCanvas
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
/**
* Factory method for creating an ImageDisplay with following capabilities:
* <pre>
* caps.setDoubleBuffered(true);
* caps.setHardwareAccelerated(true);
* caps.setAlphaBits(8);
* caps.setRedBits(8);
* caps.setGreenBits(8);
* caps.setBlueBits(8);
* </pre>
*
* @return a new ImageDisplay
*/
public static ImageDisplay createOpenGLCanvas() {
// design capabilities of opengl canvas
GLCapabilities caps = new GLCapabilities(null);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
ImageDisplay trackDisplay = new ImageDisplay(caps);
return trackDisplay;
}
示例7: drawShape
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
@Override
public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) {
if( null == fboGLAD ) {
final ImageSequence imgSeq = (ImageSequence)texSeq;
final GLContext ctx = gl.getContext();
final GLDrawable drawable = ctx.getGLDrawable();
final GLCapabilitiesImmutable reqCaps = drawable.getRequestedGLCapabilities();
final GLCapabilities caps = (GLCapabilities) reqCaps.cloneMutable();
caps.setFBO(true);
caps.setDoubleBuffered(false);
if( !useAlpha ) {
caps.setAlphaBits(0);
}
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
fboGLAD = (GLOffscreenAutoDrawable.FBO) factory.createOffscreenAutoDrawable(
drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(),
caps, null, fboWidth, fboHeight);
fboWidth = 0;
fboHeight = 0;
fboGLAD.setSharedContext(ctx);
fboGLAD.setTextureUnit(imgSeq.getTextureUnit());
fboGLAD.addGLEventListener(glel);
fboGLAD.display(); // 1st init!
final FBObject.TextureAttachment texA01 = fboGLAD.getColorbuffer(GL.GL_FRONT).getTextureAttachment();
final Texture tex = new Texture(texA01.getName(), imgSeq.getTextureTarget(),
fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(),
false /* mustFlipVertically */);
imgSeq.addFrame(gl, tex);
markStateDirty();
} else if( 0 != fboWidth*fboHeight ) {
fboGLAD.setSurfaceSize(fboWidth, fboHeight);
fboWidth = 0;
fboHeight = 0;
markStateDirty();
} else if( animateGLEL ) {
fboGLAD.display();
}
super.drawShape(gl, renderer, sampleCount);
if( animateGLEL ) {
markStateDirty(); // keep on going
}
}
示例8: main
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public static void main(final String[] args) {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
caps.setSampleBuffers(true);
caps.setNumSamples(4);
System.out.println("Requested: " + caps);
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
window.setSize(800, 400);
window.setTitle("GPU UI Newt Demo 01");
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE);
uiGLListener.attachInputListenerTo(window);
window.addGLEventListener(uiGLListener);
window.setVisible(true);
final Animator animator = new Animator();
animator.setUpdateFPSFrames(60, System.err);
animator.add(window);
window.addKeyListener(new KeyAdapter() {
public void keyPressed(final KeyEvent arg0) {
if(arg0.getKeyCode() == KeyEvent.VK_F4) {
window.destroy();
}
}
});
window.addWindowListener(new WindowAdapter() {
public void windowDestroyed(final WindowEvent e) {
animator.stop();
}
});
animator.start();
}
示例9: test00RegionRendererNONE01
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public void test00RegionRendererNONE01() throws InterruptedException {
final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
final GLCapabilities caps = new GLCapabilities(glp);
// caps.setOnscreen(false);
caps.setAlphaBits(4);
final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400);
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
window.addGLEventListener(listener);
listener.setTech(-20, 0, -300, 0f, 2);
window.display();
listener.setTech(-20, 0, -150, 0f, 3);
window.display();
listener.setTech(-20, 0, -50, 0f, 4);
window.display();
destroyWindow(window);
}
示例10: test01RegionRendererNONE02
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public void test01RegionRendererNONE02() throws InterruptedException {
if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
// FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
// FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet!
System.err.println("disabled on non desktop (x86) arch for now ..");
return;
}
final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
final GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400);
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
window.addGLEventListener(listener);
listener.setTech(-20, 0, -300, 0f, 2);
window.display();
listener.setTech(-20, 0, -150, 0f, 3);
window.display();
listener.setTech(-20, 0, -50, 0f, 4);
window.display();
destroyWindow(window);
}
示例11: test10RegionRendererMSAA01
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
@Test
public void test10RegionRendererMSAA01() throws InterruptedException {
final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
final GLCapabilities caps = new GLCapabilities(glp);
// caps.setOnscreen(false);
caps.setAlphaBits(4);
caps.setSampleBuffers(true);
caps.setNumSamples(4);
final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
window.addGLEventListener(listener);
listener.setTech(-20, 00, -300, 0f, 2);
window.display();
listener.setTech(-20, 00, -150, 0f, 3);
window.display();
listener.setTech(-20, 00, -50, 0f, 4);
window.display();
destroyWindow(window);
}
示例12: test11RegionRendererMSAA02
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public void test11RegionRendererMSAA02() throws InterruptedException {
if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
// FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
// FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet!
System.err.println("disabled on non desktop (x86) arch for now ..");
return;
}
final GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
final GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
caps.setSampleBuffers(true);
caps.setNumSamples(4);
final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
window.addGLEventListener(listener);
listener.setTech(-20, 00, -300, 0f, 2);
window.display();
listener.setTech(-20, 00, -150, 0f, 3);
window.display();
listener.setTech(-20, 00, -50, 0f, 4);
window.display();
destroyWindow(window);
}
示例13: test20RegionRendererR2T01
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
@Test
public void test20RegionRendererR2T01() throws InterruptedException {
if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME
// FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise).
System.err.println("disabled on non desktop (x86) arch for now ..");
return;
}
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
//caps.setOnscreen(false);
caps.setAlphaBits(4);
final GLWindow window = createWindow("shape-vbaa1-msaa0", caps, 800,400);
final RenderState rs = RenderState.createRenderState(SVertex.factory());
final GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT, 4, false, false);
demo02Listener.attachInputListenerTo(window);
window.addGLEventListener(demo02Listener);
final RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02");
window.addGLEventListener(listener);
listener.setTech(-20, 00, -300, 0f, 2);
window.display();
listener.setTech(-20, 00, -150, 0f, 3);
window.display();
listener.setTech(-20, 00, -50, 0f, 4);
window.display();
destroyWindow(window);
}
示例14: main
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public static void main(String[] args){
boolean fullScreen = args.length > 0 && args[0].equals("-fullscreen");
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp.get(GLProfile.GL3));
caps.setAlphaBits(8);
final StarchartCanvas canvas = new StarchartCanvas(caps);
FPSAnimator animator = new FPSAnimator(canvas, 120);
ToolBar bar = new ToolBar();
final JFrame frame = new JFrame("Java Planetarium");
frame.setLayout(new BorderLayout());
JPanel panel = new JPanel(new BorderLayout());
panel.add(canvas);
TimeMenu tm = new TimeMenu();
tm.setVisible(false);
if(fullScreen){
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setUndecorated(true);
}
frame.setContentPane(panel);
frame.add(bar, BorderLayout.SOUTH);
//frame.pack();
frame.setSize(width, height);
frame.setVisible(true);
animator.start();
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
canvas.destroy();
System.exit(0);
}
});
}
示例15: main
import com.jogamp.opengl.GLCapabilities; //导入方法依赖的package包/类
public static void main(String[] args){
try {
UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");
//UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.BOLD, 14));
//UIManager.setLookAndFeel("com.jtattoo.plaf.noire.NoireLookAndFeel");
}
catch (Exception ex){
ex.printStackTrace();
}
fullScreen = args.length > 0 && args[0].equals("-fullscreen");
Observer observer = new Observer();
SplashDialog splash = new SplashDialog();
splash.setVisible(true);
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp.get(GLProfile.GL3));
caps.setAlphaBits(8);
canvas = new StarchartCanvas(caps, observer);
FPSAnimator animator = new FPSAnimator(canvas, 120);
ToolBar bar = new ToolBar(observer);
frame.setLayout(new BorderLayout());
JPanel panel = new JPanel(new BorderLayout());
panel.add(canvas);
timeMenu = new TimeMenu(frame, observer);
timeMenu.setVisible(false);
locationMenu = new LocationMenu(frame, observer);
locationMenu.setVisible(false);
/*satelliteMenu = new SatelliteMenu();
satelliteMenu.setVisible(true);
**/
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final int x = (screenSize.width - DEFAULT_WIDTH) / 2;
final int y = (screenSize.height - DEFAULT_HEIGHT) / 2;
frame.setLocation(x, y);
setSize();
panel.add(bar, BorderLayout.SOUTH);
frame.setContentPane(panel);
animator.start();
frame.setVisible(true);
splash.close();
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
exit();
}
});
}