#!/bin/sh

#######################
# Geany Symbols Script. 
#######################

# Little script to generate a symbol list with all the functions of Raydium. 
# For use only with Geany ( a lightweight text editor for coders). 
# It also "installs" the list of symbols copying it to the local folder of 
# tags in geany. All C files opened with Geany will have Raydium 
# autocompletion and syntax help.

HEADERS=../../raydium/headers
GEANYLOCAL=~/.geany/tags/

# We may be called from any path, so let's
# may sure our relative path to Raydium headers will be correct.
cd "$(dirname "$0")"

geany -g -P raydium-tags-tmp.c.tags $HEADERS/*.h
mkdir -p $GEANYLOCAL
mv -f raydium-tags-tmp.c.tags $GEANYLOCAL/raydium.c.tags

@@ -223,8 +234,19 @@
   {
   glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, one);
   glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, zero);
-  glEnable(GL_TEXTURE_2D);
-  glBindTexture(GL_TEXTURE_2D,tex);
+
+  if(!raydium_texture_cubemap[tex])
+    {
+    glEnable(GL_TEXTURE_2D);
+    glDisable(GL_TEXTURE_CUBE_MAP);
+    glBindTexture(GL_TEXTURE_2D,tex);
+    }
+  else
+    {
+    glDisable(GL_TEXTURE_2D);
+    glEnable(GL_TEXTURE_CUBE_MAP);
+    glBindTexture(GL_TEXTURE_CUBE_MAP,tex);
+    }
   //printf("%s\n",raydium_texture_name[tex]);
   }
 } // end "standard" texture
@@ -247,6 +269,7 @@
 glDisable(GL_BLEND);
 glDepthMask(GL_TRUE);
 glEnable(GL_TEXTURE_2D);
+glDisable(GL_TEXTURE_CUBE_MAP);
 glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, one);
 }