Points and colors

I have a textured polygon 3d engine and I want to add a particle system… The particles struct have all the usual info…at the moment Iam using glbegin(GL_POINTS) to draw the particles in the scene, the problem is the colors of the points are not what I assigned the particles.
They are coming out all the same color. I’m obviously doing somethig wrong!!! HELP!!!

Source code would be helpful.

openGL tracks the current color based on what it was last set to, so if you need to set the desired color right before you draw the point.

ie glColor3f(1.0, 0.0, 0.0);
glBegin(GL_POINTS);
//points data
glEnd();
glColor3f(…);

if you dont set the color in or right before calling the partical function, or you are generating the particles in a display list, they will come out as either the list defined color or the last color used in your program.

Hope this helps.

Nate

Another problem can be that you have texturing enabled. If this is the case, the point will be texturemapped, and with some special (not too special in fact) settings when you create your textures, colors will be “discarded”.

Yet another problem can be lightning. Make sure lightnign is disabled, or pass colors via the material-functions.

If it is the lighting thing, you can step around this using color tracking, which I think is enabled/disabled using

glEnable(GL_COLOR_MATERIAL);

This will track the current color and use that in place of the specified material by default.

You can also change which of the Diffuse, Ambient and Specular properties of the material are color tracked using

glColorMaterial(GLenum face, GLenum mode);

A full list of the enum values should be in the opengl.hlp package with Borland or MSVC++, or email me and I will send you over a copy of the file if you don’t have it.

Hope this helps some more

Nate

Thanks to all… the problem is with the texture mappping and lighting affecting the points…I now have some possible work arounds…Thanks again …