本文整理汇总了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);
}
开发者ID:vobject,项目名称:maru,代码行数:27,代码来源:GLMapView.java
示例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);
}
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:20,代码来源:GLPanel.java
示例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);
}
开发者ID:playn,项目名称:playn,代码行数:35,代码来源:SWTGraphics.java
示例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();
}
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:15,代码来源:GLPanel.java
示例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();
}
开发者ID:momega,项目名称:spacesimulator,代码行数:46,代码来源:Main.java
示例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();
}
开发者ID:momega,项目名称:spacesimulator,代码行数:62,代码来源:OneTriangleSWT.java
注:本文中的org.eclipse.swt.opengl.GLData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论