diff --git a/doc/scripts/config.html b/doc/scripts/config.html
index c79432588..d23f5b586 100644
--- a/doc/scripts/config.html
+++ b/doc/scripts/config.html
@@ -84,6 +84,7 @@
 <a href="#SetKeyScroll">SetKeyScroll</a>
 <a href="#SetKeyScrollSpeed">SetKeyScrollSpeed</a>
 <a href="#SetLeaveStops">SetLeaveStops</a>
+<a href="#SetMaxOpenGLTexture">SetMaxOpenGLTexture</a>
 <a href="#SetMaxSelectable">SetMaxSelectable</a>
 <a href="#SetMetaServer">SetMetaServer</a>
 <a href="#SetMinimapTerrain">SetMinimapTerrain</a>
@@ -827,6 +828,27 @@ Enable/disable stopping scrolling on mouse leave.
 SetLeaveStops(true)
 </pre>
 
+<a name="SetMaxOpenGLTexture"></a>
+<h3>SetMaxOpenGLTexture(number)</h3>
+
+<p>Limit the size of OpenGL textures.  If the game is slower with
+OpenGL than without it, try setting 1024, 512, or 256 as the limit.</p>
+
+<p>Bos Wars asks OpenGL how large textures it supports, and then
+splits all of its graphics into pieces of that size or smaller.  In
+some computers however, OpenGL reports support for e.g. 4096x4096
+textures but draws those much slower than smaller ones.  You can then
+set a smaller limit with this function.  The new limit takes effect
+on the next InitVideo call.</p>
+
+<p>If the parameter is 0, or greater than the limit reported by
+OpenGL, then Bos Wars uses the OpenGL limit instead.</p>
+
+<h4>Example</h4>
+<pre>
+SetMaxOpenGLTexture(512)
+</pre>
+
 <a name="SetMaxSelectable"></a>
 <h3>SetMaxSelectable(number)</h3>
 
diff --git a/doc/scripts/index.html b/doc/scripts/index.html
index 862c5fad8..fe87ee0f6 100644
--- a/doc/scripts/index.html
+++ b/doc/scripts/index.html
@@ -395,6 +395,8 @@
 <dd></dd>
 <dt><a href="mappresentation.html#SetMapMiniImage">SetMapMiniImage</a></dt>
 <dd></dd>
+<dt><a href="config.html#SetMaxOpenGLTexture">SetMaxOpenGLTexture</a></dt>
+<dd></dd>
 <dt><a href="config.html#SetMaxSelectable">SetMaxSelectable</a></dt>
 <dd></dd>
 <dt><a href="config.html#SetMetaServer">SetMetaServer</a></dt>
diff --git a/src/include/video.h b/src/include/video.h
index f2baf6224..3b8a4f552 100644
--- a/src/include/video.h
+++ b/src/include/video.h
@@ -349,6 +349,8 @@ extern SDL_Surface *TheScreen;
 
 	/// Max texture size supported on the video card
 extern GLint GLMaxTextureSize;
+	/// User-specified limit for ::GLMaxTextureSize
+extern GLint GLMaxTextureSizeOverride;
 	/// Is OpenGL texture compression supported
 extern bool GLTextureCompressionSupported;
 	/// Use OpenGL texture compression
diff --git a/src/ui/script_ui.cpp b/src/ui/script_ui.cpp
index ed9f54cc2..ee418d82d 100644
--- a/src/ui/script_ui.cpp
+++ b/src/ui/script_ui.cpp
@@ -143,6 +143,16 @@ static int CclSetDamageMissile(lua_State *l)
 	return 0;
 }
 
+static int CclSetMaxOpenGLTexture(lua_State *l)
+{
+	LuaCheckArgs(l, 1);
+	if (CclInConfigFile) {
+		GLMaxTextureSizeOverride = LuaToNumber(l, 1);
+	}
+
+	return 0;
+}
+
 /**
 **  Set the video resolution.
 **
@@ -1433,6 +1443,7 @@ void UserInterfaceCclRegister(void)
 	lua_register(Lua, "SetClickMissile", CclSetClickMissile);
 	lua_register(Lua, "SetDamageMissile", CclSetDamageMissile);
 
+	lua_register(Lua, "SetMaxOpenGLTexture", CclSetMaxOpenGLTexture);
 	lua_register(Lua, "SetVideoResolution", CclSetVideoResolution);
 	lua_register(Lua, "GetVideoResolution", CclGetVideoResolution);
 	lua_register(Lua, "SetVideoFullScreen", CclSetVideoFullScreen);
diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp
index 9d399be66..4d3d40da9 100644
--- a/src/video/sdl.cpp
+++ b/src/video/sdl.cpp
@@ -98,6 +98,7 @@ SDL_Surface *TheScreen; /// Internal screen
 static SDL_Rect Rects[100];
 static int NumRects;
 GLint GLMaxTextureSize;   /// Max texture size supported on the video card
+GLint GLMaxTextureSizeOverride;     /// User-specified limit for ::GLMaxTextureSize
 bool GLTextureCompressionSupported; /// Is OpenGL texture compression supported
 bool UseGLTextureCompression;       /// Use OpenGL texture compression
 
@@ -289,6 +290,10 @@ static void InitOpenGL(void)
 		fprintf(stderr, "GL_MAX_TEXTURE_SIZE is 0, using 256 by default\n");
 		GLMaxTextureSize = 256;
 	}
+	if (GLMaxTextureSize > GLMaxTextureSizeOverride
+	    && GLMaxTextureSizeOverride > 0) {
+		GLMaxTextureSize = GLMaxTextureSizeOverride;
+	}
 }
 
 void ReloadOpenGL()