Line Thickness
Line thickness cannot be changed inside a begin end block
#include
"stdafx.h"
#include
<GL/glut.h>
void
init()
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
void
display()
{
glClear
(GL_COLOR_BUFFER_BIT);
glColor3f
(1.0, 0.0, 0.0);
glLineWidth(8.0f);
glBegin(GL_LINES);
for
(double x = 100; x<600;x=x+100)
{
glVertex2f(100, x);
glVertex2f(400.0f, x);
}
glEnd( );
glFlush
();
//forces previously issued commands to execute
}
void
reshape (int w,
int h)
{
glViewport
(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluOrtho2D
(0.0, (GLdouble) w, 0.0, (GLdouble) h);
}
int
main(int argc,
char** argv)
//Because of glut, parameters are
necessary
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
// | means or
glutInitWindowSize (600, 600);
//set window size in pixels
glutInitWindowPosition (100,100);
//set window position
glutCreateWindow (argv[0]);
//create above window
init ();
//call init function
glutDisplayFunc(display);
//etc.
glutReshapeFunc(reshape);
glutMainLoop();
//must be last line of code - starts
things
return
0;
}