Changeset c293aa9 in git


Ignore:
Timestamp:
13/09/11 12:33:53 (8 years ago)
Author:
Olly Betts <olly@…>
Branches:
add-show-splays, line_contents, master, stereo, svn/github/master, svn/origin/master, svn/tags/1.2.0, svn/tags/1.2.1, svn/tags/1.2.2, svn/tags/1.2.3, svn/tags/1.2.4, svn/tags/1.2.5, svn/trunk, travis-osx
Children:
d1c3d24
Parents:
091069f
Message:

src/aven.cc,src/aven.h,src/gla-gl.cc: Explicitly request
double-buffering, which seems to be needed for systems with GLX >=
1.3. Report GLX version and whether double-buffering is in use in
the about dialog.

git-svn-id: file:///home/survex-svn/survex/trunk@3623 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r091069f rc293aa9  
     1Tue Sep 13 11:32:18 GMT 2011  Olly Betts <olly@survex.com>
     2
     3        * src/aven.cc,src/aven.h,src/gla-gl.cc: Explicitly request
     4          double-buffering, which seems to be needed for systems with GLX >=
     5          1.3.  Report GLX version and whether double-buffering is in use in
     6          the about dialog.
     7
    18Sun Jun 19 11:19:51 GMT 2011  Olly Betts <olly@survex.com>
    29
  • src/aven.cc

    r091069f rc293aa9  
    4343#include <wx/display.h>
    4444#endif
     45
     46bool double_buffered = false;
    4547
    4648static const struct option long_opts[] = {
     
    198200    }
    199201
    200     if (!InitGLVisual(NULL)) {
    201         wxString m;
    202         m.Printf(wmsg(/*This version of %s requires OpenGL to work, but it isn't available*/405), APP_NAME);
    203         wxMessageBox(m, APP_NAME, wxOK | wxCENTRE | wxICON_EXCLAMATION);
    204         exit(1);
     202    // Use a double-buffered visual if available, as it will give much smoother
     203    // animation.
     204    double_buffered = true;
     205    int wx_gl_attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
     206    if (!InitGLVisual(wx_gl_attribs)) {
     207        int wx_gl_attribs_no_db[] = { WX_GL_RGBA, 0 };
     208        if (!InitGLVisual(wx_gl_attribs_no_db)) {
     209            wxString m;
     210            m.Printf(wmsg(/*This version of %s requires OpenGL to work, but it isn't available*/405), APP_NAME);
     211            wxMessageBox(m, APP_NAME, wxOK | wxCENTRE | wxICON_EXCLAMATION);
     212            exit(1);
     213        }
     214        double_buffered = false;
    205215    }
    206216
  • src/aven.h

    r091069f rc293aa9  
    8080class MainFrm;
    8181
     82extern bool double_buffered;
     83
    8284class Aven : public wxGLApp {
    8385    MainFrm * m_Frame;
  • src/gla-gl.cc

    r091069f rc293aa9  
    105105    info += '\n';
    106106    info += (const char*)glGetString(GL_RENDERER);
    107     info += '\n';
     107    info += string_format("\nGLX %0.1f\n", wxGLCanvas::GetGLXVersion() * 0.1);
    108108
    109109    GLint red, green, blue;
     
    133133                              point_size_range[0], point_size_range[1]);
    134134    }
     135
     136    info += "\nDouble buffered: ";
     137    if (double_buffered)
     138        info += "true";
     139    else
     140        info += "false";
    135141
    136142    const GLubyte* gl_extensions = glGetString(GL_EXTENSIONS);
     
    795801    // Complete a redraw operation.
    796802
    797 //    glFlush();
    798 //    CHECK_GL_ERROR("FinishDrawing", "glFlush");
    799     SwapBuffers();
     803    if (double_buffered) {
     804        SwapBuffers();
     805    } else {
     806        glFlush();
     807        CHECK_GL_ERROR("FinishDrawing", "glFlush");
     808    }
    800809}
    801810
Note: See TracChangeset for help on using the changeset viewer.