I’m drawing some points in OpenGL (JOGL) as follows:
BufferedImage image = loadMyTextureImage();
Texture tex = TextureIO.newTexture(image, false);
tex.setTexParameteri(GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
tex.setTexParameteri(GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
tex.bind();
gl.glColor4f(r,g,b,a);
gl.glBegin(GL_POINTS);
for ( int i = 0; i < numPoints; i++ ) {
// compute x,y,z
gl.glVertex3f(x,y,z);
}
gl.glEnd();
My image is a white image, so I can reuse that same texture and just color it using gl.glColor4f, but I would like to draw an outline around it in a different color. Is there a way to do that?
If you’re using the texture to determine the shape of the point, then the obvious way to do the outline would be to add a second texture to draw the outline of the point on top.
The outline texture would also be white, so you could colour it to any colour you like in the same way.
Depending on the alpha-blending mode you use, this can also be used to give a “glowing” edge effect.