Glowing particles opengl

619 Views Asked by At

My particles are not glowing. I searched on the internet that its been done with

glBlendFunc(GL_SRC_ALPHA, GL_ONE);

This piece of code changes my particles, but it is not glowing. Can anybody see what is wrong in my code? Here are the relevant codes:

void init (void) {
    glEnable (GL_LIGHTING); //enable the lighting
    glEnable (GL_LIGHT0); //enable LIGHT0, our Diffuse Light
    glEnable (GL_LIGHT1); //enable LIGHT1, our Ambient Light
    glEnable(GL_BLEND);
 //   glEnable(GL_DEPTH);

  //  glEnable(GL_COLOR_MATERIAL);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);

}

void update()
{
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glRotatef(g_orientation, 0.0, 1.0, 0.0); // rotate in y axis
    glTranslatef(-g_posX, -g_posY, -g_posZ);

    glClear(GL_COLOR_BUFFER_BIT);
    glClear(GL_DEPTH_BUFFER_BIT);

    GLfloat DiffuseLight[] = {dlr, dlg, dlb}; //set DiffuseLight[] to the specified values
    GLfloat AmbientLight[] = {alr, alg, alb}; //set AmbientLight[] to the specified values
    glLightfv (GL_LIGHT0, GL_DIFFUSE, DiffuseLight); //change the light accordingly
    glLightfv (GL_LIGHT1, GL_AMBIENT, AmbientLight); //change the light accordingly
    GLfloat LightPosition[] = {lx, ly, lz, lw}; //set the LightPosition to the specified values
    glLightfv (GL_LIGHT0, GL_POSITION, LightPosition); //change the light accordingly
    glColorMaterial(GL_FRONT,GL_DIFFUSE);
    drawRockets();
    if(explosion == true){
        drawParticles();
    }
    drawMolen();
    glutSwapBuffers();
    if(rotate==1)
        angle++;
}

//commonly used material values
GLfloat no_mat[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat default_ambient[] = {0.2, 0.2, 0.2, 1.0};
GLfloat mat_ambient[] = { 0.7, 0.7, 0.7, 1.0 };
GLfloat mat_ambient_color[] = { 0.8, 0.8, 0.2, 1.0 };
GLfloat mat_diffuse[] = { 0.1, 0.5, 0.8, 1.0 };
GLfloat default_diffuse[] = {0.8, 0.8, 0.8, 1.0};
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat no_shininess[] = { 0.0 };
GLfloat low_shininess[] = { 5.0 };
GLfloat high_shininess[] = { 100.0 };
GLfloat mat_emission[] = {0.3, 0.5, 0.9, 0.0};
GLfloat mat_emission1[] = {0.0, 1.0, 0.2, 1.0};
GLfloat mat_emission2[] = {0.0, 0.0, 1.0, 0.0};
GLfloat mat_emission3[] = {1.0, 1.0, 0.0, 0.0};

Here is another example how I want my glutsolidspheres to be: Ball of Light (Light, Material?) glutsolidsphere

0

There are 0 best solutions below