本文整理汇总了Java中javax.media.opengl.GLProfile类的典型用法代码示例。如果您正苦于以下问题:Java GLProfile类的具体用法?Java GLProfile怎么用?Java GLProfile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GLProfile类属于javax.media.opengl包,在下文中一共展示了GLProfile类的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: TileManager
import javax.media.opengl.GLProfile; //导入依赖的package包/类
/**
* Initializes a tile-manager using a persistent cache.
*
* @param glProfile
* The OpenGL-Profile to use.
*/
public TileManager(GLProfile glProfile) {
super(MANAGER_LABEL, false, false);
this.cache = new TileCache(this, glProfile);
/*
* A loader must be created for performing queries for tiles. Also it
* will use a TileCache as a on-disk-cache.
*/
loader = new Loader<TileQuery, TileResource>(this.cache,
new TileWorkerFactory(glProfile), this);
loader.addListener(this); // Listen for new data available
loader.start();
loadStylesFromXML(); // Read the available styles from file
}
示例3: getOpenGLProblems
import javax.media.opengl.GLProfile; //导入依赖的package包/类
public static String getOpenGLProblems()
{
GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setDepthBits(24);
caps.setDoubleBuffered(true);
GLCanvas canvas = new GLCanvas(caps);
OpenGLTestCapabilities testClass = new OpenGLTestCapabilities();
canvas.addGLEventListener(testClass);
return testClass.messages.toString();
}
示例4: testOpenGL
import javax.media.opengl.GLProfile; //导入依赖的package包/类
private static boolean testOpenGL()
{
GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
caps.setAlphaBits(8);
caps.setRedBits(8);
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setDepthBits(24);
caps.setDoubleBuffered(true);
GLCanvas canvas = new GLCanvas(caps);
OpenGLTestCapabilities testClass = new OpenGLTestCapabilities();
canvas.addGLEventListener(testClass);
testedPreviously = true;
previouslyTestedAsOpenGLCapable = !testClass.fail;
return !testClass.fail;
}
示例5: initUI
import javax.media.opengl.GLProfile; //导入依赖的package包/类
private void initUI() {
this.width = 600;
this.height = 400;
GLCapabilities config = new GLCapabilities(GLProfile.get(GLProfile.GL2));
config.setSampleBuffers(true);
config.setNumSamples(4);
GLCanvas canvas = new GLCanvas(config);
canvas.addGLEventListener(this);
usi.init(canvas);
JFrame frame = new JFrame("JOGL-JOCL Interoperability Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(canvas);
frame.setSize(width, height);
frame.setVisible(true);
}
示例6: 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();
}
示例7: Scene
import javax.media.opengl.GLProfile; //导入依赖的package包/类
public Scene(String title, Renderer renderer) {
this.renderer = renderer;
try {
this.display = NewtFactory.createDisplay(null);
this.window = GLWindow.create(new GLCapabilities(GLProfile.get(GLProfile.GL2)));
this.window.setPosition(0, 0);
this.window.setSize(window.getScreen().getWidth(), window.getScreen().getHeight());
this.window.addWindowListener(new WindowHandler(resize, stop));
this.window.addMouseListener(new MouseHandler(this.window, renderer));
this.window.setTitle(title);
this.window.setVisible(true);
} catch (Throwable t) {
dispose();
Throw.unchecked(t);
}
}
示例8: 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);
}
示例9: checkMinimumSpec
import javax.media.opengl.GLProfile; //导入依赖的package包/类
private static void checkMinimumSpec(){
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {}
if(!GLProfile.isAvailable(GLProfile.GL4)){
final JPanel pane = new JPanel(new GridLayout(-1, 1));
pane.add(new JLabel("Your graphic card does not support OpenGL 4, try updating your driver."));
pane.add(new JLabel(""));
pane.add(new JLabel("Minimum graphic card"));
pane.add(new JLabel("- Nvidia GeForce 400 series"));
pane.add(new JLabel("- AMD Radeon 5000 series"));
JOptionPane.showMessageDialog(null, pane, "Minimum spec error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
}
示例10: 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);
}
示例11: 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);
}
示例12: MainWindow
import javax.media.opengl.GLProfile; //导入依赖的package包/类
public MainWindow(CSpaceViewer viewer) {
GLProfile glp = GLProfile.get(GLProfile.GL2);
GLCapabilities glc = new GLCapabilities(glp);
glc.setSampleBuffers(true);
glc.setNumSamples(8);
glc.setDepthBits(32);
canvas = new GLCanvas(glc);
animator = new FPSAnimator(canvas, 60);
toolBar = new MainToolBar(viewer);
setTitle("Configuration Space Visualization");
setLayout(new BorderLayout());
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1280, 720);
setLocationRelativeTo(null);
getContentPane().add(toolBar, BorderLayout.SOUTH);
getContentPane().add(canvas, BorderLayout.CENTER);
canvas.addGLEventListener(emptyScene);
animator.start();
}
示例13: 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>();
}
示例14: 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);
}
示例15: 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);
}