本文整理汇总了Java中com.jogamp.opengl.awt.GLCanvas类的典型用法代码示例。如果您正苦于以下问题:Java GLCanvas类的具体用法?Java GLCanvas怎么用?Java GLCanvas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GLCanvas类属于com.jogamp.opengl.awt包,在下文中一共展示了GLCanvas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startNewWindows
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public void startNewWindows() {
//getting the capabilities object of GL2 profile
final GLProfile profile = GLProfile.get( GLProfile.GL2 );
GLCapabilities capabilities = new GLCapabilities(profile);
// The canvas
final GLCanvas glcanvas = new GLCanvas( capabilities );
triview = new Triangulation3DViewer(chip.getCanvas());
glcanvas.addGLEventListener( triview);
glcanvas.setSize( 800, 800 );
//creating frame
final JFrame frame = new JFrame (" triangulation 3D renderer");
//adding canvas to it
frame.getContentPane().add( glcanvas );
frame.setSize(frame.getContentPane().getPreferredSize() );
frame.setVisible( true );
}
示例2: LabyrinthBallTracker
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public LabyrinthBallTracker(AEChip chip, LabyrinthBallController controller) {
super(chip);
this.controller = controller;
map = new LabyrinthMap(chip);
kalmanFilter = new KalmanEventFilter(chip,controller);
filterChain = new FilterChain(chip);
filterChain.add(map);
filterChain.add(new HoughCircleTracker(chip));
filterChain.add(kalmanFilter);
setEnclosedFilterChain(filterChain);
String s = " Labyrinth Tracker";
if (chip.getCanvas() != null && chip.getCanvas().getCanvas() != null) {
glCanvas = (GLCanvas) chip.getCanvas().getCanvas();
}
setPropertyTooltip("clearMap", "clears the map; use for bare table");
setPropertyTooltip("loadMap", "loads a map from an SVG file");
setPropertyTooltip("controlTilts", "shows a GUI to directly control table tilts with mouse");
setPropertyTooltip("centerTilts", "centers the table tilts");
setPropertyTooltip("disableServos", "disables the servo motors by turning off the PWM control signals; digital servos may not relax however becuase they remember the previous settings");
}
示例3: displayStats
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public void displayStats(GLAutoDrawable drawable) {
if ((drawable == null) || (chip.getCanvas() == null)) {
return;
}
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
int sx = chip.getSizeX(), sy = chip.getSizeY();
Rectangle chipRect = new Rectangle(sx, sy);
GL2 gl = drawable.getGL().getGL2();
if (selection != null && chipRect.intersects(selection)) {
drawSelection(gl, selection, SELECT_COLOR);
}
stats.drawStats(drawable);
stats.play();
}
示例4: XYTypeFilter
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public XYTypeFilter(AEChip chip) {
super(chip);
setPropertyTooltip("invertEnabled", "invert so that events inside region are blocked");
resetFilter();
if ((chip.getCanvas() != null) && (chip.getCanvas().getCanvas() != null)) {
canvas = chip.getCanvas();
glCanvas = (GLCanvas) chip.getCanvas().getCanvas();
}
final String y = "y", x = "x", t = "type";
setPropertyTooltip(y, "YEnabled", "filter based on row");
setPropertyTooltip(y, "endY", "ending row");
setPropertyTooltip(y, "startY", "starting row");
setPropertyTooltip(x, "endX", "ending column");
setPropertyTooltip(x, "XEnabled", "filter based on column");
setPropertyTooltip(x, "startX", "starting column");
setPropertyTooltip(t, "startType", "starting cell type");
setPropertyTooltip(t, "typeEnabled", "filter based on cell type");
setPropertyTooltip(t, "endType", "ending cell type");
setPropertyTooltip("invertEnabled", "invert filtering to pass events outside selection");
setPropertyTooltip("multiSelectionEnabled", "allows defining multiple regions to filter on");
doLoadMultiSelection();
}
示例5: displayStats
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public void displayStats(GLAutoDrawable drawable) {
if ((drawable == null) || (selection == null) || (chip.getCanvas() == null)) {
return;
}
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
int sx = chip.getSizeX(), sy = chip.getSizeY();
Rectangle chipRect = new Rectangle(sx, sy);
GL2 gl = drawable.getGL().getGL2();
if (!chipRect.intersects(selection)) {
return;
}
drawSelection(gl, selection, SELECT_COLOR);
stats.drawStats(drawable);
stats.play();
}
示例6: ApsNoiseStatistics
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public ApsNoiseStatistics(AEChip chip) {
super(chip);
if ((chip.getCanvas() != null) && (chip.getCanvas().getCanvas() != null)) {
canvas = chip.getCanvas();
glCanvas = (GLCanvas) chip.getCanvas().getCanvas();
renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 24), true, true);
}
currentAddress = new int[chip.getNumCellTypes()];
Arrays.fill(currentAddress, -1);
frameExtractor = new ApsFrameExtractor(chip);
FilterChain chain = new FilterChain(chip);
chain.add(frameExtractor);
setEnclosedFilterChain(chain);
chip.addObserver(this);
setPropertyTooltip("scaleHistogramsIncludingOverflow", "Scales histograms to include overflows for ISIs that are outside of range");
setPropertyTooltip("histNumBins", "number of bins in the spatial (FPN) histogram");
setPropertyTooltip("spatialHistogramEnabled", "shows the spatial (FPN) histogram for mouse-selected region");
setPropertyTooltip("temporalNoiseEnabled", "<html>shows the temporal noise (AC RMS) of pixels in mouse-selected region. <br>The AC RMS is computed for each pixel separately and the grand average AC RMS is displayed.<\br>Use left-mouse to drag select a range of pixels.<\br>Use right-mouse to drag a line along temporal noise measurements to estimate conversion gain.");
setPropertyTooltip("resetOnBiasChange", "Resets filter on any PropertyChangeEvent from the chip's configuration");
setPropertyTooltip("adcVref", "Input voltage range of ADC; on DAVIS240 the range is 1.5V with AdcLow=.21, AdcHigh=1.81");
setPropertyTooltip("adcResolutionCounts", "Resolution of ADC in DN (digital number) counts");
setPropertyTooltip("useZeroOriginForTemporalNoise", "Sets origin for temporal noise plot to 0,0 to help see structure more easily");
}
示例7: resizeWindowTo
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
private void resizeWindowTo(int w, int h) {
if(aviOutputStream!=null){
log.warning("resizing disabled during recording to prevent AVI corruption");
return;
}
AEViewer v = chip.getAeViewer();
if (v == null) {
log.warning("No AEViewer");
return;
}
GLCanvas c = (GLCanvas) (chip.getCanvas().getCanvas());
if (c == null) {
log.warning("No Canvas to resize");
return;
}
int ww = c.getWidth(), hh = c.getHeight();
int vw=v.getWidth(), vh=v.getHeight();
v.setSize(w + (vw-ww), h + (vh-hh));
v.revalidate();
int ww2 = c.getWidth(), hh2 = c.getHeight();
log.info(String.format("Canvas resized from %d x %d to %d x %d pixels", ww, hh, ww2, hh2));
}
示例8: main
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
public static void main(String[] args) {
// getting the capabilities object of GL2 profile
final GLProfile profile = GLProfile.get(GLProfile.GL2);
GLCapabilities glc = new GLCapabilities(profile);
final GLCanvas glCanvas = new GLCanvas(glc);
GameIntro b = new GameIntro();
glCanvas.addGLEventListener(b);
glCanvas.setSize(1300, 800);
// creating frame
final JFrame frame = new JFrame("Welcome to Heavy Evil");
// adding canvas to it
frame.getContentPane().add(glCanvas);
frame.setSize(frame.getContentPane().getPreferredSize());
frame.setVisible(true);
final FPSAnimator animator = new FPSAnimator(glCanvas, 120, true);
animator.start();
glCanvas.isDoubleBuffered();
}
示例9: GltfViewerJogl
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
/**
* Creates a new GltfViewerJogl
*/
public GltfViewerJogl()
{
GLProfile profile = getGLProfile();
logger.config("GLProfile: " + profile);
GLCapabilities capabilities = new GLCapabilities(profile);
capabilities.setNumSamples(2);
capabilities.setSampleBuffers(true);
glComponent = new GLCanvas(capabilities);
glComponent.addGLEventListener(glEventListener);
// Without setting the minimum size, the canvas cannot
// be resized when it is embedded in a JSplitPane
glComponent.setMinimumSize(new Dimension(10, 10));
glContext = new GlContextJogl();
}
示例10: run
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
/**
* スケッチを開始するにはこの関数をコールしてください。
*/
public void run()
{
this._frame= new Frame("NyARTK Sketch");
this._frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
this._canvas = new GLCanvas();
this._canvas.addGLEventListener(this);
this._canvas.addMouseListener(this);
this._canvas.addMouseMotionListener(this);
Insets ins = this._frame.getInsets();
this._frame.setSize(320 + ins.left + ins.right,240 + ins.top + ins.bottom);
this._canvas.setBounds(ins.left, ins.top,320,240);
this._frame.add(this._canvas);
this._frame.setVisible(true);
}
示例11: Shoot
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
Shoot()
{
System.out.printf("THREAD_COUNT:%4d\n", THREAD_COUNT);
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
caps.setSampleBuffers(true);
caps.setNumSamples(8);
canvas = new GLCanvas(caps);
canvas.setSize(1000, 1000);
canvas.addMouseListener(mcontrol);
canvas.addKeyListener(kbcontrol);
disp = new Display(this);
disp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
disp.setSize(1000,1000);
disp.add(canvas);
disp.setVisible(true);
disp.addKeyListener(kbcontrol);
canvas.addGLEventListener(disp);
animator = new FPSAnimator(canvas, 50);
mtProjectiles = new MT_Generic<Projectile>(entityWrapper.projectiles, es);
mtDynamics = new MT_Generic<Dynamic>(entityWrapper.dynamics, es);
mtEntMov = new MT_EntMovement(entityWrapper.pathEnts, es);
inst = this;
}
示例12: initializeJogl
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
private void initializeJogl() {
// Creating a new GL profile.
GLProfile glprofile = GLProfile.getDefault();
// Creating an object to manipulate OpenGL parameters.
GLCapabilities capabilities = new GLCapabilities(glprofile);
// Setting some OpenGL parameters.
capabilities.setHardwareAccelerated(true);
capabilities.setDoubleBuffered(true);
// Try to enable 2x anti aliasing. It should be supported on most hardware.
capabilities.setNumSamples(2);
capabilities.setSampleBuffers(true);
// Creating an OpenGL display widget -- canvas.
this.canvas = new GLCanvas(capabilities);
this.canvas.addMouseListener(this);
this.canvas.addMouseMotionListener(this);
// Adding the canvas in the center of the frame.
this.getContentPane().add(this.canvas);
// Adding an OpenGL event listener to the canvas.
this.canvas.addGLEventListener(this);
// Creating an animator that will redraw the scene 40 times per second.
this.animator = new Animator(this.canvas);
// Starting the animator.
this.animator.start();
}
示例13: annotate
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
String s=null;
chip.getCanvas().checkGLError(drawable.getGL().getGL2(), glu, "in TrackdefineFilter.drawThrottleProfile");
if (isTextEnabled()) {
if (getTrack() == null) {
s = "Null track";
} else {
s = String.format("EvolutionaryThrottleController\nMouse+Shift: Increase throttle\nMouse+Ctl: Decrease Throttle\nMouse+Alt: Add braking point\nMouse+Shfit+Alt: Remove braking point\nState: %s\nLearning %s\ncurrentTrackPos: %d/%d\nThrottle: %8.3f\n%s", state.toString(), learningEnabled ? "Enabled" : "Disabled", currentTrackPos, getTrack().getNumPoints(), throttle.throttle, lapTimer.toString());
}
// if(state.getString()==State.CRASHED){
//
// }else if(state.getString()==State.RUNNING){
//
// }else{
// }
MultilineAnnotationTextRenderer.renderMultilineString(s);
}
if (showThrottleProfile) {
drawThrottleProfile(drawable.getGL().getGL2());
}
drawCurrentTrackPoint(drawable.getGL().getGL2());
drawLastCrashLocation(drawable.getGL().getGL2());
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
drawThrottlePainter(drawable);
renderBigStatusText(drawable);
}
示例14: annotate
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
chip.getCanvas().checkGLError(gl, glu, "in TrackdefineFilter.drawThrottleProfile");
computerCarTracker.setCarColor(Color.RED);
humanCarTracker.setCarColor(Color.GREEN);
if (isTextEnabled()) {
String s;
s = String.format("HumanVsComputerThrottleController\nDefine track with TrackDefineFilter and load that track here.\nState: %s\nLearning %s\ncomputer/human trackPosition: %d|%d/%d\nThrottle: %8.3f\nLast throttle reduction factor: %.2f\nComputer %s\nHuman %s\n%s\n%d laps remaining\nLast Winner: %s", state.toString(), learningEnabled ? "Enabled" : "Disabled", computerTrackPosition, humanTrackPosition, track == null ? 0 : getTrack().getNumPoints(), throttle.throttle, throttleReductionFactor, computerLapTimer.toString(), humanLapTimer.toString(), standings(), raceLapsRemaining, winner.toString());
MultilineAnnotationTextRenderer.setScale(.25f);
MultilineAnnotationTextRenderer.renderMultilineString(s);
}
if (showTrack && (track != null)) {
track.draw(drawable);
}
if (showThrottleProfile) {
drawThrottleProfile(drawable.getGL().getGL2());
}
highLightTrackPoint(gl, computerTrackPosition, Color.RED, 3, "computer");
highLightTrackPoint(gl, humanTrackPosition, Color.GREEN, 3, "human");
highLightTrackPoint(gl, lastCrashLocation, Color.PINK, 3, "last computer crash");
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
drawThrottlePainter(drawable);
renderBigStatusText(drawable);
}
示例15: annotate
import com.jogamp.opengl.awt.GLCanvas; //导入依赖的package包/类
@Override
synchronized public void annotate(GLAutoDrawable drawable) {
if (counter < 1) {
counter++;
} else {
if (drawable == null || chip.getCanvas() == null) {
System.out.println("Null drawable or chip.getCanvas(), why?");
return;
}
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
GL2 gl = drawable.getGL().getGL2();
trackHistogramFilter.annotate(drawable);
if (displayTrack) {
drawExtractedTrack(gl);
}
if (drawTrackerPoints) {
drawTrackerPoints(gl);
}
counter = 0;
}
}