25 #include "wx/msw/wrapwin.h"
27 #include "hugin_config.h"
28 #if defined HAVE_EPOXY && HAVE_EPOXY
31 #include <OpenGL/glu.h>
38 #include <OpenGL/gl.h>
39 #include <OpenGL/glu.h>
46 #include <GLUT/glut.h>
96 glEnable( GL_TEXTURE_2D );
98 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
101 glActiveTexture(GL_TEXTURE1);
102 glDisable(GL_TEXTURE_2D);
103 glActiveTexture(GL_TEXTURE0);
110 glMatrixMode(GL_TEXTURE);
112 glMatrixMode(GL_MODELVIEW);
114 glMatrixMode(GL_TEXTURE);
116 glMatrixMode(GL_MODELVIEW);
148 glColor4f(1.0f, 1.0f, 1.0f, 0.3f);
149 glEnable( GL_TEXTURE_2D );
151 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
154 glActiveTexture(GL_TEXTURE1);
155 glDisable(GL_TEXTURE_2D);
156 glActiveTexture(GL_TEXTURE0);
164 glMatrixMode(GL_TEXTURE);
167 glRotated(180,1,0,0);
168 glMatrixMode(GL_MODELVIEW);
169 GLUquadric* grid = gluNewQuadric();
170 gluQuadricTexture(grid, GL_TRUE);
174 glRotated(-90,1,0,0);
175 gluSphere(grid, 101,40,20);
178 glMatrixMode(GL_TEXTURE);
182 glMatrixMode(GL_MODELVIEW);
197 glEnable( GL_TEXTURE_2D );
199 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
203 glActiveTexture(GL_TEXTURE0);
210 glMatrixMode(GL_TEXTURE);
214 glRotated(180,1,0,0);
215 glMatrixMode(GL_MODELVIEW);
217 GLUquadric* grid = gluNewQuadric();
218 gluQuadricTexture(grid, GL_TRUE);
221 glRotated(-90,1,0,0);
222 gluSphere(grid, 101,40,20);
225 glMatrixMode(GL_TEXTURE);
229 glMatrixMode(GL_MODELVIEW);
236 image.
setSize(vigra::Size2D(3600,1780));
251 glActiveTexture(GL_TEXTURE0);
261 glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
264 int width =
std::min(1 << width_p,texSize);
265 int height =
std::min(1 << height_p, texSize >> 1);
269 double line_width_per = 0.02;
270 double dw = width / ver_lines;
271 double dh = height / hor_lines;
272 double line_width = (dw < dh) ? line_width_per * dw : line_width_per * dh;
274 GLubyte *image =
new GLubyte[width * height * 4];
275 GLubyte *pix_start = image;
278 for (
int y = 0 ; y < height ; y++)
280 bool onHorLine=
false;
281 if((horLineNr+0.5)*dh-line_width/2.0<y)
283 if(y<=(horLineNr+0.5)*dh+line_width/2.0)
293 for (
int x = 0 ; x < width ; x++)
295 bool onVerLine=
false;
296 if((verLineNr+0.5)*dw-line_width/2.0<x)
298 if(x<=(verLineNr+0.5)*dw+line_width/2.0)
308 if(onHorLine || onVerLine)
326 bool has_error =
false;
328 error = gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA8, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image);
330 static bool checked_anisotropic =
false;
331 static bool has_anisotropic;
332 static float anisotropy;
333 if (!checked_anisotropic)
336 #if defined HAVE_EPOXY && HAVE_EPOXY
337 if(epoxy_has_gl_extension(
"GL_EXT_texture_filter_anisotropic"))
339 if (GLEW_EXT_texture_filter_anisotropic)
342 has_anisotropic =
true;
343 glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &anisotropy);
344 DEBUG_INFO(
"Using anisotropic filtering at maximum value "
347 has_anisotropic =
false;
348 DEBUG_INFO(
"Anisotropic filtering is not available.");
350 checked_anisotropic =
true;
354 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
357 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
358 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
362 DEBUG_ERROR(
"GLU Error when building mipmap levels: "
363 << gluErrorString(error) <<
".");
366 error = glGetError();
367 if (error != GL_NO_ERROR)
369 DEBUG_ERROR(
"GL Error when building mipmap levels: "
370 << gluErrorString(error) <<
".");
void Update()
Recreate the mesh when the image or panorama it represents changes.
Handles the remapper and a display list for a specific image.
void setSize(vigra::Size2D val)
Set the image size in pixels.
All variables of a source image.
void CallList() const
Draw the mesh.
bool GetSupportMultiTexture() const