27 #include <OpenGL/gl.h>
28 #include <OpenGL/glu.h>
31 #include <vigra/windows.h>
38 #include "hugin_config.h"
62 glClearColor((
float) red / 255.0, (
float) green / 255.0, (
float) blue / 255.0, 1.0);
115 double aspect_screen = double(
width) / double (
height),
117 glMatrixMode(GL_PROJECTION);
120 if (aspect_screen < aspect_pano)
137 double x_offs = (scale * double(
width) -
width_o) / 2.0,
140 glOrtho(-x_offs,
width * scale - x_offs,
141 height * scale - y_offs, -y_offs,
143 glTranslatef(-lookAt.
x, -lookAt.
y, 0);
145 glScissor((x_offs-lookAt.
x) / scale, (y_offs+lookAt.
y) / scale,
147 glMatrixMode(GL_MODELVIEW);
156 return vigra::Diff2D(
int (x_offs / scale),
int (y_offs / scale));
161 glClear(GL_COLOR_BUFFER_BIT);
162 glEnable(GL_SCISSOR_TEST);
167 glVertex2f(0.0, 0.0);
172 glColor3f(1.0, 1.0, 1.0);
178 glTranslatef(0.5, 0.5, 0.0);
179 glEnable(GL_TEXTURE_2D);
183 for (
int img = imgs - 1; img != -1; img--)
208 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
210 glColor4f(0.0, 0.0, 0.0, 0.5);
213 glBegin(GL_QUAD_STRIP);
214 glVertex2f(0.0, 0.0); glVertex2i(roi.left(), roi.top());
215 glVertex2f(
width_o, 0.0); glVertex2i(roi.right(), roi.top());
217 glVertex2f(0.0,
height_o); glVertex2i(roi.left(), roi.bottom());
218 glVertex2f(0.0, 0.0); glVertex2i(roi.left(), roi.top());
222 glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
223 glColor3f(1.0, 1.0, 1.0);
224 glBegin(GL_LINE_LOOP);
225 glVertex2i(roi.left(), roi.top());
226 glVertex2i(roi.right(), roi.top());
227 glVertex2i(roi.right(), roi.bottom());
228 glVertex2i(roi.left(), roi.bottom());
232 glEnable(GL_TEXTURE_2D);
234 glDisable(GL_SCISSOR_TEST);
240 glClearColor(0,0,0,1);
241 glClear(GL_COLOR_BUFFER_BIT);
243 glMatrixMode(GL_MODELVIEW);
254 gluLookAt(0, 0, 0, R * cos(angy) * cos(angx), R * sin(angy), R * cos(angy) * sin(angx), 0, 1, 0);
259 gluLookAt(R * cos(angy) * cos(angx), R * sin(angy), R * cos(angy) * sin(angx), 0, 0, 0, 0, 1, 0);
271 glColor3f(0.5, 0.5, 0.5);
274 glBegin(GL_LINE_LOOP);
275 glVertex3f(-side, side, 0);
276 glVertex3f(side, side, 0);
277 glVertex3f(side, -side, 0);
278 glVertex3f(-side, -side, 0);
285 glVertex3f(-axis, 0, 0);
286 glVertex3f(axis, 0, 0);
290 glVertex3f(0, axis, 0);
294 glVertex3f(0, 0, axis);
298 glEnable(GL_TEXTURE_2D);
309 for (
int img = imgs - 1; img != -1; img--)
338 glEnable(GL_CULL_FACE);
348 for (
int img = imgs - 1; img != -1; img--)
392 glMatrixMode(GL_MODELVIEW);
393 glCullFace(GL_FRONT);
397 glEnable(GL_TEXTURE_2D);
402 for (
int img = imgs - 1; img != -1; img--)
428 glDisable(GL_CULL_FACE);
448 fovy = 2.0 * atan( tan(fov *
M_PI / 360.0) * (
float) h / (
float) w) /
M_PI * 180.0;
453 float ratio = 1.0* w /
h;
455 glMatrixMode(GL_PROJECTION);
457 glViewport(0, 0, w, h);
458 gluPerspective(fovy,ratio,1,1000000);
473 double scrscale = (float)h / (2 * tan(fovy / 360.0 *
M_PI) * (R - radius) / (2 * radius *
M_PI) * (options->
getWidth()));
481 return vigra::Diff2D(0,0);
490 glClear(GL_COLOR_BUFFER_BIT);
492 glMatrixMode(GL_MODELVIEW);
501 gluLookAt(X,Y,R, X, Y, 0, 0, 1, 0);
508 glColor3f(0.5,0.5,0.5);
510 glBegin(GL_LINE_LOOP);
512 glVertex3f(-side,side,0);
513 glVertex3f(side,side,0);
514 glVertex3f(side,-side,0);
515 glVertex3f(-side,-side,0);
523 glVertex3f(-axis,0,0);
524 glVertex3f(axis,0,0);
528 glVertex3f(0,axis,0);
532 glVertex3f(0,0,axis);
537 glEnable(GL_TEXTURE_2D);
541 for (
int img = imgs - 1; img != -1; img--)
564 glMatrixMode(GL_MODELVIEW);
566 glEnable(GL_TEXTURE_2D);
571 for (
int img = imgs - 1; img != -1; img--)
608 glMatrixMode(GL_PROJECTION);
614 fovy = 2.0 * atan( tan(fov *
M_PI / 360.0) * (
float) h / (
float) w) /
M_PI * 180.0;
619 float ratio = 1.0* w /
h;
621 glMatrixMode(GL_PROJECTION);
623 gluPerspective(fovy,ratio,1,1000000);
634 return vigra::Diff2D(0,0);
void SetScale(float scale)
hugin_utils::FDiff2D GetViewingCenter() const
unsigned int getHeight() const
get panorama height
GLRenderer(const wxColour backgroundColour)
ctor.
void DisableTexture(bool maskOnly=false)
void SetCanvasSize(const vigra::Size2D &canvasSize)
include file for the hugin project
ToolHelper * m_tool_helper
double GetZoomLevel() const
bool GetLayoutMode() const
return if layout mode is active
HuginBase::PanoramaOptions * GetOptions()
vigra::Diff2D Resize(int width, int height)
Resize the viewport because the window's dimensions have changed.
const vigra::Rect2D & getROI() const
HuginBase::Panorama * m_pano
MeshManager * GetMeshManager()
std::size_t getNrOfImages() const
number of images.
The renderer handles drawing the opengl scene.
GLPlaneOverviewRenderer(HuginBase::Panorama *pano, TextureManager *tex_man, MeshManager *mesh_man, PlaneOverviewVisualizationState *visualization_state, PlaneOverviewToolHelper *tool_helper, const wxColour backgroundColour)
PlaneOverviewVisualizationState * m_visualization_state
GLPreviewRenderer(HuginBase::Panorama *pano, TextureManager *tex_man, MeshManager *mesh_man, VisualizationState *visualization_state, PreviewToolHelper *tool_helper, const wxColour backgroundColour)
virtual ~GLRenderer()
dtor.
wxColour m_background_color
ViewState * getViewState()
static const double scale
unsigned int getWidth() const
A MeshManager handles the graphics system representation of a remapping, by creating OpenGL display l...
void DrawImage(unsigned int image_number, unsigned int display_list)
void SetVisibleArea(vigra::Rect2D area)
void SetBackground(unsigned char red, unsigned char green, unsigned char blue)
GLPanosphereOverviewRenderer(HuginBase::Panorama *pano, TextureManager *tex_man, MeshManager *mesh_man, PanosphereOverviewVisualizationState *visualization_state, PanosphereOverviewToolHelper *tool_helper, const wxColour backgroundColour)
VisualizationState * m_visualization_state
void SetPreviewBackgroundColor(const wxColour c)
sets the preview background color
TextureManager * m_tex_man
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
vigra::Diff2D Resize(int width, int height)
Resize the viewport because the window's dimensions have changed.
PanosphereOverviewVisualizationState * m_visualization_state
unsigned int GetDisplayList(unsigned int image_number) const
HuginBase::PanoramaOptions * GetOptions()
vigra::Diff2D Resize(int width, int height)
Resize the viewport because the window's dimensions have changed.