Changeset 10752
- Timestamp:
- 11/13/09 14:42:04 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osg/ArrayDispatchers.cpp
r10718 r10752 308 308 AttributeDispatch* dispatcher(bool useGLBeginEndAdapter, const Array* array, const IndexArray* indices) 309 309 { 310 // osg::notify(osg::NOTICE)<<"dispatcher("<<useGLBeginEndAdapter<<", "<<array<<", "<<indices<<")"<<std::endl; 311 310 312 if (!array) return 0; 311 313 312 314 Array::Type type = array->getType(); 313 315 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 314 323 if (useGLBeginEndAdapter) 315 324 { … … 343 352 if (dispatcher) 344 353 { 354 // osg::notify(osg::NOTICE)<<" returning dispatcher="<<dispatcher<<std::endl; 345 355 dispatcher->assign(array->getDataPointer(), indices); 346 356 return dispatcher; … … 348 358 else 349 359 { 360 // osg::notify(osg::NOTICE)<<" no dispatcher found"<<std::endl; 350 361 return 0; 351 362 } … … 418 429 _useGLBeginEndAdapter = false; 419 430 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 420 436 #ifdef OSG_GL_VERTEX_FUNCS_AVAILABLE 421 437 Drawable::Extensions* extensions = Drawable::getExtensions(_state->getContextID(),true); … … 426 442 _vertexDispatchers->assign<GLdouble>(Array::Vec2dArrayType, glVertex2dv, 2); 427 443 _vertexDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glVertex3dv, 3); 428 _vertexDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::Vertex3fv, 3);429 444 #endif 430 445 … … 433 448 _normalDispatchers->assign<GLfloat>(Array::Vec3ArrayType, glNormal3fv, 3); 434 449 _normalDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glNormal3dv, 3); 435 _normalDispatchers->assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::Normal3fv, 3);436 450 437 451 _colorDispatchers->assign<GLubyte>(Array::Vec4ubArrayType, glColor4ubv, 4); … … 440 454 _colorDispatchers->assign<GLdouble>(Array::Vec3dArrayType, glColor3dv, 3); 441 455 _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);444 456 445 457 _secondaryColorDispatchers->assign<GLfloat>(Array::Vec3ArrayType, extensions->_glSecondaryColor3fv, 3); … … 503 515 void ArrayDispatchers::assignTexCoordDispatchers(unsigned int unit) 504 516 { 505 #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)517 #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 506 518 Drawable::Extensions* extensions = Drawable::getExtensions(_state->getContextID(),true); 519 #endif 520 507 521 for(unsigned int i=_texCoordDispatchers.size(); i<=unit; ++i) 508 522 { … … 511 525 if (i==0) 512 526 { 527 #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 513 528 texCoordDispatcher.assign<GLfloat>(Array::FloatArrayType, glTexCoord1fv, 1); 514 529 texCoordDispatcher.assign<GLfloat>(Array::Vec2ArrayType, glTexCoord2fv, 2); 515 530 texCoordDispatcher.assign<GLfloat>(Array::Vec3ArrayType, glTexCoord3fv, 3); 516 531 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); 519 535 texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::Vec3ArrayType, &GLBeginEndAdapter::TexCoord3fv, 3); 520 536 texCoordDispatcher.assignGLBeginEnd<GLfloat>(Array::Vec4ArrayType, &GLBeginEndAdapter::TexCoord4fv, 4); … … 522 538 else 523 539 { 540 #if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE) 524 541 texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::FloatArrayType, extensions->_glMultiTexCoord1fv, 1); 525 542 texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec2ArrayType, extensions->_glMultiTexCoord2fv, 2); 526 543 texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec3ArrayType, extensions->_glMultiTexCoord3fv, 3); 527 544 texCoordDispatcher.targetAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec4ArrayType, extensions->_glMultiTexCoord4fv, 4); 545 #endif 528 546 texCoordDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::FloatArrayType, &GLBeginEndAdapter::MultiTexCoord1fv, 1); 529 547 texCoordDispatcher.targetGLBeginEndAssign<GLenum, GLfloat>((GLenum)(GL_TEXTURE0+i), Array::Vec2ArrayType, &GLBeginEndAdapter::MultiTexCoord2fv, 2); … … 532 550 } 533 551 } 534 #endif 552 535 553 } 536 554 … … 542 560 { 543 561 _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); 549 571 } 550 572 }
