Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGGeoPumpFactory.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include "OSGConfig.h"
#include <OSGGL.h>
#include <OSGGLEXT.h>
#include "OSGLog.h"
#include "OSGFieldContainerPtr.h"
#include "OSGGeometry.h"
#include "OSGDrawAction.h"
#include "OSGMaterial.h"
#include "OSGGeoPumpFactory.h"

Go to the source code of this file.

Namespaces

namespace  osg

Classes

class  glextFuncInit

Defines

#define TexCoords2IDs   TexCoords1IDs
#define TexCoords3IDs   TexCoords1IDs
#define pumpSetup(name, typename, getmethod)
#define pumpInternalSetup(name, typename, getmethod, mandatory)
#define pumpGLSetup(name, typename, getmethod)
#define pumpGLExtSetup(name, typename, getmethod)
#define pumpMultiGLExtSetup(name, typename, getmethod)
#define iC
#define iS
#define iN
#define iT
#define iT1
#define iT2
#define iT3
#define rC   ColorFunc ( ColorData + ColorStride * vind[ColorIndex] );
#define rS   SecColorFunc ( SecColorData + SecColorStride * vind[SecColorIndex] );
#define rN   NormalFunc ( NormalData + NormalStride * vind[NormalIndex] );
#define rT   TexCoordsFunc ( TexCoordsData + TexCoordsStride * vind[TexCoordsIndex] );
#define rT1   TexCoords1Func( GL_TEXTURE1_ARB , TexCoords1Data + TexCoords1Stride * vind[TexCoords1Index] );
#define rT2   TexCoords2Func( GL_TEXTURE2_ARB , TexCoords2Data + TexCoords2Stride * vind[TexCoords2Index] );
#define rT3   TexCoords3Func( GL_TEXTURE3_ARB , TexCoords3Data + TexCoords3Stride * vind[TexCoords3Index] );
#define defMultiGeoPump(func, init, render)

Typedefs

typedef void(OSG_APIENTRY * pumpFunc )(GLubyte *data)
typedef void(OSG_APIENTRY * multiPumpFunc )(GLenum which, GLubyte *data)

Functions

static void GeoPump0 (Window *win, Geometry *geo)
static void GeoPump128 (Window *win, Geometry *geo)
static void GeoPump129 (Window *win, Geometry *geo)

Variables

static const int formatBase = GL_BYTE
static const int numFormats = GL_DOUBLE - GL_BYTE + 1
static char * formatNames []
static glextFuncInit secondaryColorInitFuncs [8]
static glextFuncInit multiTexCoordsInitFuncs [16]
static pumpFunc PositionFuncs [numFormats][4]
static pumpFunc NormalFuncs [numFormats][4]
static pumpFunc ColorFuncs [numFormats][4]
static UInt32 SecColorIDs [numFormats][4]
static pumpFunc TexCoordsFuncs [numFormats][4]
static UInt32 TexCoords1IDs [numFormats][4]
static Char8 cvsid_cpp [] = "@(#)$Id: $"
static Char8 cvsid_hpp [] = OSGGEOPUMPFACTORY_HEADER_CVSID
static Char8 cvsid_inl [] = OSGGEOPUMPFACTORY_INLINE_CVSID


Define Documentation

#define TexCoords2IDs   TexCoords1IDs
 

Definition at line 506 of file OSGGeoPumpFactory.cpp.

#define TexCoords3IDs   TexCoords1IDs
 

Definition at line 507 of file OSGGeoPumpFactory.cpp.

#define pumpSetup name,
typename,
getmethod   ) 
 

Value:

typename name##Ptr;                                                     \
    GLubyte * name##Data = NULL;                                            \
    UInt32 name##Stride = 0;                                                \
                                                                            \
    name##Ptr = geo->getmethod();                                           \
    if ( name##Ptr != NullFC )                                              \
    {                                                                       \
        name##Data = name##Ptr->getData();                                  \
        if ( ! ( name##Stride = name##Ptr->getStride() ) )                  \
            name##Stride = name##Ptr->getFormatSize() *                     \
            name##Ptr->getDimension();                                      \
    }

Definition at line 521 of file OSGGeoPumpFactory.cpp.

Referenced by GeoPump128(), and GeoPump129().

#define pumpInternalSetup name,
typename,
getmethod,
mandatory   ) 
 

Value:

GLubyte * name##Data;                                                   \
    UInt32 name##Stride;                                                    \
    UInt32 name##Ind = 0;                                                   \
    typename name##Ptr;                                                     \
                                                                            \
    name##Ptr = geo->getmethod();                                           \
    if(mandatory && name##Ptr == NullFC)                                    \
    {                                                                       \
        SWARNING << "masterPump: Geometry " << geo << " has no "            \
                 << #name << "s!" << std::endl;                             \
        return;                                                             \
    }                                                                       \
    else if(name##Ptr != NullFC)                                            \
    {                                                                       \
        name##Data = name##Ptr->getData();                                  \
        if(!(name##Stride = name##Ptr->getStride()))                        \
            name##Stride =  name##Ptr->getFormatSize() *                    \
                            name##Ptr->getDimension();                      \
    }                                                                       \
    else                                                                    \
    {                                                                       \
        name##Data = NULL;                                                  \
        name##Stride = 0;                                                   \
    }

Definition at line 1044 of file OSGGeoPumpFactory.cpp.

Referenced by osg::GeoPumpFactory::masterGeoPump().

#define pumpGLSetup name,
typename,
getmethod   ) 
 

Definition at line 1070 of file OSGGeoPumpFactory.cpp.

Referenced by osg::GeoPumpFactory::masterGeoPump().

#define pumpGLExtSetup name,
typename,
getmethod   ) 
 

Definition at line 1104 of file OSGGeoPumpFactory.cpp.

Referenced by osg::GeoPumpFactory::masterGeoPump().

#define pumpMultiGLExtSetup name,
typename,
getmethod   ) 
 

Definition at line 1150 of file OSGGeoPumpFactory.cpp.

Referenced by osg::GeoPumpFactory::masterGeoPump().

#define iC
 

Value:

pumpGLSetup         ( Color     , GeoColorsPtr   , getColors         )\
            Int16 ColorIndex  =  geo->calcMappingIndex( Geometry::MapColor );     \
            if(ColorData && ColorPtr->getSize() == 1)                             \
                ColorFunc(ColorData);

Definition at line 1196 of file OSGGeoPumpFactory.cpp.

#define iS
 

Value:

pumpGLExtSetup      ( SecColor  , GeoColorsPtr   , getSecondaryColors)\
            Int16 SecColorIndex = geo->calcMappingIndex(Geometry::MapSecondaryColor);

Definition at line 1201 of file OSGGeoPumpFactory.cpp.

#define iN
 

Value:

pumpGLSetup         ( Normal    , GeoNormalsPtr  , getNormals        )\
            Int16 NormalIndex = geo->calcMappingIndex(Geometry::MapNormal);

Definition at line 1204 of file OSGGeoPumpFactory.cpp.

Referenced by osg::createSharedIndex().

#define iT
 

Value:

pumpGLSetup         ( TexCoords , GeoTexCoordsPtr, getTexCoords      )\
            Int16 TexCoordsIndex  = geo->calcMappingIndex(Geometry::MapTexCoords);

Definition at line 1207 of file OSGGeoPumpFactory.cpp.

#define iT1
 

Value:

pumpMultiGLExtSetup ( TexCoords1, GeoTexCoordsPtr, getTexCoords1     )\
            Int16 TexCoords1Index = geo->calcMappingIndex(Geometry::MapTexCoords1);

Definition at line 1210 of file OSGGeoPumpFactory.cpp.

#define iT2
 

Value:

pumpMultiGLExtSetup ( TexCoords2, GeoTexCoordsPtr, getTexCoords2     )\
            Int16 TexCoords2Index = geo->calcMappingIndex(Geometry::MapTexCoords2);

Definition at line 1213 of file OSGGeoPumpFactory.cpp.

#define iT3
 

Value:

pumpMultiGLExtSetup ( TexCoords3, GeoTexCoordsPtr, getTexCoords3     )\
            Int16 TexCoords3Index = geo->calcMappingIndex(Geometry::MapTexCoords3);

Definition at line 1216 of file OSGGeoPumpFactory.cpp.

#define rC   ColorFunc ( ColorData + ColorStride * vind[ColorIndex] );
 

Definition at line 1219 of file OSGGeoPumpFactory.cpp.

#define rS   SecColorFunc ( SecColorData + SecColorStride * vind[SecColorIndex] );
 

Definition at line 1220 of file OSGGeoPumpFactory.cpp.

#define rN   NormalFunc ( NormalData + NormalStride * vind[NormalIndex] );
 

Definition at line 1221 of file OSGGeoPumpFactory.cpp.

#define rT   TexCoordsFunc ( TexCoordsData + TexCoordsStride * vind[TexCoordsIndex] );
 

Definition at line 1222 of file OSGGeoPumpFactory.cpp.

Referenced by osg::TransformationMatrix< ValueTypeT >::factor().

#define rT1   TexCoords1Func( GL_TEXTURE1_ARB , TexCoords1Data + TexCoords1Stride * vind[TexCoords1Index] );
 

Definition at line 1223 of file OSGGeoPumpFactory.cpp.

#define rT2   TexCoords2Func( GL_TEXTURE2_ARB , TexCoords2Data + TexCoords2Stride * vind[TexCoords2Index] );
 

Definition at line 1224 of file OSGGeoPumpFactory.cpp.

#define rT3   TexCoords3Func( GL_TEXTURE3_ARB , TexCoords3Data + TexCoords3Stride * vind[TexCoords3Index] );
 

Definition at line 1225 of file OSGGeoPumpFactory.cpp.

#define defMultiGeoPump func,
init,
render   ) 
 

Definition at line 1232 of file OSGGeoPumpFactory.cpp.


Typedef Documentation

typedef void(OSG_APIENTRY * pumpFunc)(GLubyte *data)
 

Definition at line 310 of file OSGGeoPumpFactory.cpp.

typedef void(OSG_APIENTRY * multiPumpFunc)(GLenum which, GLubyte *data)
 

Definition at line 311 of file OSGGeoPumpFactory.cpp.


Function Documentation

static void GeoPump0 Window win,
Geometry geo
[static]
 

MasterPump for empty geometry, does nothing

Definition at line 515 of file OSGGeoPumpFactory.cpp.

Referenced by defMultiGeoPump().

00517 {
00518     return;
00519 }

static void GeoPump128 Window win,
Geometry geo
[static]
 

MasterPump for non-indexed geometry

Definition at line 538 of file OSGGeoPumpFactory.cpp.

References osg::GeoPumpFactory::_extMultitexture, osg::GeoPumpFactory::_extSecondaryColor, osg::GeoPumpFactory::_funcglClientActiveTextureARB, osg::GeoPumpFactory::_funcglSecondaryColorPointer, FWARNING, osg::Window::getFunction(), GL_SECONDARY_COLOR_ARRAY_EXT, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB, GLenum, GLsizei, osg::Window::hasExtension(), osg::NullFC, OSG_APIENTRY, and pumpSetup.

Referenced by defMultiGeoPump().

00540 {
00541     Int16 modified=0;
00542     pumpSetup(Positions  , GeoPositionsPtr , getPositions  );
00543     pumpSetup(Colors     , GeoColorsPtr    , getColors     );
00544     pumpSetup(SecColors  , GeoColorsPtr    , getSecondaryColors );
00545     pumpSetup(TexCoords  , GeoTexCoordsPtr , getTexCoords  );
00546     pumpSetup(TexCoords1 , GeoTexCoordsPtr , getTexCoords1 );
00547     pumpSetup(TexCoords2 , GeoTexCoordsPtr , getTexCoords2 );
00548     pumpSetup(TexCoords3 , GeoTexCoordsPtr , getTexCoords3 );
00549     pumpSetup(Normals    , GeoNormalsPtr   , getNormals    );
00550 
00551     pumpSetup(Lengths    , GeoPLengthsPtr  , getLengths    );
00552     pumpSetup(Types      , GeoPTypesPtr    , getTypes      );
00553 
00554     if (PositionsData)
00555     {        
00556         glVertexPointer(PositionsPtr->getDimension(), PositionsPtr->getFormat(),
00557                         PositionsStride, PositionsData);
00558         glEnableClientState(GL_VERTEX_ARRAY);
00559         modified|=(1<<0);
00560     }
00561 
00562     if (ColorsData)
00563     {
00564         glColorPointer(ColorsPtr->getDimension(), ColorsPtr->getFormat(),
00565                        ColorsStride, ColorsData);
00566         glEnableClientState(GL_COLOR_ARRAY);
00567         modified|=(1<<1);        
00568     }
00569 
00570     if (SecColorsData)
00571     {
00572         if (win->hasExtension(GeoPumpFactory::_extSecondaryColor))
00573         {
00574              void (OSG_APIENTRY*_glSecondaryColorPointerEXT)
00575                   (GLint size,GLenum type,GLsizei stride,const GLvoid *pointer)=
00576             (void (OSG_APIENTRY*)(GLint size,GLenum type,GLsizei stride,const GLvoid *pointer))
00577              win->getFunction(GeoPumpFactory::_funcglSecondaryColorPointer);
00578 
00579             _glSecondaryColorPointerEXT(SecColorsPtr->getDimension(),
00580                                        SecColorsPtr->getFormat(),
00581                                        SecColorsStride, SecColorsData);
00582             glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
00583             modified|=(1<<2);
00584         }
00585         else
00586             FWARNING(("GeoPump128: Window has no Secondary Color extension\n"));
00587     }
00588 
00589 
00590     if (NormalsData)
00591     {
00592         glNormalPointer(NormalsPtr->getFormat(), NormalsStride, NormalsData);
00593         glEnableClientState(GL_NORMAL_ARRAY);
00594         modified|=(1<<3);
00595     }
00596 
00597     if (TexCoordsData)
00598     {
00599         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00600         {
00601             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00602             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00603             _glClientActiveTextureARB(GL_TEXTURE0_ARB);
00604             glTexCoordPointer (TexCoordsPtr->getDimension(), TexCoordsPtr->getFormat(),
00605                                TexCoordsStride, TexCoordsData);
00606             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00607         }
00608         else
00609         {
00610             glTexCoordPointer (TexCoordsPtr->getDimension(), TexCoordsPtr->getFormat(),
00611                                TexCoordsStride, TexCoordsData);
00612             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00613         }
00614         modified|=(1<<4);
00615     }
00616 
00617     if (TexCoords1Data)
00618     {
00619         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00620         {
00621             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00622             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00623             _glClientActiveTextureARB(GL_TEXTURE1_ARB);
00624             glTexCoordPointer (TexCoords1Ptr->getDimension(), TexCoords1Ptr->getFormat(),
00625                                TexCoords1Stride, TexCoords1Data);
00626             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00627             modified|=(1<<5);
00628         }
00629         else
00630             FWARNING(("GeoPump128: Window has no MultitextureARB extension\n"));
00631     }
00632 
00633     if (TexCoords2Data)
00634     {
00635         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00636         {
00637             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00638             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00639             _glClientActiveTextureARB(GL_TEXTURE2_ARB);
00640             glTexCoordPointer (TexCoords2Ptr->getDimension(), TexCoords2Ptr->getFormat(),
00641                                TexCoords2Stride, TexCoords2Data);
00642             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00643             modified|=(1<<6);
00644         }
00645         else
00646             FWARNING(("GeoPump128: Window has no MultitextureARB extension\n"));
00647     }
00648 
00649     if (TexCoords3Data)
00650     {
00651         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00652         {
00653             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00654             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00655             _glClientActiveTextureARB(GL_TEXTURE3_ARB);
00656             glTexCoordPointer (TexCoords3Ptr->getDimension(), TexCoords3Ptr->getFormat(),
00657                                TexCoords3Stride, TexCoords3Data);
00658             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00659             modified|=(1<<7);
00660         }
00661         else
00662             FWARNING(("GeoPump128: Window has no MultitextureARB extension\n"));
00663     }
00664 
00665     UInt32 lendummy;
00666     UInt32 LengthsSize;
00667     UInt32 LengthsFormatSize;
00668 
00669     if(LengthsPtr != NullFC && LengthsData != NULL)
00670     {
00671         LengthsSize = LengthsPtr->getSize();
00672         LengthsFormatSize = LengthsPtr->getFormatSize();
00673     }
00674     else
00675     {
00676         LengthsSize = 1;
00677         LengthsFormatSize =  4;
00678         LengthsData = (UChar8*) &lendummy;
00679         lendummy = PositionsPtr->getSize();
00680     }
00681 
00682     UInt32 LengthsInd,TypesInd = 0;
00683     UInt32 first=0;
00684 
00685     if(LengthsFormatSize == 4)
00686     {
00687         for(LengthsInd = 0; LengthsInd < LengthsSize; LengthsInd++)
00688         {
00689             UInt32 count = *(UInt32*)(LengthsData + LengthsInd * LengthsStride);
00690             glDrawArrays(*(TypesData + TypesInd++ * TypesStride),first,count);
00691             first+=count;
00692         }
00693     }
00694     else if(LengthsFormatSize == 2)
00695     {
00696         for(LengthsInd = 0; LengthsInd < LengthsSize; LengthsInd++)
00697         {
00698             UInt16 count = *(UInt16*)(LengthsData + LengthsInd * LengthsStride);
00699             glDrawArrays(*(TypesData + TypesInd++ * TypesStride),first,count);
00700             first+=count;
00701         }       
00702     }
00703     else
00704     {
00705         FWARNING(("GeoPump128: unknown Lengths format size\n"));
00706     }
00707     
00708     if(modified&(1<<0)) glDisableClientState(GL_VERTEX_ARRAY);
00709     if(modified&(1<<1)) glDisableClientState(GL_COLOR_ARRAY);
00710     if(modified&(1<<2)) glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
00711     if(modified&(1<<3)) glDisableClientState(GL_NORMAL_ARRAY);
00712 
00713     if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00714     {
00715         void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00716         (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00717 
00718         if(modified&(1<<4))
00719         {
00720             _glClientActiveTextureARB(GL_TEXTURE0_ARB);
00721             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
00722         }
00723         
00724         if(modified&(1<<5))
00725         {
00726             _glClientActiveTextureARB(GL_TEXTURE1_ARB);
00727             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
00728         }
00729         
00730         if(modified&(1<<6))
00731         {
00732             _glClientActiveTextureARB(GL_TEXTURE2_ARB);
00733             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
00734         }
00735         
00736         if(modified&(1<<7))
00737         {
00738             _glClientActiveTextureARB(GL_TEXTURE3_ARB);
00739             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
00740         }
00741     }
00742     else
00743     {
00744         if(modified&(1<<4)) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
00745     }
00746 }

static void GeoPump129 Window win,
Geometry geo
[static]
 

MasterPump for single-indexed geometry

Definition at line 752 of file OSGGeoPumpFactory.cpp.

References osg::GeoPumpFactory::_extCompiledVertexArray, osg::GeoPumpFactory::_extDrawRangeElements, osg::GeoPumpFactory::_extMultitexture, osg::GeoPumpFactory::_extSecondaryColor, osg::GeoPumpFactory::_funcglClientActiveTextureARB, osg::GeoPumpFactory::_funcglDrawRangeElementsEXT, osg::GeoPumpFactory::_funcglLockArraysEXT, osg::GeoPumpFactory::_funcglSecondaryColorPointer, osg::GeoPumpFactory::_funcglUnlockArraysEXT, FWARNING, osg::Window::getFunction(), GL_SECONDARY_COLOR_ARRAY_EXT, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_TEXTURE2_ARB, GL_TEXTURE3_ARB, GLenum, GLsizei, GLuint(), osg::Window::hasExtension(), osg::NullFC, OSG_APIENTRY, pumpSetup, and start.

Referenced by defMultiGeoPump().

00754 {
00755     Int16 modified=0;
00756     pumpSetup(Positions  , GeoPositionsPtr , getPositions );
00757     pumpSetup(Colors     , GeoColorsPtr    , getColors    );
00758     pumpSetup(SecColors  , GeoColorsPtr    , getSecondaryColors );
00759     pumpSetup(TexCoords  , GeoTexCoordsPtr , getTexCoords  );
00760     pumpSetup(TexCoords1 , GeoTexCoordsPtr , getTexCoords1 );
00761     pumpSetup(TexCoords2 , GeoTexCoordsPtr , getTexCoords2 );
00762     pumpSetup(TexCoords3 , GeoTexCoordsPtr , getTexCoords3 );
00763     pumpSetup(Normals    , GeoNormalsPtr   , getNormals   );
00764 
00765     pumpSetup(Lengths    , GeoPLengthsPtr  , getLengths  );
00766     pumpSetup(Types      , GeoPTypesPtr    , getTypes    );
00767     pumpSetup(Indices    , GeoIndicesPtr   , getIndices  );
00768 
00769     if (PositionsData)
00770     {        
00771         glVertexPointer(PositionsPtr->getDimension(), PositionsPtr->getFormat(),
00772                         PositionsStride, PositionsData);
00773         glEnableClientState(GL_VERTEX_ARRAY);
00774         modified|=(1<<0);
00775     }
00776 
00777     if (ColorsData)
00778     {
00779         glColorPointer(ColorsPtr->getDimension(), ColorsPtr->getFormat(),
00780                        ColorsStride, ColorsData);
00781         glEnableClientState(GL_COLOR_ARRAY);
00782         modified|=(1<<1);        
00783     }
00784 
00785     if (SecColorsData)
00786     {
00787         if (win->hasExtension(GeoPumpFactory::_extSecondaryColor))
00788         {
00789              void (OSG_APIENTRY*_glSecondaryColorPointerEXT)
00790                   (GLint size,GLenum type,GLsizei stride,const GLvoid *pointer)=
00791             (void (OSG_APIENTRY*)(GLint size,GLenum type,GLsizei stride,const GLvoid *pointer))
00792              win->getFunction(GeoPumpFactory::_funcglSecondaryColorPointer);
00793 
00794             _glSecondaryColorPointerEXT(SecColorsPtr->getDimension(),
00795                                        SecColorsPtr->getFormat(),
00796                                        SecColorsStride, SecColorsData);
00797             glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
00798             modified|=(1<<2);
00799         }
00800         else
00801             FWARNING(("GeoPump129: Window has no Secondary Color extension\n"));
00802     }
00803 
00804 
00805     if (NormalsData)
00806     {
00807         glNormalPointer(NormalsPtr->getFormat(), NormalsStride, NormalsData);
00808         glEnableClientState(GL_NORMAL_ARRAY);
00809         modified|=(1<<3);
00810     }
00811 
00812     if (TexCoordsData)
00813     {
00814         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00815         {
00816             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00817             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00818             _glClientActiveTextureARB(GL_TEXTURE0_ARB);
00819             glTexCoordPointer (TexCoordsPtr->getDimension(), TexCoordsPtr->getFormat(),
00820                                TexCoordsStride, TexCoordsData);
00821             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00822         }
00823         else
00824         {
00825             glTexCoordPointer (TexCoordsPtr->getDimension(), TexCoordsPtr->getFormat(),
00826                                TexCoordsStride, TexCoordsData);
00827             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00828         }
00829         modified|=(1<<4);
00830     }
00831 
00832     if (TexCoords1Data)
00833     {
00834         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00835         {
00836             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00837             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00838             _glClientActiveTextureARB(GL_TEXTURE1_ARB);
00839             glTexCoordPointer (TexCoords1Ptr->getDimension(), TexCoords1Ptr->getFormat(),
00840                                TexCoords1Stride, TexCoords1Data);
00841             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00842             modified|=(1<<5);
00843         }
00844         else
00845             FWARNING(("GeoPump129: Window has no MultitextureARB extension\n"));
00846     }
00847 
00848     if (TexCoords2Data)
00849     {
00850         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00851         {
00852             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00853             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00854             _glClientActiveTextureARB(GL_TEXTURE2_ARB);
00855             glTexCoordPointer (TexCoords2Ptr->getDimension(), TexCoords2Ptr->getFormat(),
00856                                TexCoords2Stride, TexCoords2Data);
00857             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00858             modified|=(1<<6);
00859         }
00860         else
00861             FWARNING(("GeoPump129: Window has no MultitextureARB extension\n"));
00862     }
00863 
00864     if (TexCoords3Data)
00865     {
00866         if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00867         {
00868             void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
00869             (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
00870             _glClientActiveTextureARB(GL_TEXTURE3_ARB);
00871             glTexCoordPointer (TexCoords3Ptr->getDimension(), TexCoords3Ptr->getFormat(),
00872                                TexCoords3Stride, TexCoords3Data);
00873             glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00874             modified|=(1<<7);
00875         }
00876         else
00877             FWARNING(("GeoPump129: Window has no MultitextureARB extension\n"));
00878     }
00879 
00880     UInt32 lendummy;
00881     UInt32 LengthsSize;
00882     bool   len16 = false;
00883 
00884     if(LengthsPtr != NullFC && LengthsData != NULL)
00885     {
00886         LengthsSize = LengthsPtr->getSize();
00887         len16 = (LengthsPtr->getFormatSize() == 2);
00888     }
00889     else
00890     {
00891         LengthsSize = 1;
00892         LengthsData = (UChar8*) &lendummy;
00893         lendummy = PositionsPtr->getSize();
00894     }
00895         
00896     UInt32 LengthsInd = 0, TypesInd = 0, IndicesInd = 0, 
00897            IndicesSize = IndicesPtr->getSize();
00898 
00899     if (win->hasExtension(GeoPumpFactory::_extCompiledVertexArray))
00900     {
00901             void (OSG_APIENTRY*_glLockArraysEXT) (GLint first, GLsizei count)=
00902             (void (OSG_APIENTRY*) (GLint first, GLsizei count))
00903                 win->getFunction(GeoPumpFactory::_funcglLockArraysEXT);
00904                 
00905             _glLockArraysEXT(0, IndicesSize);
00906     }
00907 
00908     void (OSG_APIENTRY *osgGLDrawRangeElementsEXT)(GLenum mode, GLuint start,
00909            GLuint end, GLsizei count, GLenum type, const GLvoid*indices) =
00910     (void (OSG_APIENTRY *)(GLenum mode, GLuint start,
00911            GLuint end, GLsizei count, GLenum type, const GLvoid*indices))
00912             win->getFunction(GeoPumpFactory::_funcglDrawRangeElementsEXT);
00913 
00914 
00915     if(len16 == false)
00916     {
00917         for(LengthsInd = 0; LengthsInd < LengthsSize; LengthsInd++)
00918         {
00919             UInt32 count  = *(UInt32*)(LengthsData + LengthsInd * LengthsStride);
00920             UInt8 * vind = IndicesData + IndicesStride * IndicesInd;
00921             IndicesInd += count;
00922 
00923 #if 0
00924             glDrawElements(*(TypesData + TypesInd++ * TypesStride),count,
00925                             IndicesPtr->getFormat(),vind);
00926 #else
00927             if(win->hasExtension(GeoPumpFactory::_extDrawRangeElements))
00928             {
00929                 osgGLDrawRangeElementsEXT(*(TypesData + TypesInd++ * TypesStride),
00930                                           0, 
00931                                           IndicesSize, 
00932                                           count,
00933                                           IndicesPtr->getFormat(), 
00934                                           vind);
00935             }
00936             else
00937             {
00938                 // hope this still works
00939                 glDrawElements(*(TypesData + TypesInd++ * TypesStride),
00940                                count,
00941                                IndicesPtr->getFormat(),
00942                                vind);
00943             }
00944 #endif                        
00945         }
00946     }
00947     else if(len16 == true)
00948     {
00949         for(LengthsInd = 0; LengthsInd < LengthsSize; LengthsInd++)
00950         {
00951             UInt16 count  = *(UInt16*)(LengthsData + LengthsInd * LengthsStride);
00952             UInt8 * vind = IndicesData + IndicesStride * IndicesInd;
00953             IndicesInd += count;
00954 
00955 #if 0
00956             glDrawElements(*(TypesData + TypesInd++ * TypesStride),count,
00957                             IndicesPtr->getFormat(),vind);
00958 #else
00959             if(win->hasExtension(GeoPumpFactory::_extDrawRangeElements))
00960             {
00961                 osgGLDrawRangeElementsEXT(*(TypesData + TypesInd++ * TypesStride),
00962                                           0, 
00963                                           IndicesSize, 
00964                                           count,
00965                                           IndicesPtr->getFormat(), 
00966                                           vind);
00967             }
00968             else
00969             {
00970                 // hope this still works
00971                 glDrawElements(*(TypesData + TypesInd++ * TypesStride),
00972                                count,
00973                                IndicesPtr->getFormat(),
00974                                vind);
00975             }
00976 #endif                        
00977         }
00978     }
00979     else
00980     {
00981         FWARNING(("GeoPump129: unknown Lengths format size\n"));
00982     }
00983 
00984     if (win->hasExtension(GeoPumpFactory::_extCompiledVertexArray))
00985     {
00986             void (OSG_APIENTRY*_glUnlockArraysEXT) (void)=
00987             (void (OSG_APIENTRY*) (void))
00988                 win->getFunction(GeoPumpFactory::_funcglUnlockArraysEXT);
00989                 
00990             _glUnlockArraysEXT();
00991     }
00992 
00993     if(modified&(1<<0)) glDisableClientState(GL_VERTEX_ARRAY);
00994     if(modified&(1<<1)) glDisableClientState(GL_COLOR_ARRAY);
00995     if(modified&(1<<2)) glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
00996     if(modified&(1<<3)) glDisableClientState(GL_NORMAL_ARRAY);
00997 
00998     if (win->hasExtension(GeoPumpFactory::_extMultitexture))
00999     {
01000         void (OSG_APIENTRY*_glClientActiveTextureARB) (GLenum type)=
01001         (void (OSG_APIENTRY*) (GLenum type))win->getFunction(GeoPumpFactory::_funcglClientActiveTextureARB);
01002 
01003         if(modified&(1<<4))
01004         {
01005             _glClientActiveTextureARB(GL_TEXTURE0_ARB);
01006             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
01007         }
01008         
01009         if(modified&(1<<5))
01010         {
01011             _glClientActiveTextureARB(GL_TEXTURE1_ARB);
01012             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
01013         }
01014         
01015         if(modified&(1<<6))
01016         {
01017             _glClientActiveTextureARB(GL_TEXTURE2_ARB);
01018             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
01019         }
01020         
01021         if(modified&(1<<7))
01022         {
01023             _glClientActiveTextureARB(GL_TEXTURE3_ARB);
01024             glDisableClientState(GL_TEXTURE_COORD_ARRAY);
01025         }
01026     }
01027     else
01028     {
01029         if(modified&(1<<4)) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
01030     }
01031 }


Variable Documentation

const int formatBase = GL_BYTE [static]
 

Definition at line 317 of file OSGGeoPumpFactory.cpp.

Referenced by ColTraitGeneric::init(), ColTraitParticle::init(), ColTraitSingle::init(), and glextFuncInit::init().

const int numFormats = GL_DOUBLE - GL_BYTE + 1 [static]
 

Definition at line 318 of file OSGGeoPumpFactory.cpp.

Referenced by osg::GeoPumpFactory::glextInitFunction().

char* formatNames[] [static]
 

Initial value:

{   "GL_BYTE", "GL_UNSIGNED_BYTE", "GL_SHORT", "GL_UNSIGNED_SHORT",
    "GL_INT", "GL_UNSIGNED_INT", "GL_FLOAT", "GL_2_BYTES",
    "GL_3_BYTES", "GL_4_BYTES", "GL_DOUBLE"
}

Definition at line 320 of file OSGGeoPumpFactory.cpp.

Referenced by ColTraitGeneric::init(), ColTraitParticle::init(), and ColTraitSingle::init().

glextFuncInit secondaryColorInitFuncs[8] [static]
 

Initial value:

 {
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3bvEXT",
                  GL_BYTE,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3ubvEXT",
                  GL_UNSIGNED_BYTE,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3svEXT",
                  GL_SHORT,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3usvEXT",
                  GL_UNSIGNED_SHORT,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3ivEXT",
                  GL_INT,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3uivEXT",
                  GL_UNSIGNED_INT,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3fvEXT",
                  GL_FLOAT,
                  3),
    glextFuncInit(OSG_DLSYM_UNDERSCORE"glSecondaryColor3dvEXT",
                  GL_DOUBLE,
                  3)
}

Definition at line 350 of file OSGGeoPumpFactory.cpp.

glextFuncInit multiTexCoordsInitFuncs[16] [static]
 

Definition at line 377 of file OSGGeoPumpFactory.cpp.

pumpFunc PositionFuncs[numFormats][4] [static]
 

Initial value:

 {
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, (pumpFunc)glVertex2sv,
      (pumpFunc)glVertex3sv, (pumpFunc)glVertex4sv },     
    { NULL, NULL, NULL, NULL },                           
    { NULL, (pumpFunc)glVertex2iv,
      (pumpFunc)glVertex3iv, (pumpFunc)glVertex4iv },     
    { NULL, NULL, NULL, NULL },                           
    { NULL, (pumpFunc)glVertex2fv,
      (pumpFunc)glVertex3fv, (pumpFunc)glVertex4fv },     
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, (pumpFunc)glVertex2dv,
      (pumpFunc)glVertex3dv, (pumpFunc)glVertex4dv },     
}

Definition at line 430 of file OSGGeoPumpFactory.cpp.

pumpFunc NormalFuncs[numFormats][4] [static]
 

Initial value:

 {
    { NULL, NULL, (pumpFunc)glNormal3sv, NULL },          
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, (pumpFunc)glNormal3sv, NULL },          
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, (pumpFunc)glNormal3iv, NULL },          
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, (pumpFunc)glNormal3fv, NULL },          
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, (pumpFunc)glNormal3dv, NULL },          
}

Definition at line 448 of file OSGGeoPumpFactory.cpp.

pumpFunc ColorFuncs[numFormats][4] [static]
 

Initial value:

 {
    { NULL, NULL,
      (pumpFunc)glColor3bv, (pumpFunc)glColor4bv },       
    { NULL, NULL,
      (pumpFunc)glColor3ubv, (pumpFunc)glColor4ubv },     
    { NULL, NULL,
      (pumpFunc)glColor3sv, (pumpFunc)glColor4sv },       
    { NULL, NULL,
      (pumpFunc)glColor3usv, (pumpFunc)glColor4usv },     
    { NULL, NULL,
      (pumpFunc)glColor3iv, (pumpFunc)glColor4iv },       
    { NULL, NULL,
      (pumpFunc)glColor3uiv, (pumpFunc)glColor4uiv },     
    { NULL, NULL,
      (pumpFunc)glColor3fv, (pumpFunc)glColor4fv },       
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL,
      (pumpFunc)glColor3dv, (pumpFunc)glColor4dv },       
}

Definition at line 462 of file OSGGeoPumpFactory.cpp.

Referenced by ColTraitGeneric::init(), ColTraitParticle::init(), and ColTraitSingle::init().

UInt32 SecColorIDs[numFormats][4] [static]
 

Definition at line 484 of file OSGGeoPumpFactory.cpp.

pumpFunc TexCoordsFuncs[numFormats][4] [static]
 

Initial value:

 {
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { (pumpFunc)glTexCoord1sv, (pumpFunc)glTexCoord2sv,
      (pumpFunc)glTexCoord3sv, (pumpFunc)glTexCoord4sv }, 
    { NULL, NULL, NULL, NULL },                           
    { (pumpFunc)glTexCoord1iv, (pumpFunc)glTexCoord2iv,
      (pumpFunc)glTexCoord3iv, (pumpFunc)glTexCoord4iv }, 
    { NULL, NULL, NULL, NULL },                           
    { (pumpFunc)glTexCoord1fv, (pumpFunc)glTexCoord2fv,
      (pumpFunc)glTexCoord3fv, (pumpFunc)glTexCoord4fv }, 
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { NULL, NULL, NULL, NULL },                           
    { (pumpFunc)glTexCoord1dv, (pumpFunc)glTexCoord2dv,
      (pumpFunc)glTexCoord3dv, (pumpFunc)glTexCoord4dv }, 
}

Definition at line 486 of file OSGGeoPumpFactory.cpp.

UInt32 TexCoords1IDs[numFormats][4] [static]
 

Definition at line 504 of file OSGGeoPumpFactory.cpp.

Char8 cvsid_cpp[] = "@(#)$Id: $" [static]
 

Definition at line 1840 of file OSGGeoPumpFactory.cpp.

Char8 cvsid_hpp[] = OSGGEOPUMPFACTORY_HEADER_CVSID [static]
 

Definition at line 1841 of file OSGGeoPumpFactory.cpp.

Char8 cvsid_inl[] = OSGGEOPUMPFACTORY_INLINE_CVSID [static]
 

Definition at line 1842 of file OSGGeoPumpFactory.cpp.


Generated on Thu Aug 25 04:12:21 2005 for OpenSG by  doxygen 1.4.3