Package javax.vecmath

Examples of javax.vecmath.Color4f


  private Line[] getLines(boolean includeNull, boolean includeColorNull) {
    Line[] lines = new Line[3];
    Line t1 = new Line();
    t1.getPoint(0).set(0,0);
    t1.getPoint(1).set(50,50);
    setColor(t1, new Color4f(1, 0, 0, 1));
    lines[0] = t1;
   
    if(!includeNull) {
      Line t2 = new Line();
      t2.getPoint(0).set(100,100);
      t2.getPoint(1).set(150,150);
      setColor(t2, new Color4f(0, 1, 0, 1));
      lines[1] = t2;
    }

    Line t3 = new Line();
    t3.getPoint(0).set(200,200);
    t3.getPoint(1).set(250,250);
    if(!includeColorNull) {
      setColor(t3, new Color4f(0, 0, 1, 1));
    }
    lines[2] = t3;
    return lines;
  }
View Full Code Here


    if (lines == null) throw new IllegalArgumentException("lines must not be null");
      startPrimitive(Primitive.LINE, null);
    GL gl = drawable.getGL();
    Vector2f p;
    if(useColor) {
      Color4f c;
      for(int i = 0; i < lines.length; i++) {
        Line l = lines[i];
        if(l == null) continue;

        p = l.getPoint(0);
View Full Code Here

    if (triangles == null) throw new IllegalArgumentException("triangles must not be null");
      startPrimitive(Primitive.LINE, null);
    GL gl = drawable.getGL();
    Vector2f p;
    if(useColors) {
      Color4f c;
      for(int i = 0; i < triangles.length; i++) {
        Triangle t = triangles[i];
        if(t == null) continue;
     
        p = t.getPoint(0);
View Full Code Here

    Vector2f p;
   
    startPrimitive(Primitive.TRIANGLE, null);

    if(useColors) {
      Color4f c = null;
      for(int i = 0; i < triangles.length; i++) {
        Triangle t = triangles[i];
        if(t == null) continue;

        p = t.getPoint(0);
View Full Code Here

    startPrimitive(Primitive.TEXTURED_TRIANGLE, joglImage);

    TextureCoords coords = joglImage.texture.getImageTexCoords();
   
    if(useColors) {
      Color4f c;
        for(int i = 0; i < triangles.length; i++) {
        Triangle t = triangles[i];
        if(t == null) continue;

        Vector2f tc1 = t.getTextureCoordinate(0);
View Full Code Here

    Triangle t = new Triangle();
    t.getPoint(0).set(0,0);
    t.getPoint(1).set(50,50);
    t.getPoint(2).set(0,50);
    if(!includeColorNull) {
      setColor(t, new Color4f(0, 1, 0, 1));
    }
    if(!includeTexCoordNull) {
      setTexCoords(t);
    }
    return t;
View Full Code Here

    Triangle[] triangles = new Triangle[3];
    Triangle t1 = new Triangle();
    t1.getPoint(0).set(0,0);
    t1.getPoint(1).set(50,50);
    t1.getPoint(2).set(0,50);
    setColor(t1, new Color4f(1, 0, 0, 1));
    setTexCoords(t1);
    triangles[0] = t1;
   
    if(!includeNull) {
      Triangle t2 = new Triangle();
      t2.getPoint(0).set(100,100);
      t2.getPoint(1).set(150,150);
      t2.getPoint(2).set(100,150);
      setColor(t2, new Color4f(0, 1, 0, 1));
      setTexCoords(t2);
      triangles[1] = t2;
    }

    Triangle t3 = new Triangle();
    t3.getPoint(0).set(200,200);
    t3.getPoint(1).set(250,250);
    t3.getPoint(2).set(200,250);
    if(!includeColorNull) {
      setColor(t3, new Color4f(0, 0, 1, 1));
    }
    if(!includeTexCoordNull) {
      setTexCoords(t3);
    }
   
View Full Code Here

  @Test
  public void drawPointsWithColor() {
    context.setGraphicsListener(new GraphicsListener() {
      public void draw(View view, Graphics graphics) {
        graphics.clear();
        graphics.setColor(new Color4f(1, 0, 0, 1));
        graphics.drawPoint(0, 0);
        graphics.setColor(new Color4f(0, 1, 0, 1));
        graphics.drawPoint(100, 100);
        graphics.setColor(new Color4f(0, 0, 1, 1));
        graphics.drawPoint(200, 200);
      }
      public void init(View view, Graphics renderer) {}
      public void sizeChanged(GraphicsContext graphicsContext, View view) {}
    });
View Full Code Here

  }

  public void start() {
    for(int i = 0; i < pool.length; i++) {
      pool[i] = new Triangle();
      pool[i].setColor(0, new Color4f());
      pool[i].setColor(1, new Color4f());
      pool[i].setColor(2, new Color4f());
      pool[i].setTextureCoordinate(0, new Vector2f());
      pool[i].setTextureCoordinate(1, new Vector2f());
      pool[i].setTextureCoordinate(2, new Vector2f());
    }
  }
View Full Code Here

      T particle = (T)particles[i];
      float width = particle.getSize().x;
      float height = particle.getSize().y;
      float x = particle.getPosition().x - width / 2;
      float y = particle.getPosition().y - height / 2;
      Color4f color = particle.getColor();
     
      // TODO test in joglgraphicsdelegate if texturecoordinates are available
      Triangle t = pool[triangles];
      t.getPoint(0).set(x, y);
      t.getPoint(1).set(x + width, y);
View Full Code Here

TOP

Related Classes of javax.vecmath.Color4f

Copyright © 2018 www.massapicom. 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.