From e8b811bab7fd8293c497a33f83e1aedf1d883b1d Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Wed, 29 Mar 2017 18:43:13 -0400 Subject: [PATCH] kicad-ogltest: use OPENGL_GAL --- utils/kicad-ogltest/CMakeLists.txt | 12 ++++++++++-- utils/kicad-ogltest/kicad-ogltest.cpp | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/utils/kicad-ogltest/CMakeLists.txt b/utils/kicad-ogltest/CMakeLists.txt index 394fc31bbf..7e662f7133 100644 --- a/utils/kicad-ogltest/CMakeLists.txt +++ b/utils/kicad-ogltest/CMakeLists.txt @@ -5,7 +5,10 @@ include_directories( BEFORE ${Boost_INCLUDE_DIR} ) -include_directories( SYSTEM +include_directories( + ../../include + ../../common + ${INC_AFTER} ) set( OGLTEST_FILES @@ -14,7 +17,12 @@ set( OGLTEST_FILES add_executable( kicad-ogltest ${OGLTEST_FILES} ) -target_link_libraries( kicad-ogltest ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ) +target_link_libraries( kicad-ogltest + gal + common + bitmaps + polygon + ${wxWidgets_LIBRARIES} ) if( APPLE ) # puts binaries into the *.app bundle while linking diff --git a/utils/kicad-ogltest/kicad-ogltest.cpp b/utils/kicad-ogltest/kicad-ogltest.cpp index 8eacab6ba9..eb0a8cba73 100644 --- a/utils/kicad-ogltest/kicad-ogltest.cpp +++ b/utils/kicad-ogltest/kicad-ogltest.cpp @@ -27,9 +27,9 @@ #include #include #include -#include #include #include +#include #include // Required OpenGL version @@ -41,6 +41,9 @@ static wxRegEx OGLVersionRegex( R"(^(\d+)\.(\d+))", wxRE_ADVANCED ); static const int glAttributes[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 8, 0 }; +void Pgm() {} + + class OGLTEST_APP : public wxApp { public: @@ -78,11 +81,17 @@ bool OGLTEST_APP::OnInit() auto frame = new wxFrame( nullptr, wxID_ANY, "OpenGL test", wxDefaultPosition, wxDefaultSize, wxTOPLEVEL_EX_DIALOG ); - auto canvas = new wxGLCanvas( frame, wxID_ANY, &glAttributes[0] ); + + KIGFX::GAL_DISPLAY_OPTIONS gal_opts; + + auto canvas = new KIGFX::OPENGL_GAL( gal_opts, frame ); auto context = new wxGLContext( canvas ); + frame->Raise(); frame->Show(); canvas->SetCurrent( *context ); + auto size = canvas->GetSize(); + canvas->ResizeScreen( size.GetWidth(), size.GetHeight() ); printf( "INFO: Instantiated GL window\n" ); @@ -121,6 +130,10 @@ bool OGLTEST_APP::OnInit() printf( "INFO: Found OpenGL version %ld.%ld\n", major, minor ); } + canvas->BeginDrawing(); + printf( "INFO: Successfully called OPENGL_GAL::BeginDrawing\n" ); + canvas->EndDrawing(); + bool supported = wxGLCanvas::IsDisplaySupported( &glAttributes[0] ); if( supported )