Skip to content
Snippets Groups Projects
Commit 47284d20 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

add HAVE_OPENGL to enable GL-dependent (but FLTK/Qt-independent)

stuff, like plugin drawing
parent 72c53544
No related branches found
No related tags found
No related merge requests found
...@@ -350,6 +350,8 @@ if(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS) ...@@ -350,6 +350,8 @@ if(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS)
endif(HAVE_LIBZ) endif(HAVE_LIBZ)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
add_subdirectory(Graphics) add_subdirectory(Graphics)
set(HAVE_OPENGL TRUE)
list(APPEND CONFIG_OPTIONS "OpenGL")
endif(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS) endif(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS)
if(ENABLE_ANN) if(ENABLE_ANN)
...@@ -651,7 +653,7 @@ endif(HAVE_LAPACK AND LAPACK_FLAGS) ...@@ -651,7 +653,7 @@ endif(HAVE_LAPACK AND LAPACK_FLAGS)
if(HAVE_FLTK) if(HAVE_FLTK)
target_link_libraries(shared ${FLTK_LIBRARIES} ${EXTERNAL_LIBRARIES} target_link_libraries(shared ${FLTK_LIBRARIES} ${EXTERNAL_LIBRARIES}
${OPENGL_LIBRARIES} ${LAPACK_LIBRARIES}) ${OPENGL_LIBRARIES} ${LAPACK_LIBRARIES})
elseif(ENABLE_GRAPHICS) elseif(HAVE_OPENGL)
target_link_libraries(shared ${EXTERNAL_LIBRARIES} ${OPENGL_LIBRARIES} target_link_libraries(shared ${EXTERNAL_LIBRARIES} ${OPENGL_LIBRARIES}
${LAPACK_LIBRARIES}) ${LAPACK_LIBRARIES})
else(HAVE_FLTK) else(HAVE_FLTK)
...@@ -668,6 +670,10 @@ elseif(HAVE_QT) ...@@ -668,6 +670,10 @@ elseif(HAVE_QT)
add_executable(gmsh WIN32 Qt/Main.cpp ${GMSH_SRC} ${GMSH_MOC_SRC}) add_executable(gmsh WIN32 Qt/Main.cpp ${GMSH_SRC} ${GMSH_MOC_SRC})
target_link_libraries(gmsh ${QT_LIBRARIES} ${EXTERNAL_LIBRARIES} target_link_libraries(gmsh ${QT_LIBRARIES} ${EXTERNAL_LIBRARIES}
${OPENGL_LIBRARIES} ${LAPACK_LIBRARIES}) ${OPENGL_LIBRARIES} ${LAPACK_LIBRARIES})
elseif(HAVE_OPENGL)
add_executable(gmsh Common/Main.cpp ${GMSH_SRC})
target_link_libraries(gmsh ${EXTERNAL_LIBRARIES} ${OPENGL_LIBRARIES}
${LAPACK_LIBRARIES})
else(HAVE_FLTK) else(HAVE_FLTK)
add_executable(gmsh Common/Main.cpp ${GMSH_SRC}) add_executable(gmsh Common/Main.cpp ${GMSH_SRC})
target_link_libraries(gmsh ${EXTERNAL_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries(gmsh ${EXTERNAL_LIBRARIES} ${LAPACK_LIBRARIES})
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <string.h> #include <string.h>
#include "GmshConfig.h" #include "GmshConfig.h"
#include "Context.h" #include "Context.h"
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
#include <FL/Fl.H> #include <FL/Fl.H>
#endif #endif
......
...@@ -11,8 +11,11 @@ ...@@ -11,8 +11,11 @@
#include "Context.h" #include "Context.h"
#include "Options.h" #include "Options.h"
#if defined(HAVE_OPENGL)
#include "drawContext.h"
#endif
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
#include <FL/gl.h>
#include "FlGui.h" #include "FlGui.h"
#include "graphicWindow.h" #include "graphicWindow.h"
#include "gl2ps.h" #include "gl2ps.h"
...@@ -418,7 +421,7 @@ void CreateOutputFile(std::string fileName, int format) ...@@ -418,7 +421,7 @@ void CreateOutputFile(std::string fileName, int format)
CTX::instance()->print.format = oldformat; CTX::instance()->print.format = oldformat;
CTX::instance()->printing = 0; CTX::instance()->printing = 0;
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
drawContext::global()->draw(); drawContext::global()->draw();
#endif #endif
} }
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#cmakedefine HAVE_NO_VSNPRINTF #cmakedefine HAVE_NO_VSNPRINTF
#cmakedefine HAVE_OCC #cmakedefine HAVE_OCC
#cmakedefine HAVE_OCC_MESH_CONSTRAINTS #cmakedefine HAVE_OCC_MESH_CONSTRAINTS
#cmakedefine HAVE_OPENGL
#cmakedefine HAVE_OSMESA #cmakedefine HAVE_OSMESA
#cmakedefine HAVE_QT #cmakedefine HAVE_QT
#cmakedefine HAVE_TAUCS #cmakedefine HAVE_TAUCS
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>. // bugs and problems to <gmsh@geuz.org>.
#include <FL/gl.h>
#include "openglWindow.h" #include "openglWindow.h"
#include "graphicWindow.h" #include "graphicWindow.h"
#include "manipWindow.h" #include "manipWindow.h"
......
This diff is collapsed.
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "PluginManager.h" #include "PluginManager.h"
#endif #endif
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -2224,7 +2224,6 @@ Command : ...@@ -2224,7 +2224,6 @@ Command :
Msg::StatusBar(2, true, "Read '%s'", tmpstring); Msg::StatusBar(2, true, "Read '%s'", tmpstring);
} }
else if(!strcmp($1, "Print")){ else if(!strcmp($1, "Print")){
#if defined(HAVE_FLTK)
// make sure we have the latest data from GEO_Internals in GModel // make sure we have the latest data from GEO_Internals in GModel
// (fixes bug where we would have no geometry in the picture if // (fixes bug where we would have no geometry in the picture if
// the print command is in the same file as the geometry) // the print command is in the same file as the geometry)
...@@ -2232,15 +2231,12 @@ Command : ...@@ -2232,15 +2231,12 @@ Command :
char tmpstring[1024]; char tmpstring[1024];
FixRelativePath($2, tmpstring); FixRelativePath($2, tmpstring);
CreateOutputFile(tmpstring, CTX::instance()->print.format); CreateOutputFile(tmpstring, CTX::instance()->print.format);
#endif
} }
else if(!strcmp($1, "Save")){ else if(!strcmp($1, "Save")){
#if defined(HAVE_FLTK)
GModel::current()->importGEOInternals(); GModel::current()->importGEOInternals();
char tmpstring[1024]; char tmpstring[1024];
FixRelativePath($2, tmpstring); FixRelativePath($2, tmpstring);
CreateOutputFile(tmpstring, CTX::instance()->mesh.format); CreateOutputFile(tmpstring, CTX::instance()->mesh.format);
#endif
} }
else if(!strcmp($1, "Merge") || !strcmp($1, "MergeWithBoundingBox")){ else if(!strcmp($1, "Merge") || !strcmp($1, "MergeWithBoundingBox")){
// MergeWithBoundingBox is deprecated // MergeWithBoundingBox is deprecated
...@@ -2366,7 +2362,7 @@ Command : ...@@ -2366,7 +2362,7 @@ Command :
} }
| tDraw tEND | tDraw tEND
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
drawContext::global()->draw(); drawContext::global()->draw();
#endif #endif
} }
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#include "Annotate.h" #include "Annotate.h"
#include "Context.h" #include "Context.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include <FL/gl.h>
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -39,7 +38,7 @@ extern "C" ...@@ -39,7 +38,7 @@ extern "C"
static double getStyle() static double getStyle()
{ {
int fontsize = (int)AnnotateOptions_Number[4].def, font = 0, align = 0; int fontsize = (int)AnnotateOptions_Number[4].def, font = 0, align = 0;
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
font = drawContext::global()->getFontIndex font = drawContext::global()->getFontIndex
(AnnotateOptions_String[1].def.c_str()); (AnnotateOptions_String[1].def.c_str());
align = drawContext::global()->getFontAlign align = drawContext::global()->getFontAlign
...@@ -50,7 +49,7 @@ static double getStyle() ...@@ -50,7 +49,7 @@ static double getStyle()
void GMSH_AnnotatePlugin::draw(void *context) void GMSH_AnnotatePlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
double X = AnnotateOptions_Number[0].def; double X = AnnotateOptions_Number[0].def;
double Y = AnnotateOptions_Number[1].def; double Y = AnnotateOptions_Number[1].def;
double Z = AnnotateOptions_Number[2].def; double Z = AnnotateOptions_Number[2].def;
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#include "CutGrid.h" #include "CutGrid.h"
#include "Context.h" #include "Context.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include <FL/gl.h>
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -39,7 +38,7 @@ extern "C" ...@@ -39,7 +38,7 @@ extern "C"
void GMSH_CutGridPlugin::draw(void *context) void GMSH_CutGridPlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
glColor4ubv((GLubyte *) & CTX::instance()->color.fg); glColor4ubv((GLubyte *) & CTX::instance()->color.fg);
double p[3]; double p[3];
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#include "Context.h" #include "Context.h"
#include "mathEvaluator.h" #include "mathEvaluator.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include <FL/gl.h>
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -81,7 +80,7 @@ int GMSH_CutParametricPlugin::fillXYZ() ...@@ -81,7 +80,7 @@ int GMSH_CutParametricPlugin::fillXYZ()
void GMSH_CutParametricPlugin::draw(void *context) void GMSH_CutParametricPlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
if(recompute){ if(recompute){
fillXYZ(); fillXYZ();
recompute = 0; recompute = 0;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "CutPlane.h" #include "CutPlane.h"
#include "Context.h" #include "Context.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -34,7 +34,7 @@ extern "C" ...@@ -34,7 +34,7 @@ extern "C"
void GMSH_CutPlanePlugin::draw(void *context) void GMSH_CutPlanePlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
int num = (int)CutPlaneOptions_Number[7].def; int num = (int)CutPlaneOptions_Number[7].def;
drawContext *ctx = (drawContext*)context; drawContext *ctx = (drawContext*)context;
if(num < 0) num = iview; if(num < 0) num = iview;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "CutSphere.h" #include "CutSphere.h"
#include "Context.h" #include "Context.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -32,7 +32,7 @@ extern "C" ...@@ -32,7 +32,7 @@ extern "C"
void GMSH_CutSpherePlugin::draw(void *context) void GMSH_CutSpherePlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
GLint mode[2]; GLint mode[2];
glGetIntegerv(GL_POLYGON_MODE, mode); glGetIntegerv(GL_POLYGON_MODE, mode);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
#include "GmshConfig.h" #include "GmshConfig.h"
#include "Plugin.h" #include "Plugin.h"
#include "Context.h" #include "Context.h"
#if defined(HAVE_FLTK)
#if defined(HAVE_OPENGL)
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -16,7 +17,7 @@ void (*GMSH_Plugin::draw)(void*) = 0; ...@@ -16,7 +17,7 @@ void (*GMSH_Plugin::draw)(void*) = 0;
void GMSH_Plugin::setDrawFunction(void (*fct)(void *)) void GMSH_Plugin::setDrawFunction(void (*fct)(void *))
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
draw = fct; draw = fct;
int old = CTX::instance()->drawBBox; int old = CTX::instance()->drawBBox;
CTX::instance()->drawBBox = 1; CTX::instance()->drawBBox = 1;
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#include "Context.h" #include "Context.h"
#include "OctreePost.h" #include "OctreePost.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include <FL/gl.h>
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -32,7 +31,7 @@ extern "C" ...@@ -32,7 +31,7 @@ extern "C"
void GMSH_ProbePlugin::draw(void *context) void GMSH_ProbePlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
int num = (int)ProbeOptions_Number[3].def; int num = (int)ProbeOptions_Number[3].def;
if(num < 0) num = iview; if(num < 0) num = iview;
if(num >= 0 && num < (int)PView::list.size()){ if(num >= 0 && num < (int)PView::list.size()){
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
#include "Context.h" #include "Context.h"
#include "PViewOptions.h" #include "PViewOptions.h"
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
#include <FL/gl.h>
#include "drawContext.h" #include "drawContext.h"
#endif #endif
...@@ -44,7 +43,7 @@ extern "C" ...@@ -44,7 +43,7 @@ extern "C"
void GMSH_StreamLinesPlugin::draw(void *context) void GMSH_StreamLinesPlugin::draw(void *context)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_OPENGL)
glColor4ubv((GLubyte *) & CTX::instance()->color.fg); glColor4ubv((GLubyte *) & CTX::instance()->color.fg);
drawContext *ctx = (drawContext*)context; drawContext *ctx = (drawContext*)context;
double p[3]; double p[3];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment