本文整理匯總了Java中javax.media.opengl.GLCapabilities類的典型用法代碼示例。如果您正苦於以下問題:Java GLCapabilities類的具體用法?Java GLCapabilities怎麽用?Java GLCapabilities使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GLCapabilities類屬於javax.media.opengl包,在下文中一共展示了GLCapabilities類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Picking
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
Picking()
{
Frame frame = new Frame("Picking Example");
GLCapabilities capabilities = new GLCapabilities(null);
GLCanvas drawable = new GLCanvas(capabilities);
final Renderer renderer = new Renderer();
drawable.addGLEventListener(renderer);
drawable.addMouseListener(renderer);
drawable.addMouseMotionListener(renderer);
frame.add(drawable);
frame.setSize(400, 400);
final Animator animator = new Animator(drawable);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
animator.stop();
System.exit(0);
}
});
frame.setVisible(true);
animator.start();
}
示例2: 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;
}
示例3: 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();
}
示例4: 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;
}
示例5: 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);
}
示例6: main
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
/**
* @param args
*/
public static void main(String[] args) {
GLProfile.initSingleton();
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
GLCanvas canvas = new GLCanvas(caps);
Frame frame = new Frame("Test Surface rendering in JOGL 2 using nurbs or eval-mesh");
frame.setSize(300, 300);
frame.add(canvas);
frame.setVisible(true);
// by default, an AWT Frame doesn't do anything when you click
// the close button; this bit of code will terminate the program when
// the window is asked to close
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
canvas.addGLEventListener(new SurfaceTest());
FPSAnimator animator = new FPSAnimator(canvas, 5);
//animator.add(canvas);
animator.start();
}
示例7: Scene
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
public Scene(String title, Renderer renderer) {
this.renderer = renderer;
try {
this.display = NewtFactory.createDisplay(null);
this.window = GLWindow.create(new GLCapabilities(GLProfile.get(GLProfile.GL2)));
this.window.setPosition(0, 0);
this.window.setSize(window.getScreen().getWidth(), window.getScreen().getHeight());
this.window.addWindowListener(new WindowHandler(resize, stop));
this.window.addMouseListener(new MouseHandler(this.window, renderer));
this.window.setTitle(title);
this.window.setVisible(true);
} catch (Throwable t) {
dispose();
Throw.unchecked(t);
}
}
示例8: PongView
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
public PongView( Rectangle worldRect ) {
super(worldRect);
lastUpdateTime = System.currentTimeMillis();
if(DEBUG)System.out.println("PongView: PongView() called");
//setWorldWindowRect(worldWindowRect);
//setWorldWindowChanged(false);
// get a GLCanvas
GLCapabilities capabilities = new GLCapabilities();
setCanvas(new GLCanvas());
// add a GLEventListener, which will get called when the
// canvas is resized or needs a repaint
getGLCanvas().addGLEventListener(this);
// instantiate inActive list
for(int i = 0; i < MAX_BALLS; i++)
inActiveBalls.add(new PongBall(0,0));
//add key listener
getGLCanvas().addKeyListener(this);
}
示例9: setup
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
/**
* Create the GLCanvas and set properties for the graphics device
* initialization, such as bits per channel. And advanced features for
* improved rendering performance such as the stencil buffer.
*/
private void setup() {
GLProfile glp = GLProfile.getDefault();
// Specifies a set of OpenGL capabilities, based on your profile.
GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
// create the canvas for drawing
canvas = new GLCanvas(caps);
// create the render thread
anim = new Animator();
// add the canvas to the main window
add(canvas, BorderLayout.CENTER);
// need this to receive callbacks for rendering (i.e. display() method)
canvas.addGLEventListener(this);
}
示例10: 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();
}
示例11: internalSetup
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
protected void internalSetup()
{
//Initialize the OpenGL profile that the game will use
glProfile = GLProfile.getDefault();
glCapabilities = new GLCapabilities(glProfile);
//Create the game window
gameWindow = GLWindow.create(glCapabilities);
gameWindow.setSize(320, 320);
gameWindow.setVisible(true);
gameWindow.setTitle("GrIGE");
//Create the various managers for the game
camera = new Camera(gameWindow.getWidth(),gameWindow.getHeight(),10000);
//Add the required event listeners
gameWindow.addWindowListener(this);
gameWindow.addGLEventListener(this);
//Instantiate other structures
worldObjects = new ArrayList<GameObject>();
worldLights = new ArrayList<Light>();
}
示例12: OffscreenTexture2D
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
/**
* Constructs an offscreen texture that fits the given setup. All values
* must be valid and non-negative.
*/
public OffscreenTexture2D(GLCapabilities caps,
int width,
int height)
{
super(GL.GL_TEXTURE_2D);
if(caps == null)
throw new IllegalArgumentException("Capabilities must be provided");
capabilities = caps;
numSources = 0;
this.height = height;
this.width = width;
clearColor = new float[4];
boundaryModeT = BM_CLAMP;
displayListMap = new HashMap();
layers = new Layer[0];
}
示例13: GForceVis
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
public GForceVis()
{
super("G-Force-Visualization");
setSize(800, 600);
// setDefaultCloseOperation(this.EXIT_ON_CLOSE);
// Canvas
canvas = new GLCanvas(new GLCapabilities());
canvas.addGLEventListener(this);
// KeyListener
canvas.addKeyListener(this);
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
GForceMenuBar gfMenuBar = new GForceMenuBar();
setLayout(new BorderLayout());
add(canvas, BorderLayout.CENTER);
add(gfMenuBar.getMenuBar(), BorderLayout.WEST);
}
示例14: init
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
public void init(GLAutoDrawable drawable) {
GLProfile glProfile = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glProfile);
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
GL2 gl = drawable.getGL().getGL2();
System.err.println("INIT GL IS: " + gl.getClass().getName());
gl.glClearColor(0.250f, 0.250f, 0.250f, 0.0f);
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glEnable(GL2.GL_DEPTH_TEST);
gl.glEnable(GL2.GL_CULL_FACE);
gl.glCullFace(GL2.GL_BACK);
gl.glPolygonMode(GL2.GL_FRONT, GL2.GL_FILL);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL2.GL_BLEND);
// gl.glDisable(gl.GL_COLOR_MATERIAL);
camera = new Camera(0, 2, 5, 0, 2.5f, 0, 0, 1, 0);
}
示例15: MapGLPanel
import javax.media.opengl.GLCapabilities; //導入依賴的package包/類
/**
* Create a panel for
* @param caps
* @param map
* @param log
*/
protected MapGLPanel(GLCapabilities caps, IUnrealMap map, Logger log) {
super(caps);
if (Beans.isDesignTime()) {
Beans.setDesignTime(false);
}
this.map = map;
this.logger = log;
Location mapFocus = new Location(
map.getBox().getCenterX(),
map.getBox().getCenterY(),
map.getBox().getCenterZ());
// Stuff for controlling viewpoint in map
mapViewpoint = new MapViewpoint();
mapController = new MapController(this, mapViewpoint, mapFocus);
mapController.registerListeners();
// Create renderers
mapRenderer = new MapRenderer(map, lastGLName++);
agentRenderes = new GLRendererCollection<IRenderableUTAgent>();
environmentRenderer = new EnvironmentRenderer(mapViewpoint, agentRenderes, mapRenderer);
// Add listener so this level is rendered
this.addGLEventListener(environmentRenderer);
// Listen for changes in viewpoint
mapViewpoint.addViewpointListener(this);
// Set initial position of view + thanks to listener display
mapViewpoint.setFromViewedBox(map.getBox());
}