View Full Version : output form is empty need help

08-17-2013, 09:57 AM
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()

int height = simpleOpenGlControl1.Height;
int width = simpleOpenGlControl1.Width;

Gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

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.glLoadIdentity(); // load the identity matrix
Gl.glVertex3f(0.0f, 0.0f,0.0f);
Gl.glVertex3f(5.0f, 5.0f, 0.0f);

carsten neumann
08-17-2013, 01:21 PM
You are probably drawing outside the view furstum. If your eye position is in the origin and with your near/far values you will only see objects that have a world space z coordinate in [-0.01, -5000]. Try drawing your line at z = -10 or so.