マンデルブロのレンダリングをAIDEのlibGDXを使ってレンダリングしようとしています。だから、私はアルゴリズムを研究し、それを実装しようとしました。libGDXでマンデルブロを描く
この関数は、スクリーン -
public int calcFract(int x, int y, int maxiter)
{
zx = zy = 0;
cx = (x - width/2)/zoom;
cy = (y - height/2)/zoom;
while(zx * zx + zy * zy < 4.0 && iter < maxiter)
{
tmp = zx * zx - zy * zy + cx;
zy = 2.0 * zx * zy + cy;
zx = tmp;
iter++;
}
return iter | iter << 8;
}
そして、ここで画素ごとに呼び出されたが(作成される)、アプリがエラーなしでコンパイルが、私はそれを実行したときに
public void create()
{
width = Gdx.graphics.getWidth();
height = Gdx.graphics.getHeight();
Gdx.input.setInputProcessor(this);
fractal = new Pixmap(width, height, Pixmap.Format.RGB888);
for (int i = 0; i < width; ++i)
for (int j = 0; j < height; ++j)
{
int c = mandelbrot.calcFract(i, j, maxiter);
fractal.drawPixel(i, j, Color.toIntBits(0xff, c, c, c));
}
fracTex = new Texture(fractal);
batch = new SpriteBatch();
}
をcallback-それがここで私this-
notice the left side of the screen
を示していますrender()コールバックも同様です。
public void render()
{
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(fracTex, 0, 0);
batch.end();
}
私のコードに問題がある場合は教えてください。 ありがとうございます!
私がこれを理解するのを手伝ってください、ppl。 –
画像は私にとっては黒です。 「画面の左側に気づく」とはどういう意味ですか? – Moira
画面の左側に勾配パターンを持つ1つのピクセルワイドラインがあります。 –