Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: output form is empty need help

  1. #1
    Newbie Newbie
    Join Date
    Aug 2013
    Posts
    1

    Post output form is empty need help

    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();
    }

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    791
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •