Show
Ignore:
Timestamp:
11/13/09 14:42:04 (4 years ago)
Author:
robert
Message:

Moved the GLBeginEndAdapter support out of the blocks of the "#if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)" guarded blocks.

Fixed the number of components being passed as GLBeginEndAdatper::TexCoord?*fv.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/ArrayDispatchers.cpp

    r10718 r10752  
    308308    AttributeDispatch* dispatcher(bool useGLBeginEndAdapter, const Array* array, const IndexArray* indices) 
    309309    { 
     310        // osg::notify(osg::NOTICE)<<"dispatcher("<<useGLBeginEndAdapter<<", "<<array<<", "<<indices<<")"<<std::endl; 
     311 
    310312        if (!array) return 0; 
    311313 
    312314        Array::Type type = array->getType(); 
    313315        AttributeDispatch* dispatcher = 0; 
     316 
     317        // osg::notify(osg::NOTICE)<<"    array->getType()="<<type<<std::endl; 
     318        // osg::notify(osg::NOTICE)<<"    _glBeginEndAttributeDispatchList.size()="<<_glBeginEndAttributeDispatchList.size()<<std::endl; 
     319        // osg::notify(osg::NOTICE)<<"    _glBeginEndAttributeDispatchWithIndicesList.size()="<<_glBeginEndAttributeDispatchWithIndicesList.size()<<std::endl; 
     320        // osg::notify(osg::NOTICE)<<"    _attributeDispatchIndicesList.size()="<<_attributeDispatchList.size()<<std::endl; 
     321        // osg::notify(osg::NOTICE)<<"    _attributeDispatchWithIndicesList.size()="<<_attributeDispatchWithIndicesList.size()<<std::endl; 
     322 
    314323        if (useGLBeginEndAdapter) 
    315324        { 
     
    343352        if (dispatcher) 
    344353        { 
     354            // osg::notify(osg::NOTICE)<<"   returning dispatcher="<<dispatcher<<std::endl; 
    345355            dispatcher->assign(array->getDataPointer(), indices); 
    346356            return dispatcher; 
     
    348358        else 
    349359        { 
     360            // osg::notify(osg::NOTICE)<<"   no dispatcher found"<<std::endl; 
    350361            return 0; 
    351362        } 
     
    418429    _useGLBeginEndAdapter = false; 
    419430 
     431    _vertexDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::Vertex3fv, 3); 
     432    _normalDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::Normal3fv, 3); 
     433    _colorDispatchers->assignGLBeginEnd<GLubyte>(Array::Vec4ubArrayType, &GLBeginEndAdapter::Color4ubv, 4); 
     434    _colorDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec4ArrayType, &GLBeginEndAdapter::Color4fv, 4); 
     435 
    420436#ifdef OSG_GL_VERTEX_FUNCS_AVAILABLE 
    421437    Drawable::Extensions* extensions = Drawable::getExtensions(_state->getContextID(),true); 
     
    426442        _vertexDispatchers->assign<GLdouble>(Array::Vec2dArrayType, glVertex2dv, 2); 
    427443        _vertexDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glVertex3dv, 3); 
    428         _vertexDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::Vertex3fv, 3); 
    429444    #endif 
    430445 
     
    433448    _normalDispatchers->assign<GLfloat>(Array::Vec3ArrayType, glNormal3fv, 3); 
    434449    _normalDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glNormal3dv, 3); 
    435     _normalDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::Normal3fv, 3); 
    436450 
    437451    _colorDispatchers->assign<GLubyte>(Array::Vec4ubArrayType, glColor4ubv, 4); 
     
    440454    _colorDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glColor3dv, 3); 
    441455    _colorDispatchers->assign<GLdouble>(Array::Vec4dArrayType, glColor4dv, 4); 
    442     _colorDispatchers->assignGLBeginEnd<GLubyte>(Array::Vec4ubArrayType, &GLBeginEndAdapter::Color4ubv, 4); 
    443     _colorDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec4ArrayType, &GLBeginEndAdapter::Color4fv, 4); 
    444456 
    445457    _secondaryColorDispatchers->assign<GLfloat>(Array::Vec3ArrayType, extensions->_glSecondaryColor3fv, 3); 
     
    503515void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit) 
    504516{ 
    505 #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 
     517    #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 
    506518    Drawable::Extensions* extensions = Drawable::getExtensions(_state->getContextID(),true); 
     519    #endif 
     520     
    507521    for(unsigned int i=_texCoordDispatchers.size(); i<=unit; ++i) 
    508522    { 
     
    511525        if (i==0) 
    512526        { 
     527            #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 
    513528            texCoordDispatcher.assign<GLfloat>(Array::FloatArrayType, glTexCoord1fv, 1); 
    514529            texCoordDispatcher.assign<GLfloat>(Array::Vec2ArrayType, glTexCoord2fv, 2); 
    515530            texCoordDispatcher.assign<GLfloat>(Array::Vec3ArrayType, glTexCoord3fv, 3); 
    516531            texCoordDispatcher.assign<GLfloat>(Array::Vec4ArrayType, glTexCoord4fv, 4); 
    517             texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::FloatArrayType, &GLBeginEndAdapter::TexCoord1fv, 3); 
    518             texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::Vec2ArrayType, &GLBeginEndAdapter::TexCoord2fv, 3); 
     532            #endif 
     533            texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::FloatArrayType, &GLBeginEndAdapter::TexCoord1fv, 1); 
     534            texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::Vec2ArrayType, &GLBeginEndAdapter::TexCoord2fv, 2); 
    519535            texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::TexCoord3fv, 3); 
    520536            texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::Vec4ArrayType, &GLBeginEndAdapter::TexCoord4fv, 4); 
     
    522538        else 
    523539        { 
     540            #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 
    524541            texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::FloatArrayType, extensions->_glMultiTexCoord1fv, 1); 
    525542            texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec2ArrayType, extensions->_glMultiTexCoord2fv, 2); 
    526543            texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec3ArrayType, extensions->_glMultiTexCoord3fv, 3); 
    527544            texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec4ArrayType, extensions->_glMultiTexCoord4fv, 4); 
     545            #endif 
    528546            texCoordDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::FloatArrayType, &GLBeginEndAdapter::MultiTexCoord1fv, 1); 
    529547            texCoordDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec2ArrayType, &GLBeginEndAdapter::MultiTexCoord2fv, 2); 
     
    532550        } 
    533551    } 
    534 #endif 
     552 
    535553} 
    536554 
     
    542560    { 
    543561        _vertexAttribDispatchers.push_back(new AttributeDispatchMap(_glBeginEndAdapter)); 
    544         AttributeDispatchMap& texCoordDispatcher = *_vertexAttribDispatchers[i]; 
    545         texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::FloatArrayType, extensions->_glVertexAttrib1fv, 1); 
    546         texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec2ArrayType, extensions->_glVertexAttrib2fv, 2); 
    547         texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec3ArrayType, extensions->_glVertexAttrib3fv, 3); 
    548         texCoordDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec4ArrayType, extensions->_glVertexAttrib4fv, 4); 
     562        AttributeDispatchMap& vertexAttribDispatcher = *_vertexAttribDispatchers[i]; 
     563        vertexAttribDispatcher.targetAssign<GLuint, GLfloat>(i, Array::FloatArrayType, extensions->_glVertexAttrib1fv, 1); 
     564        vertexAttribDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec2ArrayType, extensions->_glVertexAttrib2fv, 2); 
     565        vertexAttribDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec3ArrayType, extensions->_glVertexAttrib3fv, 3); 
     566        vertexAttribDispatcher.targetAssign<GLuint, GLfloat>(i, Array::Vec4ArrayType, extensions->_glVertexAttrib4fv, 4); 
     567        vertexAttribDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>(i, Array::FloatArrayType, &GLBeginEndAdapter::VertexAttrib1fv, 1); 
     568        vertexAttribDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>(i, Array::Vec2ArrayType, &GLBeginEndAdapter::VertexAttrib2fv, 2); 
     569        vertexAttribDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>(i, Array::Vec3ArrayType, &GLBeginEndAdapter::VertexAttrib3fv, 3); 
     570        vertexAttribDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>(i, Array::Vec4ArrayType, &GLBeginEndAdapter::VertexAttrib4fv, 4); 
    549571    } 
    550572}