本文整理汇总了Java中org.eclipse.swt.opengl.GLData类的典型用法代码示例。如果您正苦于以下问题:Java GLData类的具体用法?Java GLData怎么用?Java GLData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLData类属于org.eclipse.swt.opengl包,在下文中一共展示了GLData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPartControl
import org.eclipse.swt.opengl.GLData; //导入依赖的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);
}
示例2: CuinaGLCanvas
import org.eclipse.swt.opengl.GLData; //导入依赖的package包/类
public CuinaGLCanvas(Composite parent, int style, GLData data, Runnable painter)
{
super(parent, SWT.NO_BACKGROUND | style, data);
this.painter = painter;
this.addFocusListener(this);
// this.addListener(SWT.MouseDown, this);
// this.addListener(SWT.MouseUp, this);
// this.addListener(SWT.MouseExit, this);
// this.addListener(SWT.MouseMove, this);
// this.addListener(SWT.MouseEnter, this);
// //XXX: Teste Drag-Support. Bisher ohne Erfolg. Keins der Events wird getriggert.
// this.addListener(DND.DragEnter, this);
// this.addListener(DND.DragLeave, this);
// this.addListener(DND.DragEnd, this);
// this.addListener(DND.DragOver, this);
// this.addListener(DND.DragStart, this);
// this.addListener(SWT.DragDetect, this);
}
示例3: SWTGraphics
import org.eclipse.swt.opengl.GLData; //导入依赖的package包/类
public SWTGraphics (SWTPlatform splat, final Composite comp) {
super(splat);
this.plat = splat;
boolean isMac = "Mac OS X".equals(System.getProperty("os.name"));
final Hack hack = isMac ? new SWTMacHack() : new Hack();
// special scale fiddling on Mac
scaleChanged(hack.hackScale());
// create our GLCanvas
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(comp, SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE, data);
hack.hackCanvas(canvas);
canvas.setCurrent();
GL.createCapabilities();
comp.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
// resize our GLCanvas to fill the window; we do manual layout so that other SWT widgets
// can be overlaid on top of our GLCanvas
Rectangle bounds = comp.getBounds();
comp.setBounds(bounds);
canvas.setBounds(bounds);
canvas.setCurrent();
hack.convertToBacking(canvas, bounds);
viewportChanged(bounds.width, bounds.height);
}
});
plat.log().info("Setting size " + plat.config.width + "x" + plat.config.height);
setSize(plat.config.width, plat.config.height, plat.config.fullscreen);
}
示例4: GLPanel
import org.eclipse.swt.opengl.GLData; //导入依赖的package包/类
public GLPanel(Composite parent, int swtStyle, int glStyle)
{
if ((glStyle & LWJGL.ENABLE_3D) != 0) use3D = true;
if (use3D) System.err.println("3D wird (noch) nicht unterstützt!");
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new CuinaGLCanvas(parent, swtStyle, data, getPainter());
canvas.setDragDetect(true);
parent.layout();
init();
}
示例5: main
import org.eclipse.swt.opengl.GLData; //导入依赖的package包/类
public static void main(String [] args) {
GLProfile.initSingleton( );
GLProfile glprofile = GLProfile.get( GLProfile.GL2 );
Display display = new Display();
Shell shell = new Shell( display );
shell.setLayout( new FillLayout() );
Composite composite = new Composite( shell, SWT.NONE );
composite.setLayout( new FillLayout() );
GLData gldata = new GLData();
gldata.doubleBuffer = true;
// need SWT.NO_BACKGROUND to prevent SWT from clearing the window
// at the wrong times (we use glClear for this instead)
final GLCanvas glcanvas = new GLCanvas( composite, SWT.NO_BACKGROUND, gldata );
glcanvas.setCurrent();
final GLContext glcontext = GLDrawableFactory.getFactory( glprofile ).createExternalGLContext();
// fix the viewport when the user resizes the window
glcanvas.addListener( SWT.Resize, new Listener() {
public void handleEvent(Event event) {
setup( glcanvas, glcontext );
}
});
// draw the triangle when the OS tells us that any part of the window needs drawing
glcanvas.addPaintListener( new PaintListener() {
public void paintControl( PaintEvent paintevent ) {
render( glcanvas, glcontext );
}
});
shell.setText( "OneTriangle" );
shell.setSize( 640, 480 );
shell.open();
while( !shell.isDisposed() ) {
if( !display.readAndDispatch() )
display.sleep();
}
glcanvas.dispose();
display.dispose();
}
示例6: main
import org.eclipse.swt.opengl.GLData; //导入依赖的package包/类
public static void main( String [] args ) {
Display display = new Display();
final Shell shell = new Shell( display );
shell.setText( "OneTriangle SWT" );
shell.setLayout( new FillLayout() );
shell.setSize( 640, 480 );
final Composite composite = new Composite( shell, SWT.NONE );
composite.setLayout( new FillLayout() );
// canvas
javax.media.opengl.GLProfile glprofile = GLProfile.getDefault();
org.eclipse.swt.opengl.GLData gldata = new GLData();
final GLCanvas glcanvas = new GLCanvas( composite, SWT.NO_BACKGROUND, gldata );
// OpenGL context
javax.media.opengl.GLContext glContext = GLDrawableFactory.getFactory(glprofile).
createExternalGLContext();
//GLData gldata = new GLData();
//gldata.doubleBuffer = true;
// need SWT.NO_BACKGROUND to prevent SWT from clearing the window
// at the wrong times (we use glClear for this instead)
//glcanvas.setCurrent();
//GLProfile glprofile = GLProfile.getDefault();
// final GLContext glcontext = GLDrawableFactory.getFactory( glprofile ).createExternalGLContext();
//
// // fix the viewport when the user resizes the window
// glcanvas.addListener( SWT.Resize, new Listener() {
// public void handleEvent(Event event) {
// Rectangle rectangle = glcanvas.getClientArea();
// glcanvas.setCurrent();
// glcontext.makeCurrent();
// OneTriangle.setup( glcontext.getGL().getGL2(), rectangle.width, rectangle.height );
// glcontext.release();
// }
// });
//
// // draw the triangle when the OS tells us that any part of the window needs drawing
// glcanvas.addPaintListener( new PaintListener() {
// public void paintControl( PaintEvent paintevent ) {
// Rectangle rectangle = glcanvas.getClientArea();
// glcanvas.setCurrent();
// glcontext.makeCurrent();
// OneTriangle.render(glcontext.getGL().getGL2(), rectangle.width, rectangle.height);
// glcanvas.swapBuffers();
// glcontext.release();
// }
// });
shell.open();
while( !shell.isDisposed() ) {
if( !display.readAndDispatch() )
display.sleep();
}
//glcanvas.dispose();
display.dispose();
}