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


Java GLProfile類代碼示例

本文整理匯總了Java中javax.media.opengl.GLProfile的典型用法代碼示例。如果您正苦於以下問題:Java GLProfile類的具體用法?Java GLProfile怎麽用?Java GLProfile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GLProfile類屬於javax.media.opengl包,在下文中一共展示了GLProfile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCaps

import javax.media.opengl.GLProfile; //導入依賴的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

示例2: TileManager

import javax.media.opengl.GLProfile; //導入依賴的package包/類
/**
 * Initializes a tile-manager using a persistent cache.
 * 
 * @param glProfile
 *            The OpenGL-Profile to use.
 */
public TileManager(GLProfile glProfile) {
	super(MANAGER_LABEL, false, false);

	this.cache = new TileCache(this, glProfile);

	/*
	 * A loader must be created for performing queries for tiles. Also it
	 * will use a TileCache as a on-disk-cache.
	 */
	loader = new Loader<TileQuery, TileResource>(this.cache,
			new TileWorkerFactory(glProfile), this);

	loader.addListener(this); // Listen for new data available

	loader.start();

	loadStylesFromXML(); // Read the available styles from file
}
 
開發者ID:johb,項目名稱:GAIA,代碼行數:25,代碼來源:TileManager.java

示例3: getOpenGLProblems

import javax.media.opengl.GLProfile; //導入依賴的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.GLProfile; //導入依賴的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.GLProfile; //導入依賴的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.GLProfile; //導入依賴的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.GLProfile; //導入依賴的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: Map3DFrame

import javax.media.opengl.GLProfile; //導入依賴的package包/類
public Map3DFrame(float[][] grid, float cellSize) {
    super("3D Map Viewer");
    
    // Use this if you use a heavy weight component with swing
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(true);

    setSize(1024, 768);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    this.viewer = new Map3DViewer(Map3DViewer.GLComponentType.GL_AWT, GLProfile.getDefault());
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(this.viewer.getComponent(), BorderLayout.CENTER);
    
    setVisible(true);
    setBackgroundColor(0xff, 0xff, 0xff);
    enableLight(true);
           
    setModel(grid, cellSize);
}
 
開發者ID:OSUCartography,項目名稱:TerrainViewer,代碼行數:22,代碼來源:Map3DFrame.java

示例9: checkMinimumSpec

import javax.media.opengl.GLProfile; //導入依賴的package包/類
private static void checkMinimumSpec(){
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception ex) {}
    
    if(!GLProfile.isAvailable(GLProfile.GL4)){
        final JPanel pane = new JPanel(new GridLayout(-1, 1));
        pane.add(new JLabel("Your graphic card does not support OpenGL 4, try updating your driver."));
        pane.add(new JLabel(""));
        pane.add(new JLabel("Minimum graphic card"));
        pane.add(new JLabel("- Nvidia GeForce 400 series"));
        pane.add(new JLabel("- AMD Radeon 5000 series"));
                    
        JOptionPane.showMessageDialog(null, pane, "Minimum spec error", JOptionPane.ERROR_MESSAGE);
        
        System.exit(0);
    }
    
}
 
開發者ID:silice-hf,項目名稱:3ddm,代碼行數:20,代碼來源:Game.java

示例10: setup

import javax.media.opengl.GLProfile; //導入依賴的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

示例11: createPartControl

import javax.media.opengl.GLProfile; //導入依賴的package包/類
@Override
public void createPartControl(Composite parent)
{
    GLData glData = new GLData();
    glData.doubleBuffer = true;

    setContainer(new GLCanvas(parent, SWT.NO_BACKGROUND, glData));
    getContainer().setLayout(new FillLayout());
    getContainer().setCurrent();

    GLProfile glProfile = GLProfile.getDefault();
    GLDrawableFactory glFactory = GLDrawableFactory.getFactory(glProfile);

    setGlContext(glFactory.createExternalGLContext());
    getGlContext().makeCurrent();
    initGLContext();

    setMapDrawer(new GLMapDrawer(this));

    addMapPaintListener();
    addMapResizeListener();
    addMouseListener();

    MaruUIPlugin.getDefault().getUiModel().addUiProjectModelListener(this);
    MaruUIPlugin.getDefault().getUiModel().addUiProjectSelectionListener(this);
}
 
開發者ID:vobject,項目名稱:maru,代碼行數:27,代碼來源:GLMapView.java

示例12: MainWindow

import javax.media.opengl.GLProfile; //導入依賴的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

示例13: internalSetup

import javax.media.opengl.GLProfile; //導入依賴的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

示例14: init

import javax.media.opengl.GLProfile; //導入依賴的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: TestFrameComponent

import javax.media.opengl.GLProfile; //導入依賴的package包/類
public TestFrameComponent() {
	super("test");
	/*
     * display mode (single buffer and RGBA)
     */
	GLProfile prof=GLProfile.getDefault();
    caps = new GLCapabilities(prof);
    caps.setDoubleBuffered(false);
    System.out.println(caps.toString());
    canvas = new GLCanvas(caps);
    canvas.addGLEventListener(this);
    //
    getContentPane().add(canvas);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:15,代碼來源:TestFrameComponent.java


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