本文整理汇总了Java中javax.media.opengl.GLProfile.getDefault方法的典型用法代码示例。如果您正苦于以下问题:Java GLProfile.getDefault方法的具体用法?Java GLProfile.getDefault怎么用?Java GLProfile.getDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.opengl.GLProfile
的用法示例。
在下文中一共展示了GLProfile.getDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCaps
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
private GLCapabilities getCaps() {
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
// Anti-aliasing using Multisampling
if (AA_MULTISAMPLING) {
try {
caps.setAlphaBits(ALPHA_BITS);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
caps.setSampleBuffers(true);
caps.setNumSamples(8);
caps.setAccumAlphaBits(ALPHA_BITS);
caps.setAccumBlueBits(ALPHA_BITS);
caps.setAccumGreenBits(ALPHA_BITS);
caps.setAccumRedBits(ALPHA_BITS);
} catch (javax.media.opengl.GLException ex) {
ex.printStackTrace();
}
}
return caps;
}
示例2: main
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
GLProfile.initSingleton();
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
GLCanvas canvas = new GLCanvas(caps);
Frame frame = new Frame("Test Surface rendering in JOGL 2 using nurbs or eval-mesh");
frame.setSize(300, 300);
frame.add(canvas);
frame.setVisible(true);
// by default, an AWT Frame doesn't do anything when you click
// the close button; this bit of code will terminate the program when
// the window is asked to close
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
canvas.addGLEventListener(new SurfaceTest());
FPSAnimator animator = new FPSAnimator(canvas, 5);
//animator.add(canvas);
animator.start();
}
示例3: Map3DFrame
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
public Map3DFrame(float[][] grid, float cellSize) {
super("3D Map Viewer");
// Use this if you use a heavy weight component with swing
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(true);
setSize(1024, 768);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.viewer = new Map3DViewer(Map3DViewer.GLComponentType.GL_AWT, GLProfile.getDefault());
getContentPane().setLayout(new BorderLayout());
getContentPane().add(this.viewer.getComponent(), BorderLayout.CENTER);
setVisible(true);
setBackgroundColor(0xff, 0xff, 0xff);
enableLight(true);
setModel(grid, cellSize);
}
示例4: setup
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
/**
* Create the GLCanvas and set properties for the graphics device
* initialization, such as bits per channel. And advanced features for
* improved rendering performance such as the stencil buffer.
*/
private void setup() {
GLProfile glp = GLProfile.getDefault();
// Specifies a set of OpenGL capabilities, based on your profile.
GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
// create the canvas for drawing
canvas = new GLCanvas(caps);
// create the render thread
anim = new Animator();
// add the canvas to the main window
add(canvas, BorderLayout.CENTER);
// need this to receive callbacks for rendering (i.e. display() method)
canvas.addGLEventListener(this);
}
示例5: createPartControl
import javax.media.opengl.GLProfile; //导入方法依赖的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);
}
示例6: internalSetup
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
protected void internalSetup()
{
//Initialize the OpenGL profile that the game will use
glProfile = GLProfile.getDefault();
glCapabilities = new GLCapabilities(glProfile);
//Create the game window
gameWindow = GLWindow.create(glCapabilities);
gameWindow.setSize(320, 320);
gameWindow.setVisible(true);
gameWindow.setTitle("GrIGE");
//Create the various managers for the game
camera = new Camera(gameWindow.getWidth(),gameWindow.getHeight(),10000);
//Add the required event listeners
gameWindow.addWindowListener(this);
gameWindow.addGLEventListener(this);
//Instantiate other structures
worldObjects = new ArrayList<GameObject>();
worldLights = new ArrayList<Light>();
}
示例7: init
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
public void init(GLAutoDrawable drawable) {
GLProfile glProfile = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glProfile);
caps.setHardwareAccelerated(true);
caps.setDoubleBuffered(true);
GL2 gl = drawable.getGL().getGL2();
System.err.println("INIT GL IS: " + gl.getClass().getName());
gl.glClearColor(0.250f, 0.250f, 0.250f, 0.0f);
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glEnable(GL2.GL_DEPTH_TEST);
gl.glEnable(GL2.GL_CULL_FACE);
gl.glCullFace(GL2.GL_BACK);
gl.glPolygonMode(GL2.GL_FRONT, GL2.GL_FILL);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL2.GL_BLEND);
// gl.glDisable(gl.GL_COLOR_MATERIAL);
camera = new Camera(0, 2, 5, 0, 2.5f, 0, 0, 1, 0);
}
示例8: TestFrameComponent
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
public TestFrameComponent() {
super("test");
/*
* display mode (single buffer and RGBA)
*/
GLProfile prof=GLProfile.getDefault();
caps = new GLCapabilities(prof);
caps.setDoubleBuffered(false);
System.out.println(caps.toString());
canvas = new GLCanvas(caps);
canvas.addGLEventListener(this);
//
getContentPane().add(canvas);
}
示例9: isOpenGLAvailable
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
/**
* Check current graphic card/drivers OpenGL capabilities to see if they match those required by WorldWind to work
* @return true if we are good, false otherwise
*/
public boolean isOpenGLAvailable() {
if (_openGlAvailable == null) {
synchronized (this) {
if (_openGlAvailable == null) {
try {
// create an offscreen context with the current graphic device
final GLProfile glProfile = GLProfile.getDefault(GLProfile.getDefaultDevice());
final GLCapabilities caps = new GLCapabilities(glProfile);
caps.setOnscreen(false);
caps.setPBuffer(false);
final GLDrawable offscreenDrawable = GLDrawableFactory.getFactory(glProfile).createOffscreenDrawable(null, caps,
new DefaultGLCapabilitiesChooser(), 1, 1);
offscreenDrawable.setRealized(true);
final GLContext context = offscreenDrawable.createContext(null);
final int additionalCtxCreationFlags = 0;
context.setContextCreationFlags(additionalCtxCreationFlags);
context.makeCurrent();
final GL gl = context.getGL();
// WWJ will need those to render the globe
_openGlAvailable = gl.isExtensionAvailable(GLExtensions.EXT_texture_compression_s3tc)
|| gl.isExtensionAvailable(GLExtensions.NV_texture_compression_vtc);
} catch (final Throwable e) {
_openGlAvailable = false;
}
}
}
}
return _openGlAvailable;
}
示例10: processNewResult
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
@Override
public void processNewResult(ResultHierarchy baseResult, Result newResult) {
Database db = ResultUtil.findDatabase(baseResult);
if(db == null) {
return;
}
// Build OpenGL data loader:
ScatterData data = null;
for(Relation<?> rel : db.getRelations()) {
if(data == null) {
data = new ScatterData(rel.getDBIDs());
}
data.addRelation(rel);
}
if(data == null) {
return;
}
final JFrame jframe = new JFrame("OpenGL Scatterplot");
jframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
final ScatterPlot3DVisualization plot = new ScatterPlot3DVisualization(data);
GLCanvas glcanvas = new GLCanvas(new GLCapabilities(GLProfile.getDefault()));
glcanvas.addGLEventListener(plot);
jframe.getContentPane().add(glcanvas, BorderLayout.CENTER);
jframe.setSize(640, 480);
jframe.setVisible(true);
plot.start(glcanvas);
}
示例11: JoglPanel
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
public JoglPanel(final TestbedModel model, final TestbedController controller) {
super(new GLCapabilities(GLProfile.getDefault()));
this.controller = controller;
setSize(600, 600);
setPreferredSize(new Dimension(600, 600));
setAutoSwapBufferMode(true);
addGLEventListener(this);
AWTPanelHelper.addHelpAndPanelListeners(this, model, controller, SCREEN_DRAG_BUTTON);
}
示例12: createJ3dComponent
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
@Override
public Component createJ3dComponent( String name )
{
GLProfile glprofile = GLProfile .getDefault();
GLCapabilities glcapabilities = new GLCapabilities( glprofile );
final GLCanvas glcanvas = new GLCanvas( glcapabilities );
return glcanvas;
}
示例13: Window
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
/**
*
* @todo Write documentation
* @param game
* @since 0.1
*/
public Window(Game game)
{
this.game = game;
mouse = new Mouse();
setSize(600, 400);
capabilities = new GLCapabilities(GLProfile.getDefault());
canvas = new GLCanvas(capabilities);
add(canvas);
canvas.addMouseListener(mouse);
canvas.addGLEventListener(this);
addWindowListener(this);
addMouseListener(mouse);
}
示例14: MainWindow
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
public MainWindow() throws IOException {
initRecentDocumentsMenu(this);
initComponents();
initMenus();
// setup 3D map
this.map3DViewer = new Map3DViewer(Map3DViewer.GLComponentType.GL_AWT, GLProfile.getDefault());
this.map3DViewer.setDefaultCamera(75, 0, Map3DViewer.MAX_DISTANCE, 50, 0, 0);
this.map3DViewer.resetToDefaultCamera();
// setup GUI controls of 3D map
/*this.map3DOptionsPanel.setCameraVisible(Map3DViewer.Camera.orthogonal, true);
this.map3DOptionsPanel.setCameraVisible(Map3DViewer.Camera.parallelOblique, true);
this.map3DOptionsPanel.setCameraVisible(Map3DViewer.Camera.planOblique, true);
this.map3DOptionsPanel.setCameraVisible(Map3DViewer.Camera.cylindrical, true);
*/
//this.map3DOptionsPanel.setAntialiasingPanelVisible(false);
// add 3D map to GUI
Component map3DComponent = map3DViewer.getComponent();
map3DComponent.setPreferredSize(new Dimension(400, 400));
this.container3D.add(map3DComponent, BorderLayout.CENTER);
map3DComponent.addPropertyChangeListener(this);
this.map3DOptionsPanel.setMap3DViewer(this.map3DViewer);
this.map3DOptionsPanel.addPanel("Level of Detail", lodPanel);
this.map3DOptionsPanel.setCameraVisible(Map3DViewer.Camera.cylindrical, true);
// pack the window (= bring it to its smallest possible size)
// and store this minimum size
pack();
packedSize = getSize();
// register this as a ComponentListener to get resize events.
// the resize-event-handler makes sure the window is not gettting too small.
this.addComponentListener(this);
}
示例15: CreateCapabilities
import javax.media.opengl.GLProfile; //导入方法依赖的package包/类
private static GLCapabilitiesImmutable CreateCapabilities() {
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
//caps.setSampleBuffers (true);
//caps.setNumSamples (2);
return caps;
}