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 4 of 4

Thread: OpenGL rendering without DISPLAY

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2009
    Location
    Germany
    Posts
    2

    OpenGL rendering without DISPLAY

    Hi,

    I am using OpenGL almost 10 years for scientific data visualization of many (millions) of triangles and it is operated in our C home made sources via

    glBegin(...); glVertex3fv(...); glEnd();

    All development is going on Linux, right now we are using Ubuntu.

    Now I meet an interesting problem that I wish to ask you to help.

    I would like to draw my object without opening X Window, and save the result in the PPM/JPG data. I used glReadPixels(...) to grab pictures, but it works only if I have X Window.

    My program will work as http server and produce nice scientific pictures after http request, so, I need to do everything without opening X Window.

    Please, advice em how to do it (if it is ever possible). A simple example of OpenGL initialization and dumping would be very appreciated.

    Thank you

    Ilgis
    Elegant Mathematics Ltd.
    Hanauer Muehle 2
    66564 Ottweiler
    Germany

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: OpenGL rendering without DISPLAY


  3. #3
    Junior Member Newbie
    Join Date
    Aug 2009
    Location
    Germany
    Posts
    2

    Re: OpenGL rendering without DISPLAY

    Dear Martinsm,

    thank you very much for your kind help. It works! Just normal mesa works ok, I cannot link glut functions from the demo/osmesa.c example, but I do not need them really.

    Sincerely,

    Ilgis
    Elegant Mathematics Ltd.
    Hanauer Muehle 2
    66564 Ottweiler
    Germany

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: OpenGL rendering without DISPLAY

    Or, make a invisble GL window and then make a FBO for rendering.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

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