Sign in to follow this  
chibitotoro0_0

Max # of Point Sprites 30 fps

Recommended Posts

Hi everyone, I was just wondering what's max # of sprites you can have before you dip below 30fps on a iPhone 3G. With my current implementation using OpenGL point sprites. I can get to about 700 sprites before it dips below. At around 5000 sprites it goes to around 6-7 fps. Is this the limitation of the system or is there another way to draw more sprites? Thanks for the replies,

Share this post


Link to post
Share on other sites
I looked up some code using VBOs can someone give me a hand? I can't get it to render:


init(){

GLuint vboIDs[4];
glGenBuffers(4 ,vboIDs); //create 3 vbos

//vertices
glBindBuffer(GL_ARRAY_BUFFER, vboIDs[0]);
glBufferData(GL_ARRAY_BUFFER, blotCount*8, blotVertex, GL_STATIC_DRAW);

//textures
glBindBuffer(GL_ARRAY_BUFFER, vboIDs[1]);
glBufferData(GL_ARRAY_BUFFER, blotCount*8, blotVertex, GL_STATIC_DRAW);

//colors
glBindBuffer(GL_ARRAY_BUFFER, vboIDs[2]);
glBufferData(GL_ARRAY_BUFFER, blotCount*16, blotColor, GL_STATIC_DRAW);

//indexes
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIDs[3]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 6*blotCount, blotTriangle, GL_STATIC_DRAW);

//reset so other's can draw first
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

draw(){
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

//vertices
glBindBuffer(GL_ARRAY_BUFFER, vboIDs[0]);
glVertexPointer(2, GL_FLOAT, 0, 0);

//textures
glBindBuffer(GL_ARRAY_BUFFER, vboIDs[1]);
glTexCoordPointer(2, GL_FLOAT, 0, 0);

//colors
glBindBuffer(GL_ARRAY_BUFFER, vboIDs[2]);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);

//textures
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIDs[3]);
glDrawElements(GL_TRIANGLES, 6*blotCount, GL_UNSIGNED_SHORT, 0);

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}



Where:

vertex:137.000000,113.000000,157.000000,113.000000,137.000000,133.000000,157.000000,133.000000
uv:0.000000,0.000000,0.500000,0.000000,0.000000,0.500000,0.500000,0.500000
color:214,50,20,60,214,50,20,60,214,50,20,60,214,50,20,60
index:0,1,2,1,2,3

Share this post


Link to post
Share on other sites
Check out the OOlong engine it has a point sprite implementation. For the iPhone you have to use some extensions to enable them (using VBOs)

http://oolongengine.com/

Also you can check out this post from another forum :

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=258029

he posted a small small code of point sprite rendering.

Good Luck!

-ddn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this