Skip to content

Instantly share code, notes, and snippets.

@ulmangt
Created January 21, 2016 17:10
Show Gist options
  • Save ulmangt/054bedbf8972bdeb6a24 to your computer and use it in GitHub Desktop.
Save ulmangt/054bedbf8972bdeb6a24 to your computer and use it in GitHub Desktop.
package com.metsci.glimpse.examples.basic;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import com.metsci.glimpse.axis.Axis2D;
import com.metsci.glimpse.context.GlimpseBounds;
import com.metsci.glimpse.examples.Example;
import com.metsci.glimpse.painter.shape.LineSetPainter;
import com.metsci.glimpse.plot.Plot2D;
import com.metsci.glimpse.support.color.GlimpseColor;
public class BlendTest
{
public static void main( String[] args ) throws Exception
{
Example example = Example.showWithSwing( new EmptyPlotExample( ) );
LineSetPainter lp = new LineSetPainter( false )
{
@Override
public void paintTo( GL2 gl, GlimpseBounds bounds, Axis2D axis )
{
gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE );
gl.glEnable( GL2.GL_BLEND );
super.paintTo( gl, bounds, axis );
}
};
lp.setData( new float[] { 0, 100, 500, 1000 }, new float[] { 0, 100, 0, 1000 } );
lp.setLineColor( GlimpseColor.getWhite( 0.5f ) );
// nothing appears with this blencFunc when using black
//lp.setLineColor( GlimpseColor.getBlack( 0.5f ) );
lp.setLineWidth( 5.0f );
( ( Plot2D ) example.getLayout( ) ).getLayoutCenter( ).addPainter( lp );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment