當前位置: 首頁>>代碼示例>>Java>>正文


Java GLCapabilities類代碼示例

本文整理匯總了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();	
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:24,代碼來源:Picking.java

示例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;
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:25,代碼來源:NetworkRenderer.java

示例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();

}
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:20,代碼來源:OpenGLTestCapabilities.java

示例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;

}
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:22,代碼來源:OpenGLTestCapabilities.java

示例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);

    }
 
開發者ID:akmaier,項目名稱:CONRAD,代碼行數:22,代碼來源:GLCLInteroperabilityDemo.java

示例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();
}
 
開發者ID:akmaier,項目名稱:CONRAD,代碼行數:28,代碼來源:SurfaceTest.java

示例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);
    }
}
 
開發者ID:slipperyseal,項目名稱:atomicobjects,代碼行數:18,代碼來源:Scene.java

示例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);
		
}
 
開發者ID:chrislee35,項目名稱:visualfirewall,代碼行數:26,代碼來源:PongView.java

示例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);
}
 
開發者ID:momega,項目名稱:spacesimulator,代碼行數:25,代碼來源:JoglTransparencyDemo.java

示例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();
}
 
開發者ID:jstoecker,項目名稱:cspace,代碼行數:24,代碼來源:MainWindow.java

示例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>();
}
 
開發者ID:jacquesh,項目名稱:project-grige,代碼行數:24,代碼來源:GameBase.java

示例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];
}
 
開發者ID:Norkart,項目名稱:NK-VirtualGlobe,代碼行數:24,代碼來源:OffscreenTexture2D.java

示例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);
}
 
開發者ID:iSchluff,項目名稱:Wii-Gesture,代碼行數:23,代碼來源:GForceVis.java

示例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);
}
 
開發者ID:ShadwLink,項目名稱:Shadow-Mapper,代碼行數:26,代碼來源:glListener.java

示例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());

}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:41,代碼來源:MapGLPanel.java


注:本文中的javax.media.opengl.GLCapabilities類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。