Пример #1
0
 /**
  * drawing a frame drawing happens if world.start than it is assumed that game is loaded and
  * running therefore is ** scene.draw (GL10 gl) is called until world.start it is assumed that we
  * are still loading therefore ** scene.loading (GL10 gl) is called --- world starts in **
  * scene.loader() (a load method without gl parameter) if you do not call world.start() in
  * scene.loader() than scene.load(GL10 gl) will be called on every frame draw --- scene.loading
  * (GL10 gl) is called every time the frame is going to draw scene.loader is called once --- while
  * loading you can draw a loader or progressbar
  *
  * @param gl
  */
 @Override
 public void onDrawFrame(GL10 gl) {
   // debug ("image: bitmaps size "+bitmaps.values().size());
   if (bitmaps.size() > 0) {
     if (!active) {
       active = true;
     }
     for (int resource : bitmaps.keySet()) {
       debug("image: entering binder for resource " + resource);
       // here comes decode(R.drawable.something) from decode method for binding
       image(gl, resource);
       // @TODO try bind (gl, resource) instead of image(gl,resource)
       // because it seems that why decoding twice same image ?
       // if load thread is running it only binds it
       // assuming bitmap is already decoded
     }
   } else {
     // debug ("image: bitmaps not populated");
   }
   //		// clear Screen and Depth Buffer
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
   gl.glMatrixMode(GL10.GL_MODELVIEW);
   //		// Reset the Modelview Matrix
   gl.glLoadIdentity();
   if (world.start) {
     draw(gl);
     // System.out.println ("world entity count "+world.subjects.size ());
   } else {
     loading(gl);
   }
   if (config.display == Config.FIT && shift > 0) {
     square.draw(gl, 0, null, 0, -shift, display.width, shift, 0);
     square.draw(gl, 0, null, 0, display.height, display.width, shift, 0);
   }
 }
Пример #2
0
  public static void save(ArrayList<Square> squares, int stage) {
    BufferedImage img = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = img.createGraphics();
    //		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setBackground(Color.WHITE);
    g.setColor(Color.BLACK);

    g.clearRect(0, 0, IMAGE_SIZE, IMAGE_SIZE);
    for (Square square : squares) {
      square.draw(g);
    }
    g.drawString("STAGE " + stage, 30, 30);

    try {
      ImageIO.write(img, "PNG", Util.createFile("fractals/custom/custom-" + stage + ".png"));
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
Пример #3
0
  public void render(float r, float g, float b, float rT, float gT, float bT) {
    AbstractTexture glowed = Glow.getGlowed(texture, bluredTexture, r, g, b);
    checkForGLError();
    Shader.defaultShader.enable();
    Camera.useCamera();
    glowed.bind();
    Shader.getCurrentShader()
        .setUniformMat4f(Shader.getCurrentShader().modelMatrixUniformId, model);
    Square.draw();
    glowed.unbind();
    Shader.defaultShader.disable();

    /*Shader.defaultShader.enable();
    Camera.useCamera();
    Shader.getCurrentShader().setUniformMat4f(Shader.getCurrentShader().modelMatrixUniformId, model);
    glowed = Glow.getGlowed(titlesLayer, titlesLayerBlured, rT, gT, bT);
    glowed.bind();
    Square.draw();
    glowed.unbind();
    Shader.defaultShader.disable(); */
  }
Пример #4
0
 public void draw(GL10 gl) {
   gl.glColor4f(0.3f, 0.8f, 1.0f, 1.0f);
   super.draw(gl);
 }