I am new to open Gl so i downloaded a C# opengl code and tried to change it by deleting all the draw triangles codes and changed it to draw line codes. The output remains empty (black screen) after compiling the code.
I am trying to plot EEG signals with open gl but I cannot even plot a simple line. Please help.
Can someone tell me what I am doing wrong?
Any help is appreciated.
The code is:
public Form1()
{
InitializeComponent();
int height = simpleOpenGlControl1.Height;
int width = simpleOpenGlControl1.Width;
simpleOpenGlControl1.InitializeContexts();
Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
Gl.glMatrixMode(Gl.GL_PROJECTION);
Gl.glLoadIdentity();
Glu.gluPerspective(45.0f, (double)width / (double)height, 0.01f, 5000.0f);
}
private void simpleOpenGlControl1_Paint(object sender, PaintEventArgs e) // OnPaint event
{
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); //clear buffers to preset values
Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glLoadIdentity(); // load the identity matrix
Gl.glBegin(Gl.GL_LINE);
Gl.glVertex3f(0.0f, 0.0f,0.0f);
Gl.glVertex3f(5.0f, 5.0f, 0.0f);
Gl.glEnd();
}