/* dymaxionmap --- Buckminster Fuller's unwrapped icosahedral globe.
- * Copyright (c) 2016 Jamie Zawinski.
+ * Copyright (c) 2016-2018 Jamie Zawinski.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
ISO C89 compilers are required to support" when including
the following XPM file... */
# endif
-#include "../images/dymaxionmap.xpm"
-#include "../images/ground.xpm"
+#include "images/gen/dymaxionmap_png.h"
+#include "images/gen/ground_png.h"
-#include "xpm-ximage.h"
+#include "ximage-loader.h"
#include "rotator.h"
#include "gltrackball.h"
/* Set up and enable texturing on our object */
static void
-setup_xpm_texture (ModeInfo *mi, char **xpm_data)
+setup_png_texture (ModeInfo *mi, const unsigned char *png_data,
+ unsigned long data_size)
{
- XImage *image = xpm_to_ximage (MI_DISPLAY (mi), MI_VISUAL (mi),
- MI_COLORMAP (mi), xpm_data);
+ XImage *image = image_data_to_ximage (MI_DISPLAY (mi), MI_VISUAL (mi),
+ png_data, data_size);
char buf[1024];
clear_gl_error();
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
*/
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
image->width, image->height, 0,
- GL_RGBA,
- /* GL_UNSIGNED_BYTE, */
- GL_UNSIGNED_INT_8_8_8_8_REV,
- image->data);
+ GL_RGBA, GL_UNSIGNED_BYTE, image->data);
sprintf (buf, "builtin texture (%dx%d)", image->width, image->height);
check_gl_error(buf);
}
Visual *visual = mi->xgwa.visual;
char buf[1024];
- Colormap cmap = mi->xgwa.colormap;
- XImage *image = xpm_file_to_ximage (dpy, visual, cmap, filename);
+ XImage *image = file_to_ximage (dpy, visual, filename);
if (!image) return False;
clear_gl_error();
glPixelStorei(GL_UNPACK_ROW_LENGTH, image->width);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
image->width, image->height, 0,
- GL_RGBA,
- /* GL_UNSIGNED_BYTE, */
- GL_UNSIGNED_INT_8_8_8_8_REV,
- image->data);
+ GL_RGBA, GL_UNSIGNED_BYTE, image->data);
sprintf (buf, "texture: %.100s (%dx%d)",
filename, image->width, image->height);
check_gl_error(buf);
!strcmp(which_image, "BUILTIN"))
{
BUILTIN:
- setup_xpm_texture (mi, dymaxionmap_xpm);
+ setup_png_texture (mi, dymaxionmap_png, sizeof(dymaxionmap_png));
}
else
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- setup_xpm_texture (mi, ground);
+ setup_png_texture (mi, ground_png, sizeof(ground_png));
check_gl_error("texture initialization");
int max_size = 3;
GLfloat inc = 0.5;
int steps = max_size / inc;
+ GLfloat scale = 1;
+
+ if (MI_WIDTH(mi) > 2560) { /* Retina displays */
+ scale *= 2;
+ nstars /= 2;
+ }
gp->starlist = glGenLists(1);
glNewList(gp->starlist, GL_COMPILE);
for (j = 1; j <= steps; j++)
{
- glPointSize(inc * j);
+ glPointSize(inc * j * scale);
glBegin (GL_POINTS);
for (i = 0; i < nstars / steps; i++)
{
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 100.0);
+ glFrustum(-1.0, 1.0, -h, h, 5.0, 200.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40);