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

tweak

parent f52ba225
Branches
Tags
No related merge requests found
File changed. Contains only whitespace changes. Show whitespace changes.
File changed. Contains only whitespace changes. Show whitespace changes.
...@@ -33,7 +33,6 @@ class drawContextFltkStringTexture::queueString { ...@@ -33,7 +33,6 @@ class drawContextFltkStringTexture::queueString {
_totalWidth = 0; _totalWidth = 0;
_maxHeight = 0; _maxHeight = 0;
} }
void append(const element &elem) void append(const element &elem)
{ {
if (_totalWidth + elem.width > 1000) if (_totalWidth + elem.width > 1000)
...@@ -42,7 +41,6 @@ class drawContextFltkStringTexture::queueString { ...@@ -42,7 +41,6 @@ class drawContextFltkStringTexture::queueString {
_totalWidth += elem.width; _totalWidth += elem.width;
_maxHeight = std::max(_maxHeight, elem.height); _maxHeight = std::max(_maxHeight, elem.height);
} }
void flush() void flush()
{ {
//1000 should be _totalWidth but it does not work //1000 should be _totalWidth but it does not work
...@@ -100,7 +98,6 @@ class drawContextFltkStringTexture::queueString { ...@@ -100,7 +98,6 @@ class drawContextFltkStringTexture::queueString {
glColor4f(it->r, it->g, it->b, it->alpha); glColor4f(it->r, it->g, it->b, it->alpha);
int Lx = it->width; int Lx = it->width;
int Ly = it->height; int Ly = it->height;
glBegin (GL_QUADS); glBegin (GL_QUADS);
glTexCoord2f(pos, 0); glTexCoord2f(pos, 0);
glVertex2f(0.0f, Ly); glVertex2f(0.0f, Ly);
...@@ -162,4 +159,3 @@ void drawContextFltkStringTexture::setFont(int fontid, int fontsize) ...@@ -162,4 +159,3 @@ void drawContextFltkStringTexture::setFont(int fontid, int fontsize)
_currentFontId = fontid; _currentFontId = fontid;
_currentFontSize = fontsize; _currentFontSize = fontsize;
} }
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "gl2ps.h" #include "gl2ps.h"
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
#include <FL/Fl.h>
#include <FL/Fl_JPEG_Image.H> #include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_PNG_Image.H> #include <FL/Fl_PNG_Image.H>
#include <FL/gl.h> #include <FL/gl.h>
...@@ -380,7 +381,7 @@ void drawContext::drawBackgroundImage(bool threeD) ...@@ -380,7 +381,7 @@ void drawContext::drawBackgroundImage(bool threeD)
return; return;
} }
} }
_bgImageTexture = gmshPopplerWrapper::getTextureForPage(800, 600); _bgImageTexture = gmshPopplerWrapper::getTextureForPage(1024, 1024);
_bgImageW = gmshPopplerWrapper::width(); _bgImageW = gmshPopplerWrapper::width();
_bgImageH = gmshPopplerWrapper::height(); _bgImageH = gmshPopplerWrapper::height();
#endif #endif
...@@ -394,15 +395,18 @@ void drawContext::drawBackgroundImage(bool threeD) ...@@ -394,15 +395,18 @@ void drawContext::drawBackgroundImage(bool threeD)
else if(ext == ".png" || ext == ".PNG") else if(ext == ".png" || ext == ".PNG")
img = new Fl_PNG_Image(name.c_str()); img = new Fl_PNG_Image(name.c_str());
if(img){ if(img){
Fl_RGB_Image *img2 = (Fl_RGB_Image*)img->copy(1024, 1024);
glGenTextures(1, &_bgImageTexture); glGenTextures(1, &_bgImageTexture);
glBindTexture(GL_TEXTURE_2D, _bgImageTexture); glBindTexture(GL_TEXTURE_2D, _bgImageTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img->w(), img->h(), 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img2->w(), img2->h(), 0,
GL_RGB, GL_UNSIGNED_BYTE, img->array); (img2->d() == 4) ? GL_RGBA : GL_RGB,
_bgImageW = img->w(); GL_UNSIGNED_BYTE, img2->array);
_bgImageH = img->h(); _bgImageW = img2->w();
_bgImageH = img2->h();
delete img; delete img;
delete img2;
} }
else{ else{
Msg::Error("Could not load background image '%s'", name.c_str()); Msg::Error("Could not load background image '%s'", name.c_str());
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment