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

fixes to background image

parent f26864a8
No related branches found
No related tags found
No related merge requests found
...@@ -339,9 +339,9 @@ StringXNumber GeneralOptions_Number[] = { ...@@ -339,9 +339,9 @@ StringXNumber GeneralOptions_Number[] = {
"Y position of background image (for 2D background: < 0: measure from bottom edge; " "Y position of background image (for 2D background: < 0: measure from bottom edge; "
">= 1e5: centered)" }, ">= 1e5: centered)" },
{ F|O, "BackgroundImageWidth" , opt_general_background_image_size0 , -1. , { F|O, "BackgroundImageWidth" , opt_general_background_image_size0 , -1. ,
"Width of background image (0: actual width; -1: fullscreen)" }, "Width of background image (0: actual width; -1: graphic window width)" },
{ F|O, "BackgroundImageHeight" , opt_general_background_image_size1 , -1 , { F|O, "BackgroundImageHeight" , opt_general_background_image_size1 , -1 ,
"Height of background image (0: actual width; -1: fullscreen)" }, "Height of background image (0: actual height; -1: graphic window height)" },
{ F|O, "Camera" , opt_general_camera_mode, 0. , { F|O, "Camera" , opt_general_camera_mode, 0. ,
"Enable camera view mode" }, "Enable camera view mode" },
......
...@@ -416,8 +416,8 @@ void drawContext::drawBackgroundImage(bool threeD) ...@@ -416,8 +416,8 @@ void drawContext::drawBackgroundImage(bool threeD)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img2->w(), img2->h(), 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img2->w(), img2->h(), 0,
(img2->d() == 4) ? GL_RGBA : GL_RGB, (img2->d() == 4) ? GL_RGBA : GL_RGB,
GL_UNSIGNED_BYTE, img2->array); GL_UNSIGNED_BYTE, img2->array);
_bgImageW = img2->w(); _bgImageW = img->w();
_bgImageH = img2->h(); _bgImageH = img->h();
delete img; delete img;
delete img2; delete img2;
} }
...@@ -461,8 +461,8 @@ void drawContext::drawBackgroundImage(bool threeD) ...@@ -461,8 +461,8 @@ void drawContext::drawBackgroundImage(bool threeD)
} }
else{ else{
int c = fix2dCoordinates(&x, &y); // y=0 now means top int c = fix2dCoordinates(&x, &y); // y=0 now means top
if(c & 1) x -= _bgImageW / 2.; if(c & 1) x -= w / 2.;
if(c & 2) y += _bgImageH / 2.; if(c & 2) y += h / 2.;
if(x < viewport[0]) x = viewport[0]; if(x < viewport[0]) x = viewport[0];
if(y < viewport[1]) y = viewport[1]; if(y < viewport[1]) y = viewport[1];
glTexCoord2f(1.0f, 1.0f); glVertex2d(x+w, y-h); glTexCoord2f(1.0f, 1.0f); glVertex2d(x+w, y-h);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment