本文整理匯總了Java中javax.media.opengl.GLEventListener類的典型用法代碼示例。如果您正苦於以下問題:Java GLEventListener類的具體用法?Java GLEventListener怎麽用?Java GLEventListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GLEventListener類屬於javax.media.opengl包,在下文中一共展示了GLEventListener類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: savePicture
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
private void savePicture(String path, Component tc, GLEventListener canvas, int width, int height) {
>>>>>>> refs/remotes/origin/development
if (path.contains(".png")) {
} else {
path = path + ".png";
}
<<<<<<< HEAD
int i = gl.glGetError();
=======
if(filePath == null){
//selection of folder wasn't approved, nothing happens
return;
}
>>>>>>> 7ce8ff9f35e26af83f0400dac86de86a7720aa2f
savePicture(filePath, tc, canvas, width, height);
}
示例2: setCanvasProvider
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
protected void setCanvasProvider(CanvasProvider canvasProvider) {
final GLCanvas oldCanvas = getCanvas();
final GLEventListener glEventListener = getGlEventListener();
if(oldCanvas != null)
oldCanvas.removeGLEventListener(glEventListener);
this.canvasProvider = canvasProvider;
if(canvasProvider != null){
final GLCanvas canvas = canvasProvider.getCanvas();
final GL gl = canvas.getGL();
final Class<? extends GL> desiredClass = getGLClass();
if(! desiredClass.isAssignableFrom(gl.getClass())){
throw new IllegalArgumentException(
"CanvasProvider gives a "+gl.getClass().getName()+
" but expected a GL instance of type "+desiredClass.getName());}
canvas.addGLEventListener(glEventListener);
}
}
示例3: exportVisualResults
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
/**
* Exports visual results to disk. Creates snapshot of given canvas
* @param tc - GUI component which opens the dialog (usually active project)
* @param canvas - canvas containing results to be saved
* @param width - max width of the picture
* @param height - max height of the picture
*/
public void exportVisualResults(Component tc, GLEventListener canvas, int width, int height){
String filePath = DialogUtils.instance().openDialogueSaveFile(tc, "PNG images", FILE_EXTENSIONS_PIC, false);
<<<<<<< HEAD
if (filePath == null) {
//selection of folder wasn't approved, nothing happens
return;
}
savePicture(filePath, tc, canvas, width, height);
<<<<<<< HEAD
}
示例4: init
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
private void init(){
this.wd.initDrawable(this);
this.setView(new BasicView());
this.setInputHandler(new AWTInputHandler());
this.addGLEventListener((GLEventListener) wd);
this.setMinimumSize(new Dimension());
}
示例5: NeonNewtWindow
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
/**
* Constructor for this class. Sets up the window and enables common
* features like anti-aliasing and hardware acceleration.
*
* @param forceGL2ES2
* Force GL2ES2 support (default on), currently Unused
* @param inputHandler
* A predefined InputHandler that is added as event handler for
* input events.
* @param glEventListener
* A predefined GLEventListener that is added as event handler
* for openGL events.
* @param width
* The initial window width.
* @param height
* The initial window height.
* @param windowTitle
* The window title.
*/
public NeonNewtWindow(boolean forceGL2ES2, InputHandler inputHandler, final GLEventListener glEventListener,
int width, int height, String windowTitle) {
GLProfile.initSingleton();
final GLProfile glp;
glp = GLProfile.get(GLProfile.GL3);
// Set up the GL context
final GLCapabilities caps = new GLCapabilities(glp);
caps.setBackgroundOpaque(true);
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
// Add Anti-Aliasing
caps.setSampleBuffers(true);
caps.setAlphaBits(4);
caps.setNumSamples(4);
GLWindow window = GLWindow.create(caps);
window.addGLEventListener(glEventListener);
window.addWindowListener(new QuitListener());
window.setAutoSwapBufferMode(true);
window.setSize(width, height);
window.setTitle(windowTitle);
window.addMouseListener(inputHandler);
window.addKeyListener(inputHandler);
Animator animator = new Animator();
animator.add(window);
animator.start();
animator.setUpdateFPSFrames(60, null);
window.setVisible(true);
}
示例6: getGlEventListener
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
protected GLEventListener getGlEventListener() {
if(glEventListener == null)
glEventListener = new DefaultGLEventListener();
return glEventListener;
}
示例7: setGlEventListener
import javax.media.opengl.GLEventListener; //導入依賴的package包/類
protected void setGlEventListener(GLEventListener glEventListener) {
this.glEventListener = glEventListener;
}