Quote:
Raydium does not use immediate mode, since it use compiled display lists.
the code for particles very much looks like immediate mode ? I'm not seeing any display lists there.
Code:
for(i=0;i<RAYDIUM_MAX_PARTICLES;i++)
if(raydium_particle_particles[i])
raydium_particle_draw(raydium_particle_particles[i],ux,uy,uz,rx,ry,rz);
seems to call
Code:
void raydium_particle_draw(raydium_particle_Particle *p,GLfloat ux, GLfloat uy, GLfloat uz, GLfloat rx, GLfloat ry, GLfloat rz)
..
glBegin(GL_QUADS); // berk... but i'll switch to triangles one day ;)
glTexCoord2f(1.0f, 0.0f);
glVertex3f(p->position[0] + (-rx - ux),
p->position[1] + (-ry - uy),
p->position[2] + (-rz - uz));
glTexCoord2f(1.0f, 1.0f);
glVertex3f(p->position[0] + (rx - ux),
p->position[1] + (ry - uy),
p->position[2] + (rz - uz));
glTexCoord2f(0.0f, 1.0f);
glVertex3f(p->position[0] + (rx + ux),
p->position[1] + (ry + uy),
p->position[2] + (rz + uz));
glTexCoord2f(0.0f, 0.0f);
glVertex3f(p->position[0] + (ux - rx),
p->position[1] + (uy - ry),
p->position[2] + (uz - rz));
glEnd();
you could speed that up a lot if you just packed the data into an array
and used vertex arrays
I don't see any glEnable(GL_CULL_FACE) calls. The default value is false for GL_CULL_FACE so you must be rendering both sides of surfaces, which will affect the fill rate, and generally slow things down.
I very much like the idea of block based system you have. I'd probably make a display list out of each re-usable block. So if you had a 1000 blocks you'd have 1000 calls to draw display lists, which is perfectly acceptable. But I would also sort the blocks by type, or more importantly by texture ID. So that you don't have to switch textures for each block. You'll get a good speed up doing this.
Maybe some sort of culling system would be more important for the physics engine ?