im making a particle engine(i just started)
and here is my codenote: its not near done, i jsut started 5 minutes ago)
but when i run initall in my initogl function it makes all my textures a solid color!Code :struct particle { GLfloat x; GLfloat y; GLfloat r; GLfloat g; GLfloat b; GLfloat xspeed; GLfloat yspeed; bool live; }; particle particles[1000]; void initall() { for(int i = 0; i <= 1000; i++) { particles[i].x = rand() % 102400; particles[i].x = particles[i].x * 0.01f; particles[i].r = rand() % 100; particles[i].r = particles[i].r * 0.01f; particles[i].g = rand() % 100; particles[i].g = particles[i].g * 0.01f; particles[i].b = rand() % 100; particles[i].b = particles[i].b * 0.01f; particles[i].xspeed = rand() % 50; particles[i].xspeed = particles[i].xspeed * 0.01f; particles[i].yspeed = rand() % 100; particles[i].yspeed = particles[i].yspeed * 0.01f; particles[i].live = true; } } void initentity(int i) { particles[i].x = rand() % 102400; particles[i].x = particles[i].x * 0.01f; particles[i].r = rand() % 100; particles[i].r = particles[i].r * 0.01f; particles[i].g = rand() % 100; particles[i].g = particles[i].g * 0.01f; particles[i].b = rand() % 100; particles[i].b = particles[i].b * 0.01f; particles[i].xspeed = rand() % 50; particles[i].xspeed = particles[i].xspeed * 0.01f; particles[i].yspeed = rand() % 100; particles[i].yspeed = particles[i].yspeed * 0.01f; particles[i].live = true; }
im guessing this is a memory problem, but how do i fix it????