0

I'm new with OpenGL and I'm a little stuck with the blending. I'm using java and the lwjgl.

The result I want is a set of different textures with their alpha channel. I did this already and I have no problem. But then I want to add points with GL_POINTS, and I always get black points, no matter what my glColor3f parameters are. I think it could be a blending problem.

For the textures I use glEnable(GL_BLEND) and then glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). As I said, it works well.

For the points I use glBlendFunc(GL_ONE_MINUS_SRC_COLOR, GL_SRC_COLOR).

public void drawPoint() {

  ...

  GL11.glColor3f(1, 0, 0);

  GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_COLOR, GL11.GL_SRC_COLOR);

  GL11.glPointSize(3.0f);

  GL11.glBegin(GL11.GL_POINTS);

    GL11.glVertex2f(x, y);

  GL11.glEnd();

  GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

I expect a red point of size 3 in (x, y), but I get a black point of size 3 in (x, y).

It's a blending problem? If so, how am I supposed to make the blending?

Thanks in advance!

0 Answers0