本文整理汇总了Java中javax.media.opengl.awt.GLCanvas.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java GLCanvas.setSize方法的具体用法?Java GLCanvas.setSize怎么用?Java GLCanvas.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.opengl.awt.GLCanvas
的用法示例。
在下文中一共展示了GLCanvas.setSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUI_90_OpenGL
import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
private void createUI_90_OpenGL(final Composite parent) {
_glCanvas = new GLCanvas(_glCaps);
_glCanvas.addGLEventListener(new GLInfo());
_glCanvas.setSize(10, 10);
// set parent griddata, this must be done AFTER the content is created, otherwise it fails !!!
// GridDataFactory.fillDefaults().grab(true, true).applyTo(parent);
// build GUI: container(SWT) -> Frame(AWT) -> Panel(AWT) -> WorldWindowGLCanvas(AWT)
_mapContainer = _tk.createComposite(parent, SWT.EMBEDDED);
GridDataFactory.fillDefaults().hint(10, 20).applyTo(_mapContainer);
{
_awtFrame = SWT_AWT.new_Frame(_mapContainer);
final java.awt.Panel awtPanel = new java.awt.Panel(new java.awt.BorderLayout());
_awtFrame.add(awtPanel);
awtPanel.add(_glCanvas, BorderLayout.CENTER);
}
_mapContainer.setVisible(false);
parent.layout();
}
示例2: Scene
import javax.media.opengl.awt.GLCanvas; //导入方法依赖的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);
}
示例3: init
import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
private void init(final boolean fullScreen,
final GLCapabilitiesImmutable caps, final GLContext shareWith) {
Runnable r = new Runnable() { public void run() {
String wasErase = System.setProperty("sun.awt.noerasebackground", "true");
canvas = new GLCanvas(caps, shareWith);
((GLCanvas)canvas).addGLEventListener(eventListener);
if (fullScreen) {
canvas.setSize(getSize());
needInitialResize = false;
} else {
canvas.setSize(1, 1); // or we do not get a GLContext
needInitialResize = true;
}
getContentPane().add(canvas);
canvas.setVisible(true);
if (wasErase != null) {
System.setProperty("sun.awt.noerasebackground", wasErase);
} else {
System.clearProperty("sun.awt.noerasebackground");
}
}};
if (EventQueue.isDispatchThread()) {
r.run();
} else {
try {
EventQueue.invokeAndWait(r);
} catch (java.lang.Exception ex) { }
}
}
示例4: initGLCanvas
import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
protected void initGLCanvas() {
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
caps.setStencilBits(settings.getStencilBits());
caps.setDepthBits(settings.getDepthBits());
if (settings.getSamples() > 1) {
caps.setSampleBuffers(true);
caps.setNumSamples(settings.getSamples());
}
canvas = new GLCanvas(caps) {
@Override
public void addNotify() {
super.addNotify();
onCanvasAdded();
}
@Override
public void removeNotify() {
onCanvasRemoved();
super.removeNotify();
}
};
// TODO: add a check on the settings
// set the size of the canvas as early as possible to avoid further useless reshape attempts
canvas.setSize(settings.getWidth(), settings.getHeight());
if (settings.isVSync()) {
GLContext.getCurrentGL().setSwapInterval(1);
}
canvas.setFocusable(true);
canvas.setIgnoreRepaint(true);
canvas.addGLEventListener(this);
// N.B: it is too early to get the GL instance from the canvas
// if (false){
// trace mode
// jME already uses err stream, use out instead
// gl = new TraceGL(gl, System.out);
// }else if (false){
// debug mode
// gl = new DebugGL(gl);
// }else{
// production mode
// }
renderer = new JoglRenderer();
}