public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); synchronized (this._camera) { try { gl.glClear( GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear the buffers for new frame. NyARGLDrawUtil.drawBackGround(gl, this._camera.getSourceImage(), 1.0); this._nyar.update(this._camera); if (this._nyar.isExistMarker(this.ids[0])) { gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadMatrixd(this._nyar.getGlMarkerMatrix(this.ids[0]), 0); NyARGLDrawUtil.drawColorCube(gl, 40); gl.glPopMatrix(); } if (this._nyar.isExistMarker(this.ids[1])) { gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadMatrixd(this._nyar.getGlMarkerMatrix(this.ids[1]), 0); NyARGLDrawUtil.drawColorCube(gl, 40); gl.glPopMatrix(); } Thread.sleep(1); } catch (Exception e) { e.printStackTrace(); } } }
public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadMatrixd(this._nyar.getGlProjectionMatrix(), 0); gl.glEnable(GL.GL_DEPTH_TEST); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); Animator animator = new Animator(drawable); animator.start(); return; }
public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glRasterPos2i(1, 1); gl.glDrawPixels( dim.width, dim.height, // GL.GL_RGB, GL.GL_UNSIGNED_BYTE, pixels); gl.glFlush(); }
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { GL gl = drawable.getGL(); gl.glViewport(0, 0, w, h); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, w, 0, h, -1.0, 1.0); gl.glMatrixMode(GL.GL_MODELVIEW); }
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { _gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); _gl.glViewport(0, 0, width, height); // 視体積の設定 _gl.glMatrixMode(GL.GL_PROJECTION); _gl.glLoadIdentity(); // 見る位置 _gl.glMatrixMode(GL.GL_MODELVIEW); _gl.glLoadIdentity(); }
public void glInit(GeometryViewer viewer, GL gl, GLU glu) { surface = getNewSurface(); float mat_diffuse[] = {0.7f, 0.7f, 0.7f, 1.0f}; float mat_specular[] = {1.0f, 1.0f, 1.0f, 1.0f}; float mat_shininess[] = {100.0f}; gl.material(FRONT, DIFFUSE, mat_diffuse); gl.material(FRONT, SPECULAR, mat_specular); gl.material(FRONT, SHININESS, mat_shininess); gl.enable(LIGHTING); gl.enable(LIGHT0); gl.enable(DEPTH_TEST); gl.enable(AUTO_NORMAL); gl.enable(NORMALIZE); initSurface(); surface.nurbsProperty(GLU_SAMPLING_TOLERANCE, 25.0f); surface.nurbsProperty(GLU_DISPLAY_MODE, GLU_FILL); }
public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); float m[] = { 0.0f, 1.0f, 0.0f, 0.0f, // 0.0f, 0.0f, 1.0f, 0.0f, // 1.0f, 0.0f, 0.0f, 0.0f, // 0.0f, 0.0f, 0.0f, 1.0f }; pixels = readImage("Data/leeds.bin", dim); System.out.println(pixels.toString()); gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glMatrixMode(GL.GL_COLOR); gl.glLoadMatrixf(m, 0); gl.glMatrixMode(GL.GL_MODELVIEW); }
public void paint(GeometryViewer viewer, GL gl, GLU glu) { float knots[] = {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f}; float flatControlPoints[]; int i, j, k, flatCounter = 0; flatControlPoints = new float[4 * 4 * 3]; for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) for (k = 0; k < 3; k++) flatControlPoints[flatCounter++] = controlPoints[i][j][k]; gl.pushMatrix(); gl.rotate(330.0f, 1.f, 0.f, 0.f); gl.scale(0.5f, 0.5f, -0.5f); surface.beginSurface(); surface.nurbsSurface(knots, knots, 4 * 3, 3, flatControlPoints, 4, 4, MAP2_VERTEX_3); surface.endSurface(); if (showPoints == true) { gl.pointSize(5.0f); gl.disable(LIGHTING); gl.color(1.0f, 1.0f, 0.0f); gl.begin(POINTS); for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { gl.vertex(controlPoints[i][j][0], controlPoints[i][j][1], controlPoints[i][j][2]); } } gl.end(); gl.enable(LIGHTING); } gl.popMatrix(); }
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL gl = drawable.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glViewport(0, 0, width, height); return; }
public void init(GLAutoDrawable glAutoDrawable) { StringBuilder sb = new StringBuilder(); sb.append(gov.nasa.worldwind.Version.getVersion() + "\n"); sb.append("\nSystem Properties\n"); sb.append("Processors: " + Runtime.getRuntime().availableProcessors() + "\n"); sb.append("Free memory: " + Runtime.getRuntime().freeMemory() + " bytes\n"); sb.append("Max memory: " + Runtime.getRuntime().maxMemory() + " bytes\n"); sb.append("Total memory: " + Runtime.getRuntime().totalMemory() + " bytes\n"); for (Map.Entry prop : System.getProperties().entrySet()) { sb.append(prop.getKey() + " = " + prop.getValue() + "\n"); } GL gl = glAutoDrawable.getGL(); sb.append("\nOpenGL Values\n"); String oglVersion = gl.glGetString(GL.GL_VERSION); sb.append("OpenGL version: " + oglVersion + "\n"); String oglVendor = gl.glGetString(GL.GL_VENDOR); sb.append("OpenGL vendor: " + oglVendor + "\n"); String oglRenderer = gl.glGetString(GL.GL_RENDERER); sb.append("OpenGL renderer: " + oglRenderer + "\n"); int[] intVals = new int[2]; for (Attr attr : attrs) { sb.append(attr.name).append(": "); if (attr.attr instanceof Integer) { gl.glGetIntegerv((Integer) attr.attr, intVals, 0); sb.append(intVals[0]).append(intVals[1] > 0 ? ", " + intVals[1] : ""); } sb.append("\n"); } String extensionString = gl.glGetString(GL.GL_EXTENSIONS); String[] extensions = extensionString.split(" "); sb.append("Extensions\n"); for (String ext : extensions) { sb.append(" " + ext + "\n"); } sb.append("\nJOGL Values\n"); String pkgName = "javax.media.opengl"; try { getClass().getClassLoader().loadClass(pkgName + ".GL"); Package p = Package.getPackage(pkgName); if (p == null) { sb.append("WARNING: Package.getPackage(" + pkgName + ") is null\n"); } else { sb.append(p + "\n"); sb.append("Specification Title = " + p.getSpecificationTitle() + "\n"); sb.append("Specification Vendor = " + p.getSpecificationVendor() + "\n"); sb.append("Specification Version = " + p.getSpecificationVersion() + "\n"); sb.append("Implementation Vendor = " + p.getImplementationVendor() + "\n"); sb.append("Implementation Version = " + p.getImplementationVersion() + "\n"); } } catch (ClassNotFoundException e) { sb.append("Unable to load " + pkgName + "\n"); } this.outputArea.setText(sb.toString()); }