本文整理汇总了Java中com.jogamp.newt.awt.NewtCanvasAWT类的典型用法代码示例。如果您正苦于以下问题:Java NewtCanvasAWT类的具体用法?Java NewtCanvasAWT怎么用?Java NewtCanvasAWT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NewtCanvasAWT类属于com.jogamp.newt.awt包,在下文中一共展示了NewtCanvasAWT类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VisualizationPanel
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
/**
* Constructs a new visualization-panel using the specified configuration.
*
* @param visualization the visualization to be displayed.
* @param config the configuration for the visualization-panel to be created.
*/
public VisualizationPanel(Visualization visualization, VisualizerConfig config) {
this.visualization = visualization;
window = GLWindow.create(config.glcapabilities);
window.addGLEventListener(visualization.getRenderContext());
window.addMouseListener(visualization.getMouseListener());
window.addKeyListener(visualization.getKeyController());
animator = new FPSAnimator(window, config.fps, true);
visualization.getRenderContext().setAnimator(animator);
canvas = new NewtCanvasAWT(window);
this.setLayout(new BorderLayout());
this.add(canvas, BorderLayout.CENTER);
}
示例2: RenderWindow
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
RenderWindow(int x, int y, int width, int height, String title, String name,
GLContext sharedContext,
GLCapabilitiesImmutable caps,
GLEventListener glListener, Image icon, int windowID, int viewID,
WindowInteractionListener appListener) {
_window = GLWindow.create(caps);
_window.addGLEventListener(glListener);
_window.setSharedContext(sharedContext);
_awtFrame = new Frame(title);
NewtCanvasAWT canvas = new NewtCanvasAWT(_window);
_awtFrame.add(canvas);
_awtFrame.setBounds(x, y, width, height);
if (icon != null) {
_awtFrame.setIconImage(icon);
}
_appListener = appListener;
_windowID = windowID;
_viewID = viewID;
_name = name;
}
示例3: prepareGui
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
public static JFrame prepareGui() {
mainFrame = createMainFrame();
menuBar = new MenuBar();
mainFrame.setJMenuBar(menuBar);
Camera camera = Displayer.getCamera();
panInteraction = new InteractionPan(camera);
rotationInteraction = new InteractionRotate(camera);
axisInteraction = new InteractionAxis(camera);
annotateInteraction = new InteractionAnnotate(camera);
currentInteraction = rotationInteraction;
leftPane = new SideContentPane();
leftPane.add("Movie Controls", MoviePanel.getInstance(), true);
MoviePanel.setAdvanced(false);
// Layer control
layers = new Layers();
layersPanel = new LayersPanel(layers);
leftPane.add("Image Layers", layersPanel, true);
leftScrollPane = new JScrollPane(leftPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
leftScrollPane.setFocusable(false);
leftScrollPane.setBorder(null);
leftScrollPane.getVerticalScrollBar().setUnitIncrement(layersPanel.getGridRowHeight());
glWindow = GLHelper.createGLWindow();
glWindow.setTitle(mainFrame.getTitle());
glListener = new GLListener(glWindow);
glWindow.addGLEventListener(glListener);
inputController = new InputController();
glWindow.addMouseListener(new NEWTMouseAdapter(inputController));
glWindow.addKeyListener(new NEWTKeyAdapter(inputController));
glComponent = new NewtCanvasAWT(glWindow);
mainContentPanel = new MainContentPanel(glComponent);
JSplitPane midSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
midSplitPane.setDividerSize(2);
midSplitPane.setBorder(null);
midSplitPane.setLeftComponent(leftScrollPane);
midSplitPane.setRightComponent(mainContentPanel);
// STATUS PANEL
zoomStatus = new ZoomStatusPanel();
carringtonStatus = new CarringtonStatusPanel();
framerateStatus = new FramerateStatusPanel();
PositionStatusPanel positionStatus = new PositionStatusPanel();
inputController.addPlugin(positionStatus);
StatusPanel statusPanel = new StatusPanel(leftScrollPane.getPreferredSize().width, 5);
statusPanel.addPlugin(zoomStatus, StatusPanel.Alignment.LEFT);
statusPanel.addPlugin(carringtonStatus, StatusPanel.Alignment.LEFT);
statusPanel.addPlugin(framerateStatus, StatusPanel.Alignment.LEFT);
statusPanel.addPlugin(positionStatus, StatusPanel.Alignment.RIGHT);
toolBar = new TopToolBar();
mainFrame.add(toolBar, BorderLayout.PAGE_START);
mainFrame.add(midSplitPane, BorderLayout.CENTER);
mainFrame.add(statusPanel, BorderLayout.PAGE_END);
return mainFrame;
}
示例4: getGLComponent
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
public static NewtCanvasAWT getGLComponent() {
return glComponent;
}
示例5: demoRendererInJFrame
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
@Test
public void demoRendererInJFrame() throws InterruptedException,
IOException
{
final ClearVolumeRendererInterface lClearVolumeRenderer =
ClearVolumeRendererFactory.newBestRenderer( "ClearVolumeTest",
512,
512,
NativeTypeEnum.UnsignedByte,
512,
512,
1,
true);
final NewtCanvasAWT lNewtCanvasAWT = lClearVolumeRenderer.getNewtCanvasAWT();
final JFrame lJFrame = new JFrame("ClearVolume");
lJFrame.setLayout(new BorderLayout());
final Container lContainer = new Container();
lContainer.setLayout(new BorderLayout());
lContainer.add(lNewtCanvasAWT, BorderLayout.CENTER);
lJFrame.setSize(new Dimension(1024, 1024));
lJFrame.add(lContainer);
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
lJFrame.setVisible(true);
}
});
lClearVolumeRenderer.setTransferFunction(TransferFunctions.getDefault());
lClearVolumeRenderer.setVisible(true);
final int lResolutionX = 512;
final int lResolutionY = lResolutionX;
final int lResolutionZ = lResolutionX;
final byte[] lVolumeDataArray =
new byte[lResolutionX * lResolutionY
* lResolutionZ];
for (int z = 0; z < lResolutionZ; z++)
for (int y = 0; y < lResolutionY; y++)
for (int x = 0; x < lResolutionX; x++)
{
final int lIndex = x + lResolutionX * y
+ lResolutionX * lResolutionY * z;
int lCharValue = (((byte) x ^ (byte) y ^ (byte) z));
if (lCharValue < 12)
lCharValue = 0;
lVolumeDataArray[lIndex] = (byte) lCharValue;
}
lClearVolumeRenderer.setVolumeDataBuffer( 0,
ByteBuffer.wrap(lVolumeDataArray),
lResolutionX,
lResolutionY,
lResolutionZ);
lClearVolumeRenderer.requestDisplay();
while (lClearVolumeRenderer.isShowing() && lJFrame.isVisible())
{
Thread.sleep(100);
lJFrame.setTitle("BRAVO! THIS IS A JFRAME! It WORKS!");
}
lClearVolumeRenderer.close();
lJFrame.dispose();
}
示例6: getNewtCanvasAWT
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
/**
* @return the mNewtCanvasAWT
*/
@Override
public NewtCanvasAWT getNewtCanvasAWT()
{
return mNewtCanvasAWT;
}
示例7: initGL
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
private void initGL() {
GLProfile gLProfile = GLProfile.getDefault();
GLCapabilities gLCapabilities = new GLCapabilities(gLProfile);
glWindow = GLWindow.create(gLCapabilities);
newtCanvasAWT = new NewtCanvasAWT(glWindow);
glWindow.setSize(imageWidth, imageHeight);
glWindow.addGLEventListener(this);
Animator animator = new Animator(glWindow);
animator.setRunAsFastAsPossible(true);
animator.start();
}
示例8: getNewtCanvasAWT
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
public NewtCanvasAWT getNewtCanvasAWT() {
return newtCanvasAWT;
}
示例9: initGL
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
private void initGL() {
GLProfile gLProfile = GLProfile.getDefault();
GLCapabilities gLCapabilities = new GLCapabilities(gLProfile);
glWindow = GLWindow.create(gLCapabilities);
newtCanvasAWT = new NewtCanvasAWT(glWindow);
glWindow.setSize(imageWidth, imageHeight);
glWindow.addGLEventListener(this);
animator = new Animator(glWindow);
animator.setRunAsFastAsPossible(true);
animator.start();
Vec3 cameraPos = new Vec3(0f, 0f, -3f);
Quat quat = new Quat(0f, 0f, 0f, 1f);
viewPole = new ViewPole(new ViewData(cameraPos, quat, 10f), new ViewScale(90f/250f, 0.2f));
}
示例10: initGL
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
private void initGL() {
GLProfile gLProfile = GLProfile.getDefault();
GLCapabilities gLCapabilities = new GLCapabilities(gLProfile);
glWindow = GLWindow.create(gLCapabilities);
newtCanvasAWT = new NewtCanvasAWT(glWindow);
glWindow.setSize(imageWidth, imageHeight);
glWindow.addGLEventListener(this);
glWindow.addMouseListener(viewPole);
glWindow.addKeyListener(new KeyListener());
animator = new Animator(glWindow);
animator.start();
}
示例11: initGL
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
private void initGL() {
GLProfile gLProfile = GLProfile.getDefault();
GLCapabilities gLCapabilities = new GLCapabilities(gLProfile);
glWindow = GLWindow.create(gLCapabilities);
newtCanvasAWT = new NewtCanvasAWT(glWindow);
glWindow.setSize(imageWidth, imageHeight);
glWindow.addGLEventListener(this);
animator = new Animator(glWindow);
animator.setRunAsFastAsPossible(true);
animator.start();
}
示例12: getNewtCanvasAWT
import com.jogamp.newt.awt.NewtCanvasAWT; //导入依赖的package包/类
/**
* Returns a Canvas that can be used to embed this renderer.
*
* @return A NewtCanvasAWT object or null if the renderer cannot be embedded.
*/
public NewtCanvasAWT getNewtCanvasAWT();