本文整理匯總了Java中com.jogamp.opengl.util.FPSAnimator.start方法的典型用法代碼示例。如果您正苦於以下問題:Java FPSAnimator.start方法的具體用法?Java FPSAnimator.start怎麽用?Java FPSAnimator.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jogamp.opengl.util.FPSAnimator
的用法示例。
在下文中一共展示了FPSAnimator.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
public static void main(String[] args) {
GLProfile glp = GLProfile.get("GL3");
GLCapabilities caps = new GLCapabilities(glp);
GLWindow glWindow = GLWindow.create(caps);
glWindow.setSize(800, 600);
glWindow.setVisible(true);
glWindow.addWindowListener(new WindowAdapter() {
public void windowDestroyNotify(WindowEvent e) {
System.exit(0);
}
});
FPSAnimator animator = new FPSAnimator(glWindow, 60);
animator.start();
}
示例2: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init(GLAutoDrawable drawable) // Initialisierung
{
GL3 gl = drawable.getGL().getGL3();
System.out.println("OpenGl Version: " + gl.glGetString(gl.GL_VERSION));
System.out.println("Shading Language: " + gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION));
System.out.println();
gl.glEnable(GL3.GL_DEPTH_TEST);
gl.glClearColor(0, 0, 1, 1);
int programId = MyShaders.initShaders(gl, vShader, fShader);
mygl = new MyGLBase1(gl, programId, maxVerts);
quad = new Quader(mygl);
rotk = new RotKoerper(mygl);
FPSAnimator anim = new FPSAnimator(canvas, 200, true);
anim.start();
}
示例3: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init(GLAutoDrawable drawable) // Initialisierung
{
GL3 gl = drawable.getGL().getGL3();
System.out.println("OpenGl Version: " + gl.glGetString(gl.GL_VERSION));
System.out.println("Shading Language: " + gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION));
System.out.println();
gl.glEnable(GL3.GL_DEPTH_TEST);
gl.glClearColor(0.2f, 0.2f, 1.0f, 1);
int programId = MyShaders.initShaders(gl, vShader, fShader);
mygl = new MyGLBase1(gl, programId, maxVerts);
FPSAnimator anim = new FPSAnimator(canvas, 200, true); // Animations-Thread,
// 200
// Frames/sek
anim.start();
lorenzdynamics = new LorenzDynamics(radius);
}
示例4: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init(GLAutoDrawable drawable) // Initialisierung
{
GL3 gl = drawable.getGL().getGL3();
System.out.println("OpenGl Version: " + gl.glGetString(gl.GL_VERSION));
System.out.println("Shading Language: " + gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION));
System.out.println();
gl.glEnable(GL3.GL_DEPTH_TEST);
gl.glClearColor(0.2f, 0.2f, 1.0f, 1);
int programId = MyShaders.initShaders(gl, vShader, fShader);
mygl = new MyGLBase1(gl, programId, maxVerts);
FPSAnimator anim = new FPSAnimator(canvas, 200, true); // Animations-Thread,
// 200
// Frames/sek
anim.start();
}
示例5: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init(GLAutoDrawable drawable) // Initialisierung
{
GL3 gl = drawable.getGL().getGL3();
System.out.println("OpenGl Version: " + gl.glGetString(gl.GL_VERSION));
System.out.println("Shading Language: " + gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION));
System.out.println();
gl.glEnable(GL3.GL_DEPTH_TEST);
gl.glClearColor(0, 0, 1, 1);
int programId = MyShaders.initShaders(gl, vShader, fShader);
mygl = new MyGLBase1(gl, programId, maxVerts);
quad = new Quader(mygl);
rotk = new RotKoerper(mygl);
FPSAnimator anim = new FPSAnimator(canvas, 200, true);
anim.start();
}
示例6: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
glu = new GLU();
/* select clearing color (background) color */
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
/* initialize viewing values */
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
// Start animator (which should be a field).
animator = new FPSAnimator(drawable, 60);
animator.start();
}
示例7: main
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
public static void main(String[] args) {
// getting the capabilities object of GL2 profile
final GLProfile profile = GLProfile.get(GLProfile.GL2);
GLCapabilities glc = new GLCapabilities(profile);
final GLCanvas glCanvas = new GLCanvas(glc);
GameIntro b = new GameIntro();
glCanvas.addGLEventListener(b);
glCanvas.setSize(1300, 800);
// creating frame
final JFrame frame = new JFrame("Welcome to Heavy Evil");
// adding canvas to it
frame.getContentPane().add(glCanvas);
frame.setSize(frame.getContentPane().getPreferredSize());
frame.setVisible(true);
final FPSAnimator animator = new FPSAnimator(glCanvas, 120, true);
animator.start();
glCanvas.isDoubleBuffered();
}
示例8: main
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的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();
}
示例9: Scene
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
Scene(Kengine kengine){
this.kengine = kengine;
GLProfile glprofile = GLProfile.getDefault();
GLCapabilities glcapabilities = new GLCapabilities( glprofile );
canvas = new GLCanvas(glcapabilities);
canvas.setSize(kengine.getWidth(), kengine.getHeight());
canvas.addGLEventListener(this);
canvas.addMouseMotionListener(mkMouseAdapter());
canvas.addMouseListener(mkMouseAdapter());
canvas.addKeyListener(mkKeyAdapter());
canvas.requestFocus();
fpsa = new FPSAnimator(canvas,60,true);
fpsa.start();
kengine.add(canvas);
hideCursor();
try {
rob = new Robot();
} catch (AWTException e) {
e.printStackTrace();
}
mouseCenter = (int) (kengine.getHeight()*.5);
}
示例10: MainWindow
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的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: initGL
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
private static void initGL() {
GLCanvas canvas = new GLCanvas();
canvas.setPreferredSize(new Dimension(Constant.CANVAS_WIDTH,
Constant.CANVAS_HEIGHT));
JFrame frame = new JFrame();
frame.getContentPane().add(canvas);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setTitle(Constant.TITLE);
frame.pack();
frame.setVisible(true);
canvas.addGLEventListener(new ShaderTest());
FPSAnimator animator = new FPSAnimator(canvas, 60);
animator.start();
}
示例12: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init(GLAutoDrawable drawable) // Initialisierung
{
GL3 gl = drawable.getGL().getGL3();
System.out.println("OpenGl Version: " + gl.glGetString(gl.GL_VERSION));
System.out.println("Shading Language: " + gl.glGetString(gl.GL_SHADING_LANGUAGE_VERSION));
System.out.println();
gl.glEnable(GL3.GL_DEPTH_TEST);
gl.glClearColor(0, 0, 1, 1);
int programId = MyShaders.initShaders(gl, vShader, fShader);
mygl = new MyGLBase1(gl, programId, maxVerts);
quad = new ModifyableQuader(mygl, 50f, 2.5f, 1f, 2f);
quad2 = new Quader(mygl);
double a = (quaderLength * quaderLength + quaderWidth * quaderWidth) / 12;
double b = (quaderLength * quaderLength + quaderHeight * quaderHeight) / 12;
double c = (quaderWidth * quaderWidth + quaderHeight * quaderHeight) / 12;
gyro = new GyroDynamics(a, b, c);
gyro.setState(1, 2, 4, 30, 3, 1, 2);
gyro2 = new GyroDynamics(a, b, c);
gyro2.setState(1, 2, 4, 30, 3, 1, 2);
rgb = new Vec3(0, 1, 0);
FPSAnimator anim = new FPSAnimator(canvas, 200, true);
anim.start();
}
示例13: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
/**
* Sets up the screen.
*
* @see GLEventListener#init(GLAutoDrawable)
*/
@Override
public void init(GLAutoDrawable drawable) {
drawable.setGL(new DebugGL2((GL2) drawable.getGL()));
final GL2 gl = (GL2)drawable.getGL();
StatusPrinter.print("INFO", "--- Initializing OpenGL ", Canvas.class);
StatusPrinter.print("INFO", "OpenGL Vendor: " + gl.glGetString(GL2.GL_VENDOR), Canvas.class);
StatusPrinter.print("INFO", "OpenGL Version: " + gl.glGetString(GL2.GL_VERSION), Canvas.class);
StatusPrinter.print("INFO", "OpenGL Renderer: " + gl.glGetString(GL2.GL_RENDERER), Canvas.class);
StatusPrinter.print("INFO", "OpenGL Language Version " + gl.glGetString(GL2.GL_SHADING_LANGUAGE_VERSION), Canvas.class);
StatusPrinter.print("INFO", "OpenGL Extensions: " + gl.glGetString(GL2.GL_EXTENSIONS), Canvas.class);
animator = new FPSAnimator(this, 500);
animator.start();
GLComponent.gl = gl;
GLComponent.gl3 = (GL3)drawable.getGL();
GLComponent.glu = new GLU();
GLComponent.glut = new GLUT();
ALComponent.al = ALFactory.getAL();
try {
turret.preInit();
} catch (TextureException | ModelReaderObjException | ModelReader3dsException | IOException e) {
e.printStackTrace();
}
turret.init();
}
示例14: GoButtonMouseClicked
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
private void GoButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_GoButtonMouseClicked
if (raceMode == false) {
// start the race
raceTrack.initCarState();
myCar = new Slotcar(raceTrack);
myCar.setDriveCar(true);
myCar.setThrottleValue((float) ThrottleSlider.getValue() / (float) ThrottleSlider.getMaximum());
myCar.setDrawCircle(drawCurve.isSelected());
trackDisplay.setCar(myCar);
// Start car controller
// controller = new Thread(myCar);
// controller.start();
fps = new FPSAnimator(trackDisplay,60);
fps.start();
raceMode = true;
// Change button text
GoButton.setText("Stop");
}
else {
// Stop controller and animation
myCar.setDriveCar(false);
fps.stop();
GoButton.setText("Go!");
raceMode = false;
}
}
示例15: init
import com.jogamp.opengl.util.FPSAnimator; //導入方法依賴的package包/類
@Override
public void init( GLAutoDrawable drawable ) {
// drawable.setGL(new DebugGL(drawable.getGL()));
drawable.setAutoSwapBufferMode(true);
final GL2 gl = drawable.getGL().getGL2();
// log.info("OpenGL implementation is: " + gl.getClass().getName() + "\nGL_VENDOR: "
// + gl.glGetString(GL.GL_VENDOR) + "\nGL_RENDERER: " + gl.glGetString(GL.GL_RENDERER) + "\nGL_VERSION: "
// + gl.glGetString(GL.GL_VERSION) // + "\nGL_EXTENSIONS: " + gl.glGetString(GL.GL_EXTENSIONS)
// );
final float glVersion = Float.parseFloat(gl.glGetString(GL.GL_VERSION).substring(0, 3));
if (glVersion < 1.3f) {
// log.warning("\n\n*******************\nOpenGL version "
// + glVersion
// + " < 1.3, some features may not work and program may crash\nTry switching from 16 to 32 bit color if you have decent graphics card\n\n");
}
// System.out.println("GLU_EXTENSIONS: "+glu.gluGetString(GLU.GLU_EXTENSIONS));
gl.setSwapInterval(1);
gl.glShadeModel(GLLightingFunc.GL_FLAT);
gl.glClearColor(0, 0, 0, 0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glLoadIdentity();
gl.glRasterPos3f(0, 0, 0);
gl.glColor3f(1, 1, 1);
// glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "Initialized display");
// Start animator (which should be a field).
animator = new FPSAnimator(glcanvas, 60);
animator.start();
}