PDA

View Full Version : Particle Colours



08-09-2000, 07:59 AM
Hi,

I am having huge trouble with colouring particles. The system works just how i want it to but the particles colours are wrong. They pick up the colour of a nearby object rather than the glColour3f(....) i have next to the call that draws them on screen.

Anyone have any idea why???

Marc

subpoposaur
08-09-2000, 08:31 AM
OK, it could be a bunch of things.

Firstly, are you using glMaterial?? If you are, the particals will show up as the material * lightcolor.

You can either disable lighting before drawing the particle or enable GL_COLOR_MATERAL to track the current glColor color to the particle.

Secondly, do you have texturing enabled?? If you do, the program may be canning your color settings in place of the current texture. Probably not, but worth checking none the less.

So that could be a couple of solutions. Failing that, post the code segment for the particle rendering....makes it easier to debug if you can see it.

Hope this helps

Nate


Originally posted by MarcUK:
Hi,

I am having huge trouble with colouring particles. The system works just how i want it to but the particles colours are wrong. They pick up the colour of a nearby object rather than the glColour3f(....) i have next to the call that draws them on screen.

Anyone have any idea why???

Marc



[This message has been edited by subpoposaur (edited 08-09-2000).]

08-10-2000, 07:28 AM
here is the segment that draws my particles. However they still are coloured blue, the same colour as a nearby objest (actually a wave hitting a quayside) here i have used red, but actually they need to be white... i was trying to see if i could change the colour.

I am using texturing, but it shouldn't be affecting these particles + texture is brown. im not using glMaterial.

?????????

if(particlesActive == 1){
glEnable(GL_BLEND);
glBegin(GL_POINTS);

for (i=0; i<numPoints; i++) {
/* Draw alive particles. */
if (colorList[i] != DEAD) {
glColor3f(1.0, 0.0, 0.0);
glVertex3fv(pointList[i]);
}
}
glDisable(GL_BLEND);
glEnd();}

DFrey
08-10-2000, 08:05 AM
I see you have enabled blending. What blending function are you using? Also you say you are using a texture, but I don't see you specifying any texture coordinates. If these particles are to use textures then they need texture coordinates. If they are not to be textured, then make sure you have texturing disabled. Also that glDisable(GL_BLEND) should come after the glEnd().

[This message has been edited by DFrey (edited 08-10-2000).]

08-10-2000, 08:12 AM
Blending function is

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

i am using texturing but not for the particles. In fact only one tiny bit of my scene is being textured, and texturing is enabled and disabled for it specifically.

however it is still the colour of the nearby object they pick up and nothing remotly related to the texture.

DFrey
08-10-2000, 10:28 AM
Ok, this is interesting, you are using alpha blending, but you are leaving the particles' alpha value to default to 1. Making alpha blending ineffective. That's not going to stop them from having the correct color in your case though. Did you move that glDisable yet? I suspect that is the problem. If you moved it, and the particles are still the wrong color, then I would suspect lighting is the culprit.