-/* xscreensaver, Copyright (c) 2006-2016 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 2006-2017 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@implementation XScreenSaverGLView
-#ifdef USE_IPHONE
/* With GL programs, drawing at full resolution isn't a problem.
*/
- (CGFloat) hackedContentScaleFactor
{
+# ifdef USE_IPHONE
return [self contentScaleFactor];
+# else
+ return self.window.backingScaleFactor;
+# endif
}
+# ifdef USE_IPHONE
+
- (BOOL)ignoreRotation
{
return FALSE; // Allow xwindow and the glViewport to change shape
BOOL was_initted_p = initted_p;
[super render_x11];
- if (! was_initted_p)
+ if (! was_initted_p && xdpy)
_suppressRotationAnimation =
get_boolean_resource (xdpy,
"suppressRotationAnimation",
return kCAGravityCenter;
}
+- (void) startAnimation
+{
+ [super startAnimation];
+ if (ogl_ctx) /* Almost always true. */
+ _glesState = jwzgles_make_state ();
+}
+
+- (void) stopAnimation
+{
+ [super stopAnimation];
+#ifdef USE_IPHONE
+ if (_glesState) {
+ [EAGLContext setCurrentContext:ogl_ctx];
+ jwzgles_make_current (_glesState);
+ jwzgles_free_state ();
+ }
+#endif
+}
+
+- (void) prepareContext
+{
+ [super prepareContext];
+ jwzgles_make_current (_glesState);
+}
+
#endif // !USE_IPHONE
// OpenGL initialization is in [XScreenSaverView startAnimation].
-# ifdef USE_IPHONE
- jwzgles_reset ();
-# endif // USE_IPHONE
-
// I don't know why this is necessary, but it beats randomly having some
// textures be upside down.
//