Backport patch from BosWars: http://svn.seul.org/viewcvs/viewvc.cgi?view=rev&root=BosWars&revision=9662
Make GLMaxTextureSize configurable for systems where the value reported by OpenGL causes slow displays
This commit is contained in:
parent
d4e99a1653
commit
d80ca98890
5 changed files with 42 additions and 0 deletions
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue