@Override public void glPolygonMode(int param1, int param2) { GLContext.getCurrentGL().getGL2().glPolygonMode(param1, param2); }
@Override public void reshape(GLAutoDrawable glautodrawable, int x, int y, int width, int height) { FocusOMeterGLRenderer.setup(glautodrawable.getGL().getGL2(), width, height); }
@Override public void reshape(GLAutoDrawable glautodrawable, int x, int y, int width, int height) { zenSpaceRenderer.setup(glautodrawable.getGL().getGL2(), width, height); }
@Override public void reshape(GLAutoDrawable glautodrawable, int x, int y, int width, int height) { FocusOMeterGLRenderer.setup(glautodrawable.getGL().getGL2(), width, height); }
@Override public void reshape(GLAutoDrawable glautodrawable, int x, int y, int width, int height) { neurofeedbackRenderer.setup(glautodrawable.getGL().getGL2(), width, height); }
/** * Initialize or update open gl color array in native buffer objects. */ private void updateGLColorArray(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); // Reset buffer and set to null of new colors don't fit. if (lineColorBuffer != null) { lineColorBuffer.clear(); if (lineColorBuffer.remaining() < lineColorData.length) { lineColorBuffer = null; } } if (lineColorBuffer == null) { lineColorBuffer = Buffers.newDirectByteBuffer(this.lineColorData.length); } lineColorBuffer.put(lineColorData); lineColorBuffer.flip(); gl.glColorPointer( 3, GL.GL_UNSIGNED_BYTE, 0, lineColorBuffer ); }
@Override public void display(GLAutoDrawable glautodrawable) { FocusOMeterGLRenderer.render(glautodrawable.getGL().getGL2(), glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight()); } });
@Override public void display(GLAutoDrawable glautodrawable) { FocusOMeterGLRenderer.render(glautodrawable.getGL().getGL2(), glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight()); } });
@Override public void display(GLAutoDrawable glautodrawable) { zenSpaceRenderer.render(glautodrawable.getGL().getGL2(), glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight()); } });
@Override public void display(GLAutoDrawable glautodrawable) { neurofeedbackRenderer.render(glautodrawable.getGL().getGL2(), glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight()); } });
/** * Call-back handler for window re-size event. Also called when the drawable is * first set to visible. * GLEventListener method. */ @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { logger.log(Level.INFO, "Reshaping OpenGL context."); if (!isDrawable) return; this.xSize = width; this.ySize = height; GL2 gl = drawable.getGL().getGL2(); // get the OpenGL 2 graphics context if (height == 0){ height = 1; } // prevent divide by zero this.aspectRatio = (float)width / height; this.scaleFactorBase = VisualizerUtils.findScaleFactor(this.xSize, this.ySize, this.objectMin, this.objectMax, 0.9); this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier; this.panMultiplierX = VisualizerUtils.getRelativeMovementMultiplier(this.objectMin.x, this.objectMax.x, this.xSize); this.panMultiplierY = VisualizerUtils.getRelativeMovementMultiplier(this.objectMin.y, this.objectMax.y, this.ySize); // Set the view port (display area) to cover the entire window gl.glViewport(0, 0, width, height); }
/** * Initialize or update open gl geometry array in native buffer objects. */ private void updateGLGeometryArray(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); // Reset buffer and set to null of new geometry doesn't fit. if (lineVertexBuffer != null) { lineVertexBuffer.clear(); if (lineVertexBuffer.remaining() < lineVertexData.length) { lineVertexBuffer = null; } } if (lineVertexBuffer == null) { lineVertexBuffer = Buffers.newDirectFloatBuffer(lineVertexData.length); } lineVertexBuffer.put(lineVertexData); lineVertexBuffer.flip(); gl.glVertexPointer( 3, GL.GL_FLOAT, 0, lineVertexBuffer ); }
/** * Called back immediately after the OpenGL context is initialized. Can be used * to perform one-time initialization. Run only once. * GLEventListener method. */ @Override public void init(GLAutoDrawable drawable) { logger.log(Level.INFO, "Initializing OpenGL context."); generateObject(); this.fpsCounter = new FPSCounter(drawable, new Font("SansSerif", Font.BOLD, 12)); this.overlay = new Overlay(drawable, new Font("SansSerif", Font.BOLD, 12)); this.overlay.setColor(127, 127, 127, 100); this.overlay.setTextLocation(Overlay.LOWER_LEFT); // Parse random gcode file and generate something to draw. GL2 gl = drawable.getGL().getGL2(); // get the OpenGL graphics context glu = new GLU(); // get GL Utilities gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color gl.glClearDepth(1.0f); // set clear depth value to farthest gl.glEnable(GL_DEPTH_TEST); // enables depth testing gl.glDepthFunc(GL_LEQUAL); // the type of depth test to do gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // best perspective correction gl.glShadeModel(GL_SMOOTH); // blends colors nicely, and smoothes out lighting }
/** * Draws a tool at the current work coordinates. */ private void renderTool(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glLineWidth(8.0f); byte []color; color = VisualizerUtils.Color.YELLOW.getBytes(); int verts = 0; int colors = 0; gl.glBegin(GL_LINES); gl.glColor3ub(color[0], color[1], color[2]); gl.glVertex3d(this.workCoord.x, this.workCoord.y, this.workCoord.z); gl.glColor3ub(color[0], color[1], color[2]); gl.glVertex3d(this.workCoord.x, this.workCoord.y, this.workCoord.z+(1.0/this.scaleFactor)); gl.glEnd(); }
GL2 gl2 = drawable.getGL().getGL2();
private void renderAxes(GLAutoDrawable drawable) { final GL2 gl = drawable.getGL().getGL2();
final GL2 gl = drawable.getGL().getGL2();
final GL2 gl = drawable.getGL().getGL2();
public void init(GLAutoDrawable drawable) { GL2 gl; gl = drawable.getGL().getGL2(); gl.setSwapInterval(0); }
GL2 gl = drawable.getGL().getGL2();