当前位置: 首页>>代码示例>>Java>>正文


Java GLJPanel类代码示例

本文整理汇总了Java中javax.media.opengl.awt.GLJPanel的典型用法代码示例。如果您正苦于以下问题:Java GLJPanel类的具体用法?Java GLJPanel怎么用?Java GLJPanel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GLJPanel类属于javax.media.opengl.awt包,在下文中一共展示了GLJPanel类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: OpenGLViewer

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public OpenGLViewer (String title){
	super(title);
	panel = new GLJPanel();
	panel.addGLEventListener(this);
	panel.setPreferredSize(new Dimension(width, height));
	edu.stanford.rsl.conrad.cuda.MouseControl mouseControl = new edu.stanford.rsl.conrad.cuda.MouseControl(this);
	panel.addMouseMotionListener(mouseControl);
	panel.addMouseWheelListener(mouseControl);
	this.add(panel);
	pack();
	setVisible(true);
	boolean animate = true;
	if (animate) {
		animator = new Animator(panel);
		animator.setRunAsFastAsPossible(true);
		animator.start();
	}

	addWindowListener(new WindowAdapter()
	{
		public void windowClosing(WindowEvent e)
		{
			runExit();
		}
	});
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:27,代码来源:OpenGLViewer.java

示例2: main

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public static void main(String[] args) {

		caps = new GLCapabilities(GLProfile.getGL2GL3());
		caps.setDoubleBuffered(true); // request double buffer display mode
		caps.setHardwareAccelerated(true);
		GLJPanel canvas = new GLJPanel();

		the_game myself = new the_game();
		canvas.addGLEventListener(myself);

		canvas.addKeyListener(myself);
		animator = new FPSAnimator(canvas, 60);

		JFrame frame = new JFrame("Grab Life by the Fireballs!");
		frame.setSize(width, height); // Size in pixels of the frame we draw on
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().add(canvas);
		frame.setVisible(true);
		canvas.requestFocusInWindow();
		myself.run();
	}
 
开发者ID:thomaj46,项目名称:GraphicsGame,代码行数:22,代码来源:the_game.java

示例3: FeaturePointsCanvas

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public FeaturePointsCanvas(ProjectTopComponent tc) {
    super(tc);

    GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2));
    capabilities.setDoubleBuffered(true);
    //    capabilities.setAlphaBits(0);
    glJPanel = new GLJPanel(capabilities);
    glAnimatorControl = new Animator(glJPanel);
    glAnimatorControl.start();
    initComponents();

    jPanel2.add(glJPanel);
    this.validate();
}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:15,代码来源:FeaturePointsCanvas.java

示例4: main

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
/** The entry main() method to setup the top-level container and animator */
public static void main(String[] args) {
    // Run the GUI codes in the event-dispatching thread for thread safety
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            // Create the OpenGL rendering canvas
            GLJPanel canvas = new JOGL2Setup_GLCanvas();
            canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));

            // Create a animator that drives canvas' display() at the specified FPS.
            final FPSAnimator animator = new FPSAnimator(canvas, FPS, true);

            // Create the top-level container
            final JFrame frame = new JFrame(); // Swing's JFrame or AWT's Frame
            frame.getContentPane().add(canvas);
            frame.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    // Use a dedicate thread to run the stop() to ensure that the
                    // animator stops before program exits.
                    new Thread() {
                        @Override
                        public void run() {
                            if (animator.isStarted()) animator.stop();
                            System.exit(0);
                        }
                    }.start();
                }
            });
            frame.setTitle(TITLE);
            frame.pack();
            frame.setVisible(true);
            animator.start(); // start the animation loop
        }
    });
}
 
开发者ID:lxjuly,项目名称:testteigha,代码行数:38,代码来源:JOGL2Setup_GLCanvas.java

示例5: display

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
@Override
    public void display(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();

        // Special handling for the case where the GLJPanel is translucent
        // and wants to be composited with other Java 2D content
        if ((drawable instanceof GLJPanel)
                && !((GLJPanel) drawable).isOpaque()
                && ((GLJPanel) drawable)
                .shouldPreserveColorBufferIfTranslucent()) {
            gl.glClear(GL2.GL_DEPTH_BUFFER_BIT);
        } else {
            gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
        }

        gl.glLoadIdentity();  // reset the model-view matrix

        // ----- Your OpenGL rendering code here (Render a white triangle for testing) -----

        gl.glTranslatef(0.0f, 0.0f, -18.75f); // translate into the screen

        gl.glColor4f(1.0f, 0.0f, 0.0f, 0.7f); // red
        if (TMLs != null) {
            // Do some rendering here
            for (TMLCircle circle : TMLs) {
                float x = (float) circle.getX();
                float y = (float) circle.getY();
                float r = (float) circle.getRadius();
//                System.out.println("Center: (" + x + ", " + y + ") " + "Radius: " + r);
                drawFilledCircle(gl, (float) circle.getX(), (float) circle.getY(), (float) circle.getRadius());
            }
        }

    }
 
开发者ID:lxjuly,项目名称:testteigha,代码行数:35,代码来源:EquipGLPanel.java

示例6: main

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            GLJPanel canvas = new EquipGLPanel(null);
            canvas.setPreferredSize(new Dimension(800, 600));

            final FPSAnimator animator = new FPSAnimator(canvas, 60, true);

            final JFrame frame = new JFrame();
            frame.getContentPane().add(canvas);

            frame.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    // Use a dedicate thread to run the stop() to ensure that the
                    // animator stops before program exits.
                    new Thread() {
                        @Override
                        public void run() {
                            if (animator.isStarted()) animator.stop();
                            System.exit(0);
                        }
                    }.start();
                }
            });
            frame.setTitle("Equipment GL Panel");
            frame.pack();
            frame.setVisible(true);
            animator.start(); // start the animation loop
        }
    });
}
 
开发者ID:lxjuly,项目名称:testteigha,代码行数:34,代码来源:EquipGLPanel.java

示例7: init

import javax.media.opengl.awt.GLJPanel; //导入依赖的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);
}
 
开发者ID:OSUCartography,项目名称:TerrainViewer,代码行数:38,代码来源:Map3DViewer.java

示例8: start

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public void start(){

		// Initialize the GL component 
		glComponentL = new GLJPanel();
		glComponentL.addGLEventListener(this);
		if (stereoMode)
		{
			glComponentR = new GLJPanel();
			glComponentR.addGLEventListener(this);
		}

		// Initialize the mouse controls
		MouseControl mouseControl = new MouseControl(this);
		glComponentL.addMouseMotionListener(mouseControl);
		glComponentL.addMouseWheelListener(mouseControl);


		frame.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				runExit();
			}
		});
		frame.setLayout(new BorderLayout());
		glComponentL.setPreferredSize(new Dimension(width, height));
		JPanel p = new JPanel(new GridLayout(1,1));
		p.add(glComponentL);
		if (stereoMode)
		{
			p.setLayout(new GridLayout(1,2));
			p.add(glComponentR);
		}
		frame.add(p, BorderLayout.CENTER);
		frame.add(createControlPanel(), BorderLayout.SOUTH);
		frame.pack();
		frame.setVisible(true);

		// Create and start the animator
		boolean animate = true;
		if (animate) {
			animatorL = new Animator(glComponentL);
			animatorL.setRunAsFastAsPossible(true);
			animatorL.start();
			if (stereoMode)
			{
				animatorR = new Animator(glComponentR);
				animatorR.setRunAsFastAsPossible(true);
				animatorR.start();
			}
		}
	}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:53,代码来源:JCudaDriverTextureSample.java

示例9: start

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public void start(){

		// Initialize the GL component 
		glComponentL = new GLJPanel();
		glComponentL.addGLEventListener(this);
		if (stereoMode)
		{
			glComponentR = new GLJPanel();
			glComponentR.addGLEventListener(this);
		}

		// Initialize the mouse controls
		MouseControl mouseControl = new MouseControl(this);
		glComponentL.addMouseMotionListener(mouseControl);
		glComponentL.addMouseWheelListener(mouseControl);


		frame.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				runExit();
			}
		});
		frame.setLayout(new BorderLayout());
		glComponentL.setPreferredSize(new Dimension(width, height));
		JPanel p = new JPanel(new GridLayout(1,1));
		p.add(glComponentL);
		if (stereoMode)
		{
			p.setLayout(new GridLayout(1,2));
			p.add(glComponentR);
		}
		frame.add(p, BorderLayout.CENTER);
		frame.add(this.createControlPanel(), BorderLayout.SOUTH);
		frame.pack();
		frame.setVisible(true);

		// Create and start the animator
		boolean animate = true;
		if (animate) {
			animatorL = new Animator(glComponentL);
			animatorL.setRunAsFastAsPossible(true);
			animatorL.start();
			if (stereoMode)
			{
				animatorR = new Animator(glComponentR);
				animatorR.setRunAsFastAsPossible(true);
				animatorR.start();
			}
		}
	}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:53,代码来源:OpenCLTextureRendering.java

示例10: Mouse

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public Mouse(GLJPanel panel) {
    this.panel = panel;
    panel.addMouseListener(this);
    panel.addMouseWheelListener(this);
}
 
开发者ID:Warlander,项目名称:DeedPlanner-2,代码行数:6,代码来源:Mouse.java

示例11: Keyboard

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public Keyboard(GLJPanel panel) {
    panel.addKeyListener(this);
}
 
开发者ID:Warlander,项目名称:DeedPlanner-2,代码行数:4,代码来源:Keyboard.java

示例12: getCADGLPanel

import javax.media.opengl.awt.GLJPanel; //导入依赖的package包/类
public GLJPanel getCADGLPanel() {
    return equipGLPanel;
}
 
开发者ID:lxjuly,项目名称:testteigha,代码行数:4,代码来源:MainFrame.java


注:本文中的javax.media.opengl.awt.GLJPanel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。