Title: Starfield optimization in libgdx
Tags: android;libgdx
Question: I want to create a static starfield in libgdx. 

My first way was: create a Decal and a DecalBatch over it. 
When I draw the Decal I use a Billboarding technic on the Decal

```star.decal.setRotation(camera.direction, camera.up);
```

next: I wanted to animate the alphas on the decals, so I created on a random way some time:

```star.decal.setColor(1, 1, 1, 0.6f+((float) Math.random()*0.4f) );
```

It is working, but my FPS went down from 55 FPS to 25 FPS (because of my 500-1000 stars)

Can I use only  one batch call in any way? Maybe a particleMaterial with only one Vertex list and with a GL_POINT mode that is always face to front of my camera?

How can I do this in libgdx?

Comment: Have you solved it? Do you have some example code?

Comment: what do you mean One Batch Call? also you have a lot animated stars on android device.

Here is the accepted answer: The Batch is way to complex than what you need , on every frame it needs to copy all the vertices of the sprites in another array and do calculations on them to find the scale rotation etc..
As you suspect GL_POINT sprites will be way faster and in a medium range device it should be able to render in 60 fps like 2000 points that have different position and color

here is some old code of mine ,its in c and it uses opengl es 1.1 and propably there will be a more simple way to do it in libgdx

```glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

glEnableClientState(GL_VERTEX_ARRAY);   
glEnableClientState(GL_COLOR_ARRAY);
glEnable (GL_POINT_SPRITE_OES);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TXTparticle);
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_TRUE);
glPointSize(30);
glColorPointer(4, GL_FLOAT, 32, particlesC);//particlesC the vertices color
glVertexPointer(3, GL_FLOAT, 24, particlesV);//particlesV the vertices   
glDrawArrays(GL_POINTS, 0,  vertvitLenght/6); 
glDisable( GL_POINT_SPRITE_OES );
glDisable(GL_TEXTURE_2D);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
```



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:02/14/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<android><libgdx>', 'Title': 'Starfield optimization in libgdx', 'ViewCount': 365, 'id': 21780575, 'user_AboutMe': '<p>I am from Europe, Hungary. I am currently a php and android programmer.</p>\n', 'user_AccountId': 216976.0, 'user_DisplayName': 'lacas', 'user_Reputation': 13645.0, 'user_Views': 2112.0, 'user_id': 472537.0}}