How do I smooth a line in glgraphics?
in
Contributed Library Questions
•
1 year ago
Hello!
This is my first programming for processing, am using it for a graduate course project. I am doing a map visualization, working with Unfolding. It relies on glgraphics, which I am having a hard time wrapping my head around (I've done a good bit of programming, none in graphics).
What I am trying to do is smooth a line (and in the future 2D circles) using glgraphics. I've ended up with this example which I thought would work, and while it draws a line, it doesn't smooth it.
This is my first programming for processing, am using it for a graduate course project. I am doing a map visualization, working with Unfolding. It relies on glgraphics, which I am having a hard time wrapping my head around (I've done a good bit of programming, none in graphics).
What I am trying to do is smooth a line (and in the future 2D circles) using glgraphics. I've ended up with this example which I thought would work, and while it draws a line, it doesn't smooth it.
- import processing.opengl.*;
import codeanticode.glgraphics.*;
import javax.media.opengl.GL;
GL gl;
GLGraphics renderer;
void setup()
{
height = 768;
width = 1024;
size(width, height, GLConstants.GLGRAPHICS);
renderer = (GLGraphics)g;
gl = renderer.gl;
gl.glHint(gl.GL_LINE_SMOOTH_HINT, gl.GL_DONT_CARE);
}
void draw()
{
gl.glEnable (gl.GL_LINE_SMOOTH);
renderer.noLights();
renderer.beginGL();
gl.glLineWidth(4.0);
gl.glBegin(gl.GL_LINES);
gl.glColor3f(0,0,0);
gl.glVertex2f(0,0);
gl.glColor3f(0,0,1);
gl.glVertex2f(width,height);
gl.glVertex2f(300,4);
gl.glEnd();
renderer.endGL();
gl.glDisable (gl.GL_LINE_SMOOTH);
}
Does anyone have advice on what I should do to get this working?
Thanks so much!
Thanks so much!
1