<commit_before>/*---------------------------------------------------------------------------*\
 *                                OpenSG                                     *
 *                                                                           *
 *                                                                           *
 *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
 *                                                                           *
 *                            www.opensg.org                                 *
 *                                                                           *
 *   contact: <EMAIL>, <EMAIL>, <EMAIL>          *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                License                                    *
 *                                                                           *
 * This library is free software; you can redistribute it and/or modify it   *
 * under the terms of the GNU Library General Public License as published    *
 * by the Free Software Foundation, version 2.                               *
 *                                                                           *
 * This library is distributed in the hope that it will be useful, but       *
 * WITHOUT ANY WARRANTY; without even the implied warranty of                *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
 * Library General Public License for more details.                          *
 *                                                                           *
 * You should have received a copy of the GNU Library General Public         *
 * License along with this library; if not, write to the Free Software       *
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                Changes                                    *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
\*---------------------------------------------------------------------------*/

//---------------------------------------------------------------------------
//  Includes
//---------------------------------------------------------------------------

#include <cstdlib>
#include <cstdio>

#include <boost/bind.hpp>

#include "OSGConfig.h"

#include <OSGGL.h>
#include <OSGGLU.h>
#include <OSGGLEXT.h>
#include <OSGImage.h>

#include "OSGDrawActionBase.h"
#include "OSGDrawEnv.h"

#include "OSGTextureObjChunk.h"

//#define OSG_DUMP_TEX

OSG_USING_NAMESPACE

// Documentation for this class is emited in the
// OSGTextureObjChunkBase.cpp file.
// To modify it, please change the .fcd file (OSGTextureObjChunk.fcd) and
// regenerate the base file.

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

StateChunkClass TextureObjChunk::_class("TextureObj", osgMaxTexImages);

UInt32 TextureObjChunk::_extTex3D                    = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbMultiTex                 = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbCubeTex                  = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvPointSprite               = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvTextureShader             = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvTextureShader2            = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvTextureShader3            = Window::invalidExtensionID;
UInt32 TextureObjChunk::_sgisGenerateMipmap          = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extTextureLodBias           = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbTextureCompression       = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbTextureRectangle         = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbTextureNonPowerOfTwo     = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extTextureFilterAnisotropic = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extShadow                   = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extDepthTexture             = Window::invalidExtensionID;

UInt32 TextureObjChunk::_funcTexImage3D              = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcTexSubImage3D           = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcActiveTexture           = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexImage1D    = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexSubImage1D = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexImage2D    = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexSubImage2D = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexImage3D    = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexSubImage3D = Window::invalidFunctionID;

volatile UInt16 TextureObjChunk::_uiChunkCounter = 1;

// define GL_TEXTURE_3D, if not defined yet
#ifndef GL_VERSION_1_2
#  define GL_FUNC_TEXIMAGE3D    OSG_DLSYM_UNDERSCORE"glTexImage3DEXT"
#  define GL_FUNC_TEXSUBIMAGE3D OSG_DLSYM_UNDERSCORE"glTexSubImage3DEXT"
#else
#  define GL_FUNC_TEXIMAGE3D    OSG_DLSYM_UNDERSCORE"glTexImage3D"
#  define GL_FUNC_TEXSUBIMAGE3D OSG_DLSYM_UNDERSCORE"glTexSubImage3D"
#endif


/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

/*-------------------------------------------------------------------------*\
 -  private                                                                -
\*-------------------------------------------------------------------------*/

void TextureObjChunk::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        _extTex3D          =
            Window::registerExtension("GL_EXT_texture3D"       );
        _arbMultiTex       =
            Window::registerExtension("GL_ARB_multitexture"    );
        _arbCubeTex        =
            Window::registerExtension("GL_ARB_texture_cube_map");
        _nvPointSprite     =
            Window::registerExtension("GL_NV_point_sprite"     );
        _nvTextureShader   =
            Window::registerExtension("GL_NV_texture_shader"   );
        _nvTextureShader2  =
            Window::registerExtension("GL_NV_texture_shader2"  );
        _nvTextureShader3  =
            Window::registerExtension("GL_NV_texture_shader3"  );
        _sgisGenerateMipmap  =
            Window::registerExtension("GL_SGIS_generate_mipmap"  );
        _extTextureLodBias  = 
            Window::registerExtension("GL_EXT_texture_lod_bias"  );
        _arbTextureCompression  = 
            Window::registerExtension("GL_ARB_texture_compression"  );
        _arbTextureRectangle  = 
            Window::registerExtension("GL_ARB_texture_rectangle"    );
        _arbTextureNonPowerOfTwo  = 
            Window::registerExtension("GL_ARB_texture_non_power_of_two" );
        _extTextureFilterAnisotropic = 
            Window::registerExtension("GL_EXT_texture_filter_anisotropic" );

        _extShadow =
            Window::registerExtension("GL_ARB_shadow"  );
        _extDepthTexture =
            Window::registerExtension("GL_ARB_dept_texture"  );

        _funcTexImage3D    =
            Window::registerFunction (GL_FUNC_TEXIMAGE3D, 
                                      _extTex3D);
        _funcTexSubImage3D =
            Window::registerFunction (GL_FUNC_TEXSUBIMAGE3D, 
                                      _extTex3D);
        _funcActiveTexture =
            Window::registerFunction (OSG_DLSYM_UNDERSCORE"glActiveTextureARB",
                                      _arbMultiTex);
        
        _funcCompressedTexImage1D    = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexImage1DARB"             , 
            _arbTextureCompression);

        _funcCompressedTexSubImage1D = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexSubImage1DARB"          , 
            _arbTextureCompression);

        _funcCompressedTexImage2D    = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexImage2DARB"             , 
            _arbTextureCompression);

        _funcCompressedTexSubImage2D = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexSubImage2DARB"          , 
            _arbTextureCompression);

        _funcCompressedTexImage3D    = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexImage3DARB"             , 
            _arbTextureCompression);
<commit_msg>ARB_depth_texture name fixed (Thanks to <NAME> for finding it!)<commit_after>/*---------------------------------------------------------------------------*\
 *                                OpenSG                                     *
 *                                                                           *
 *                                                                           *
 *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
 *                                                                           *
 *                            www.opensg.org                                 *
 *                                                                           *
 *   contact: <EMAIL>, <EMAIL>, <EMAIL>          *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                License                                    *
 *                                                                           *
 * This library is free software; you can redistribute it and/or modify it   *
 * under the terms of the GNU Library General Public License as published    *
 * by the Free Software Foundation, version 2.                               *
 *                                                                           *
 * This library is distributed in the hope that it will be useful, but       *
 * WITHOUT ANY WARRANTY; without even the implied warranty of                *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
 * Library General Public License for more details.                          *
 *                                                                           *
 * You should have received a copy of the GNU Library General Public         *
 * License along with this library; if not, write to the Free Software       *
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
 *                                                                           *
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
 *                                Changes                                    *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
 *                                                                           *
\*---------------------------------------------------------------------------*/

//---------------------------------------------------------------------------
//  Includes
//---------------------------------------------------------------------------

#include <cstdlib>
#include <cstdio>

#include <boost/bind.hpp>

#include "OSGConfig.h"

#include <OSGGL.h>
#include <OSGGLU.h>
#include <OSGGLEXT.h>
#include <OSGImage.h>

#include "OSGDrawActionBase.h"
#include "OSGDrawEnv.h"

#include "OSGTextureObjChunk.h"

//#define OSG_DUMP_TEX

OSG_USING_NAMESPACE

// Documentation for this class is emited in the
// OSGTextureObjChunkBase.cpp file.
// To modify it, please change the .fcd file (OSGTextureObjChunk.fcd) and
// regenerate the base file.

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

StateChunkClass TextureObjChunk::_class("TextureObj", osgMaxTexImages);

UInt32 TextureObjChunk::_extTex3D                    = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbMultiTex                 = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbCubeTex                  = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvPointSprite               = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvTextureShader             = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvTextureShader2            = Window::invalidExtensionID;
UInt32 TextureObjChunk::_nvTextureShader3            = Window::invalidExtensionID;
UInt32 TextureObjChunk::_sgisGenerateMipmap          = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extTextureLodBias           = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbTextureCompression       = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbTextureRectangle         = Window::invalidExtensionID;
UInt32 TextureObjChunk::_arbTextureNonPowerOfTwo     = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extTextureFilterAnisotropic = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extShadow                   = Window::invalidExtensionID;
UInt32 TextureObjChunk::_extDepthTexture             = Window::invalidExtensionID;

UInt32 TextureObjChunk::_funcTexImage3D              = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcTexSubImage3D           = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcActiveTexture           = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexImage1D    = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexSubImage1D = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexImage2D    = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexSubImage2D = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexImage3D    = Window::invalidFunctionID;
UInt32 TextureObjChunk::_funcCompressedTexSubImage3D = Window::invalidFunctionID;

volatile UInt16 TextureObjChunk::_uiChunkCounter = 1;

// define GL_TEXTURE_3D, if not defined yet
#ifndef GL_VERSION_1_2
#  define GL_FUNC_TEXIMAGE3D    OSG_DLSYM_UNDERSCORE"glTexImage3DEXT"
#  define GL_FUNC_TEXSUBIMAGE3D OSG_DLSYM_UNDERSCORE"glTexSubImage3DEXT"
#else
#  define GL_FUNC_TEXIMAGE3D    OSG_DLSYM_UNDERSCORE"glTexImage3D"
#  define GL_FUNC_TEXSUBIMAGE3D OSG_DLSYM_UNDERSCORE"glTexSubImage3D"
#endif


/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

/*-------------------------------------------------------------------------*\
 -  private                                                                -
\*-------------------------------------------------------------------------*/

void TextureObjChunk::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        _extTex3D          =
            Window::registerExtension("GL_EXT_texture3D"       );
        _arbMultiTex       =
            Window::registerExtension("GL_ARB_multitexture"    );
        _arbCubeTex        =
            Window::registerExtension("GL_ARB_texture_cube_map");
        _nvPointSprite     =
            Window::registerExtension("GL_NV_point_sprite"     );
        _nvTextureShader   =
            Window::registerExtension("GL_NV_texture_shader"   );
        _nvTextureShader2  =
            Window::registerExtension("GL_NV_texture_shader2"  );
        _nvTextureShader3  =
            Window::registerExtension("GL_NV_texture_shader3"  );
        _sgisGenerateMipmap  =
            Window::registerExtension("GL_SGIS_generate_mipmap"  );
        _extTextureLodBias  = 
            Window::registerExtension("GL_EXT_texture_lod_bias"  );
        _arbTextureCompression  = 
            Window::registerExtension("GL_ARB_texture_compression"  );
        _arbTextureRectangle  = 
            Window::registerExtension("GL_ARB_texture_rectangle"    );
        _arbTextureNonPowerOfTwo  = 
            Window::registerExtension("GL_ARB_texture_non_power_of_two" );
        _extTextureFilterAnisotropic = 
            Window::registerExtension("GL_EXT_texture_filter_anisotropic" );

        _extShadow =
            Window::registerExtension("GL_ARB_shadow"  );
        _extDepthTexture =
            Window::registerExtension("GL_ARB_depth_texture"  );

        _funcTexImage3D    =
            Window::registerFunction (GL_FUNC_TEXIMAGE3D, 
                                      _extTex3D);
        _funcTexSubImage3D =
            Window::registerFunction (GL_FUNC_TEXSUBIMAGE3D, 
                                      _extTex3D);
        _funcActiveTexture =
            Window::registerFunction (OSG_DLSYM_UNDERSCORE"glActiveTextureARB",
                                      _arbMultiTex);
        
        _funcCompressedTexImage1D    = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexImage1DARB"             , 
            _arbTextureCompression);

        _funcCompressedTexSubImage1D = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexSubImage1DARB"          , 
            _arbTextureCompression);

        _funcCompressedTexImage2D    = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexImage2DARB"             , 
            _arbTextureCompression);

        _funcCompressedTexSubImage2D = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexSubImage2DARB"          , 
            _arbTextureCompression);

        _funcCompressedTexImage3D    = Window::registerFunction(
            OSG_DLSYM_UNDERSCORE"glCompressedTexImage3DARB"             , 
            _arbTextureCompression);

{'fraction_non_alphanumeric': 0.16800902888216282, 'fraction_numerical': 0.011491304570871596, 'mean_word_length': 1.3752893871085659, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 112, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6196039', 'n_tokens_mistral': 4402, 'n_tokens_neox': 4308, 'n_words': 694}