Examples of GL2


Examples of javax.media.opengl.GL2

        if (texture == null)
            return;

        // Push state for blend enable, blending function, and current color. We set these OGL states in
        // applyBackgroundTextureState(), which is invoked by doDrawBackgroundTexture().
        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
        OGLStackHandler ogsh = new OGLStackHandler();
        ogsh.pushAttrib(gl, GL2.GL_COLOR_BUFFER_BIT | GL2.GL_CURRENT_BIT);
        try
        {
            this.doDrawBackgroundTexture(dc, width, height, 1, pickPosition, texture);
View Full Code Here

Examples of javax.media.opengl.GL2

    }

    protected void transformBackgroundImageCoordsToAnnotationCoords(DrawContext dc, int width, int height,
        WWTexture texture)
    {
        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

        // Scale background image coordinates to fit the Annotation's dimensions.
        java.awt.Dimension size = this.getImageSize(dc);
        if (size != null)
        {
            gl.glScaled(size.getWidth() / (double) width, size.getHeight() / (double) height, 1d);
        }

        super.transformBackgroundImageCoordsToAnnotationCoords(dc, width, height, texture);
    }
View Full Code Here

Examples of javax.media.opengl.GL2

        }
    }

    protected void doPick(DrawContext dc, Iterable<? extends Renderable> renderables, java.awt.Point pickPoint)
    {
        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
        this.pickSupport.clearPickList();
        this.pickSupport.beginPicking(dc);

        try
        {
            for (Renderable renderable : renderables)
            {
                // If the caller has specified their own Iterable,
                // then we cannot make any guarantees about its contents.
                if (renderable != null)
                {
//                    float[] inColor = new float[4];
//                    gl.glGetFloatv(GL.GL_CURRENT_COLOR, inColor, 0);
                    java.awt.Color color = dc.getUniquePickColor();
                    gl.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());

                    try
                    {
                        renderable.render(dc);
                    }
View Full Code Here

Examples of javax.media.opengl.GL2

    * @param dc       Current draw context.
    * @param pathData the current globe-specific path data.
    */
   protected void drawDirectionArrows(DrawContext dc, PathData pathData)
   {
      GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
      boolean projectionOffsetPushed = false; // keep track for error recovery

      try
      {
         if (this.isSurfacePath())
         {
            // Pull the arrow triangles forward just a bit to ensure they show over the terrain.
            dc.pushProjectionOffest(SURFACE_PATH_DEPTH_OFFSET);
            gl.glDepthMask(false);
            projectionOffsetPushed = true;
         }

         FloatBuffer directionArrows = (FloatBuffer) pathData.getValue(ARROWS_KEY);
         gl.glVertexPointer(3, GL.GL_FLOAT, 0, directionArrows.rewind());
         gl.glDrawArrays(GL.GL_TRIANGLES, 0, directionArrows.limit() / 3);
      }
      finally
      {
         if (projectionOffsetPushed)
         {
            dc.popProjectionOffest();
            gl.glDepthMask(true);
         }
      }
   }
View Full Code Here

Examples of javax.media.opengl.GL2

      @Override
        protected void transformBackgroundImageCoordsToAnnotationCoords(DrawContext dc, int width, int height,
            WWTexture texture)
        {
            GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

            // Rotate around an axis originating from the center of the image and coming out of the screen.
            double hw = (double) texture.getWidth(dc) / 2d;
            double hh = (double) texture.getHeight(dc) / 2d;
            gl.glTranslated(hw, hh, 0);
            gl.glRotated(-this.getAngle().degrees, 0, 0, 1);
            gl.glTranslated(-hw, -hh, 0);

            super.transformBackgroundImageCoordsToAnnotationCoords(dc, width, height, texture);
        }
View Full Code Here

Examples of javax.media.opengl.GL2

      return false;
    }
    if (!property.node1.isVisible || !property.node2.isVisible) {
      return false;
    }
    GL2 gl = scene.gl;
    gl.glPushName(property.shapeId);
    if (property.strokeWidth > 0.0f) {
      gl.glLineWidth(property.strokeWidth);
      gl.glColor4f(property.strokeColor.getRed() / 255f,
          property.strokeColor.getGreen() / 255f,
          property.strokeColor.getBlue() / 255f,
          property.strokeColor.getAlpha() / 255f);

      // get the real endpoints for the edge. Necessary to have the
      // real shapes if the nodes are collapsed.
      NodeRenderingProperty node1 = property.node1.isCompletelyCollapsed() ?
          property.node1.collapsedUnder : property.node1;
      NodeRenderingProperty node2 = property.node2.isCompletelyCollapsed() ?
          property.node2.collapsedUnder : property.node2;

      Point2D middle = ((Arrow) property.shape).linkShapes(gl,
          new Point2D.Float(property.p1X * GLScene.FACTOR,
              property.p1Y * GLScene.FACTOR),
          new Point2D.Float(property.p2X * GLScene.FACTOR,
              property.p2Y * GLScene.FACTOR),
          node1.shape, node2.shape, property.deviation);

      if (property.isTextVisible) {
        paintLabel(property, middle);
      }
    }
    gl.glPopName();
    return true;
  }
View Full Code Here

Examples of javax.media.opengl.GL2

   * @param p center point where to draw the label.
   */
  private void paintLabel(EdgeRenderingProperty property, Point2D p) {
    // Use the GL_MODULATE texture function to effectively multiply
    // each pixel in the texture by the current alpha value
    GL2 gl = scene.gl;
    gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_MODULATE);

    if (property.textIsDirty) {
      // recreate the texture, and save it.
      property.textTexture = property.textRenderer.getTexture();
      property.textIsDirty = false;
View Full Code Here

Examples of javax.media.opengl.GL2

   * @param property
   */
  private void paintLabel(NodeRenderingProperty property) {
    // Use the GL_MODULATE texture function to effectively multiply
    // each pixel in the texture by the current alpha value
    GL2 gl = scene.gl;
    gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_MODULATE);

    if (property.textIsDirty) {
      // recreate the texture, and save it.
      property.textTexture = property.textRenderer.getTexture();
      property.textIsDirty = false;
View Full Code Here

Examples of javax.media.opengl.GL2

    float tx2 = tc.right();
    float ty2 = tc.bottom();
    float halfWidth = quarterValue(texture.getWidth());
    float halfHeight = quarterValue(texture.getHeight());

    GL2 gl = scene.gl;
    texture.bind(gl);
    texture.enable(gl);

    Color foreground = scene.getForegroundColor();
    gl.glColor4f(foreground.getRed() / 255f,
        foreground.getGreen() / 255f,
        foreground.getBlue() / 255f,
        foreground.getAlpha() / 255f);

    gl.glPushMatrix();
    float[] translate = GLScene.P((float) centerX, (float) centerY);
    gl.glTranslatef(translate[0], translate[1], translate[2]);
    gl.glBegin(GL2.GL_QUADS);
    // divided by 2 to get nicer textures
    // divided by 4 when we center it : 1/2 on each side of x axis for instance.
    gl.glTexCoord2f(tx1, ty1);
    GLScene.V(gl, -halfWidth, halfHeight);
    gl.glTexCoord2f(tx2, ty1);
    GLScene.V(gl, halfWidth,  halfHeight);
    gl.glTexCoord2f(tx2, ty2);
    GLScene.V(gl, halfWidth, -halfHeight);
    gl.glTexCoord2f(tx1, ty2);
    GLScene.V(gl, -halfWidth, -halfHeight);
    gl.glEnd();
    gl.glPopMatrix();

    texture.disable(gl);
  }
View Full Code Here

Examples of javax.media.opengl.GL2

  }

  @Override
  public void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor) {
    Vec2 vec = getWorldToScreen(argPoint);
    GL2 gl = panel.getGL().getGL2();
    gl.glBegin(GL2.GL_POINT);
    gl.glPointSize(argRadiusOnScreen);
    gl.glVertex2f(vec.x, vec.y);
    gl.glEnd();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.