Select Git revision
drawContext.cpp
Forked from
gmsh / gmsh
Source project has a limited visibility.
drawContext.cpp 31.41 KiB
// Gmsh - Copyright (C) 1997-2013 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@geuz.org>.
#include <string>
#include <stdio.h>
#include "Gmsh.h"
#include "GmshConfig.h"
#include "GmshMessage.h"
#include "drawContext.h"
#include "Trackball.h"
#include "Context.h"
#include "Numeric.h"
#include "GModel.h"
#include "MElement.h"
#include "PView.h"
#include "PViewOptions.h"
#include "VertexArray.h"
#include "gl2ps.h"
#if defined(HAVE_FLTK)
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/gl.h>
#endif
#if defined(HAVE_POPPLER)
#include "gmshPopplerWrapper.h"
#endif
drawContextGlobal *drawContext::_global = 0;
drawContext::drawContext(drawTransform *transform)
: _transform(transform)
{
// initialize from temp values in global context
for(int i = 0; i < 3; i++){
r[i] = CTX::instance()->tmpRotation[i];
t[i] = CTX::instance()->tmpTranslation[i];
s[i] = CTX::instance()->tmpScale[i];
}
for(int i = 0; i < 4; i++){
quaternion[i] = CTX::instance()->tmpQuaternion[i];
}
viewport[0] = viewport[1] = 0;
viewport[2] = CTX::instance()->glSize[0];
viewport[3] = CTX::instance()->glSize[1];
render_mode = GMSH_RENDER;
vxmin = vymin = vxmax = vymax = 0.;
pixel_equiv_x = pixel_equiv_y = 0.;
_bgImageSize[0] = _bgImageSize[1] = 0;
_quadric = 0; // cannot create it here: needs valid opengl context
_displayLists = 0;
}
drawContext::~drawContext()
{
invalidateQuadricsAndDisplayLists();
}
drawContextGlobal *drawContext::global()
{
if(!_global) _global = new drawContextGlobal(); // create dummy default
return _global;
}