小编gra*_*rry的帖子

我想每帧调用glBegin和glEnd一次

正如在标题中我希望每帧/更新只能调用glBegin和glEnd一次,因为我已经听到并且正在经历如果你每次更新多次调用它会大幅减速.

这是我的渲染函数的代码:

GL11.glTranslatef(0, 0, -10);
    int x = 0;

    while (x < World.BLOCKS_WIDTH - 1) {
        int y = 0;
        while (y < World.BLOCKS_HEIGHT - 1) {

            if( x * World.BLOCK_SIZE  <= Display.getHeight() ||  y * World.BLOCK_SIZE <= 
                Display.getWidth() ||  x * World.BLOCK_SIZE >= 0 || 
                y * World.BLOCK_SIZE >= 0 ) {

            blocks.b[data.blocks[x][y]].draw(x + Main.PosX, y + Main.PosY);

            }

            y++;
        }
        x++;

}
Run Code Online (Sandbox Code Playgroud)

任何帮助赞赏.

这是我的块类:

GL11.glPushMatrix();
    GL11.glTranslatef(Xa * World.BLOCK_SIZE, Ya * World.BLOCK_SIZE, 0);
    //GL11.glRotatef(0, 0, 1, 0);
    //GL11.glRotatef(0, 1, …
Run Code Online (Sandbox Code Playgroud)

java opengl lwjgl

0
推荐指数
1
解决办法
441
查看次数

标签 统计

java ×1

lwjgl ×1

opengl ×1