担任这一职务的非描述性头衔,但我只是说话(如果你认为是的话,请提出更好的标题)。
我目前的发动机的一部分呼吁,为了充满活力的灯光......,它似乎在工作上很出色,但在某些灯光产生后,出于某些令人厌恶的原因,游戏仍然很缓慢,如果仍在打上,就会如此。 我不禁要问,我的诗歌职能是否留下了记忆。
这里的职能是:
public void lightBlock(GL10 gl, int _x, int _y, float shade)
{
if (map[_x][_y].Type()==1)
{
gl.glPushMatrix();
gl.glTranslatef(_x*2,getFH(_x,_y)+.01f,_y*2);
gl.glRotatef(90,1, 0, 0);
gl.glScalef(2, 2, 0);
gl.glColor4f(shade,shade,shade, 1f);
drawSprite(gl,0);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(_x*2,getRH(_x,_y)-.01f,_y*2);
gl.glRotatef(-90,1, 0, 0);
gl.glScalef(2, 2, 0);
gl.glColor4f(shade,shade,shade, 1f);
//Draw the vertices
drawSprite(gl,0);
gl.glPopMatrix();
}
}
public void drawSprite(GL10 gl, int tex)
{
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
//defines the vertices we want to draw
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, SvertexBuffer);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, StexBuffer);
//Draw the vertices
gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, SindexBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}
If the lights are not in use, these functions are not called... but oddly enough once they have been called many times, the game runs as slow as it would be if they were all running at once... And it runs normally as soon as I comment out the "drawSprite()" calls...
这些灯在“onDrawFrame”功能内。
任何帮助都是巨大的。