DXTn 纹理支持,无“启用 S3TC...”选项

DXTn 纹理支持,无“启用 S3TC...”选项

我遇到了与描述相同的问题这里

我正在寻找对 DXTn 纹理的支持。我worldwind在终端中运行并收到以下错误消息:

Aug 22, 2012 5:28:12 PM gov.nasa.worldwind.layers.TextureTile initializeTexture
SEVERE: Exception attempting to read texture file
javax.media.opengl.GLException: DXTn compressed textures not supported by this graphics card

我尝试了建议的解决方案这里

sudo apt-get install driconf
driconf

在“图像质量”下,将“启用 S3TC...”更改为“是”。保存。


driconf解决方案并未解决问题。图像质量选项卡中没有“启用 S3TC...”选项。

我想我正在使用 Nouveau 驱动程序,我想知道是否应该切换到 Nvidia 驱动程序?

  • 计算机:Dell Precision M6400
  • 处理器:Intel® Core™2 Duo CPU T9550 @ 2.66GHz × 2 Ubuntu:12.0.4 LTS
  • 显卡:NVIDIA Quadro FX 2700M
  • 显卡:NV94 上的 Gallium 0.4

有任何想法吗?

答案1

看一看:http://en.wikipedia.org/wiki/S3_Texture_Compression

虽然 S3 Graphics 不再是图形加速器市场的竞争对手,但使用 S3TC 技术(例如在游戏机和显卡中)仍需收取许可费。尽管存在不受专利限制的替代方案,但 S3TC 的专利限制状态及其在软件中的广泛使用已导致 OpenGL 驱动程序事实上需要支持它,并且对开源实施构成重大障碍

这也解释了为什么 Nouveau 驱动程序不支持它。我猜你需要切换到二进制 NVidia 驱动程序。

答案2

否则:

..并告诉WorldWind不要使用 S3 纹理压缩(.dds格式)而是使用 PNG 默认纹理格式。

您可以下载来源(现在为 SDK 2.0):

wget http://builds.worldwind.arc.nasa.gov/worldwind-releases/2.0/builds/worldwind-2.0.0.zip
unzip worldwind-2.0.0.zip -d worldwind-2.0.0

然后将更改应用到列出的源文件这里这里

由于这些链接有点过时,您需要进行一些更改才能使其在 WW 2.0 版本中正常运行(参见附录)。

之后,您可以重建新的worldwind.jar

cd worldwind-2.0.0/
ant worldwind.jarfile # or simply `ant'

我通过运行 SDK 亲自验证了这一点Netbeans

$ sudo lshw -C video | egrep "product|driver"
   product: RV635/M86 [Mobility Radeon HD 3670]
   configuration: driver=radeon latency=0

高血压

附录:SDK 2.0 补丁

diff --git a/src/config/Earth/BMNGWMSLayer.xml b/src/config/Earth/BMNGWMSLayer.xml
--- a/src/config/Earth/BMNGWMSLayer.xml
+++ b/src/config/Earth/BMNGWMSLayer.xml
@@ -19,12 +19,12 @@
     <!-- day month year hours:minutes:seconds timezone -->
     <LastUpdate>26 03 2009 00:00:00 GMT</LastUpdate>
     <DataCacheName>Earth/BMNGWMS/BMNG(Shaded + Bathymetry) Tiled - Version 1.1 - 5.2004</DataCacheName>
-    <ImageFormat>image/dds</ImageFormat>
+    <ImageFormat>image/png</ImageFormat>
     <AvailableImageFormats>
         <ImageFormat>image/png</ImageFormat>
         <ImageFormat>image/dds</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="5" numEmpty="0"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
diff --git a/src/config/Earth/BMNGWMSLayer2.xml b/src/config/Earth/BMNGWMSLayer2.xml
--- a/src/config/Earth/BMNGWMSLayer2.xml
+++ b/src/config/Earth/BMNGWMSLayer2.xml
@@ -22,7 +22,7 @@
         <ImageFormat>image/jpeg</ImageFormat>
         <ImageFormat>image/png</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="5" numEmpty="0"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
diff --git a/src/config/Earth/CountryBoundariesLayer.xml b/src/config/Earth/CountryBoundariesLayer.xml
--- a/src/config/Earth/CountryBoundariesLayer.xml
+++ b/src/config/Earth/CountryBoundariesLayer.xml
@@ -21,7 +21,7 @@
     <AvailableImageFormats>
diff --git a/src/config/Earth/MSVirtualEarthHybridLayer.xml b/src/config/Earth/MSVirtualEarthHybridLayer.xml
--- a/src/config/Earth/MSVirtualEarthHybridLayer.xml
+++ b/src/config/Earth/MSVirtualEarthHybridLayer.xml
@@ -19,7 +19,7 @@
     <AvailableImageFormats>
         <ImageFormat>image/jpg</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.jpg</FormatSuffix>
     <NumLevels count="16" numEmpty="4"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -40,4 +40,4 @@
     </Sector>
     <ActiveAltitudes max="1000e3"/>
     <UseTransparentTextures>true</UseTransparentTextures>
diff --git a/src/config/Earth/MSVirtualEarthRoadsLayer.xml b/src/config/Earth/MSVirtualEarthRoadsLayer.xml
--- a/src/config/Earth/MSVirtualEarthRoadsLayer.xml
+++ b/src/config/Earth/MSVirtualEarthRoadsLayer.xml
@@ -19,7 +19,7 @@
     <AvailableImageFormats>
         <ImageFormat>image/jpg</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.jpg</FormatSuffix>
     <NumLevels count="16" numEmpty="4"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -40,4 +40,4 @@
     </Sector>
     <ActiveAltitudes max="1000e3"/>
     <UseTransparentTextures>true</UseTransparentTextures>
diff --git a/src/config/Earth/ScankortDenmarkImageLayer.xml b/src/config/Earth/ScankortDenmarkImageLayer.xml
--- a/src/config/Earth/ScankortDenmarkImageLayer.xml
+++ b/src/config/Earth/ScankortDenmarkImageLayer.xml
@@ -16,12 +16,12 @@
     <!-- day month year hours:minutes:seconds timezone -->
     <LastUpdate>25 06 2009 22:45:32 GMT</LastUpdate>
     <DataCacheName>Earth/Scankort Denmark</DataCacheName>
-    <ImageFormat>image/dds</ImageFormat>
+    <ImageFormat>image/png</ImageFormat>
     <AvailableImageFormats>
         <ImageFormat>image/png</ImageFormat>
         <ImageFormat>image/dds</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="16" numEmpty="0"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -46,4 +46,4 @@
             <Time units="milliseconds" value="30000"/>
         </ReadTimeout>
     </RetrievalTimeouts>
diff --git a/src/config/Earth/USDANAIPWMSImageLayer.xml b/src/config/Earth/USDANAIPWMSImageLayer.xml
--- a/src/config/Earth/USDANAIPWMSImageLayer.xml
+++ b/src/config/Earth/USDANAIPWMSImageLayer.xml
@@ -17,12 +17,12 @@
     <!-- day month year hours:minutes:seconds timezone -->
     <LastUpdate>23 04 2009 17:55:00 GMT</LastUpdate>
     <DataCacheName>Earth/USDA NAIP</DataCacheName>
-    <ImageFormat>image/dds</ImageFormat>
+    <ImageFormat>image/png</ImageFormat>
     <AvailableImageFormats>
         <ImageFormat>image/png</ImageFormat>
         <ImageFormat>image/dds</ImageFormat>
     </AvailableImageFormats>
-    <FormatSuffix>.dds</FormatSuffix>
+    <FormatSuffix>.png</FormatSuffix>
     <NumLevels count="15" numEmpty="6"/>
     <TileOrigin>
         <LatLon units="degrees" latitude="-90" longitude="-180"/>
@@ -51,4 +51,4 @@
             <Time units="milliseconds" value="30000"/>
         </ReadTimeout>
     </RetrievalTimeouts>
diff --git a/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java b/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java
--- a/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java
+++ b/src/gov/nasa/worldwind/layers/BasicTiledImageLayer.java
@@ -190,7 +190,7 @@ public class BasicTiledImageLayer extends TiledImageLayer implements BulkRetriev
             params.setValue(AVKey.TILE_HEIGHT, 512);

         if (params.getValue(AVKey.FORMAT_SUFFIX) == null)
-            params.setValue(AVKey.FORMAT_SUFFIX, ".dds");
+            params.setValue(AVKey.FORMAT_SUFFIX, ".png");

         if (params.getValue(AVKey.NUM_LEVELS) == null)
             params.setValue(AVKey.NUM_LEVELS, 19); // approximately 0.1 meters per pixel
diff --git a/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java b/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
--- a/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
+++ b/src/gov/nasa/worldwind/layers/rpf/RPFTiledImageLayer.java
@@ -265,7 +265,7 @@ public class RPFTiledImageLayer extends TiledImageLayer
         if (params.getValue(AVKey.TILE_HEIGHT) == null)
             params.setValue(AVKey.TILE_HEIGHT, 512);
         if (params.getValue(AVKey.FORMAT_SUFFIX) == null)
-            params.setValue(AVKey.FORMAT_SUFFIX, ".dds");
+            params.setValue(AVKey.FORMAT_SUFFIX, ".png");
         if (params.getValue(AVKey.NUM_LEVELS) == null)      
             params.setValue(AVKey.NUM_LEVELS, 14); // approximately 0.5 meters per pixel
         if (params.getValue(AVKey.NUM_EMPTY_LEVELS) == null)

答案3

在创建 WorldWind 模型之后,并且在显示窗口之前,您可以循环遍历所有图层并强制它们不使用 DDS 来存储图块纹理:

// Before the WorldWind window displays (which triggers the data retrievers)
// loop through the levels for each tiled image layer and mutate any level
// constructed to use DDS to instead use JPG (best compression) or PNG (best
// quality, but much larger files).
String cacheFormat = "jpg"; // could load this via configuration file
for (Layer layer : model.getLayers()) {
    if (layer instanceof BasicTiledImageLayer && ((BasicTiledImageLayer)layer).getTextureFormat() == null) {
        ((BasicTiledImageLayer)layer).setTextureFormat("image/" + cacheFormat);
        ((BasicTiledImageLayer)layer).setValue(AVKey.FORMAT_SUFFIX, "." + cacheFormat);
        ArrayList<Level> levels = ((BasicTiledImageLayer) layer).getLevels().getLevels();
        for (int i = 0; i < levels.size(); i++) {
            Level level = levels.get(i);
            if (level.getFormatSuffix().equals(".dds")) {
                AVList params = level.getParams();
                params.setValue(AVKey.FORMAT_SUFFIX, "." + cacheFormat);
                levels.set(i, new Level(params));
            }
        }
    }
}

相关内容