C++学习(三零九)osg::VertexArrayState的作用

osg::VertexArrayState用于将顶点属性从CPU派发到GPU,包括VertexArrayDispatch、ColorArrayDispatch等,分别对应不同的OpenGL函数,如glVertexPointer、glColorPointer等。在创建后,主要用于数据上传的glVertexAttribPointer操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

它有很多顶点属性派发器VertexArrayDispatch、ColorArrayDispatch、FogCoordArrayDispatch、SecondaryColorArrayDispatch、TexCoordArrayDispatch和VertexAttribArrayDispatch,负责将顶点属性的数据从cpu派发到gpu。VertexArrayDispatch调用glVertexPointer函数;ColorArrayDispatch调用glColorPointer函数;FogCoordArrayDispatch调用glFogCoordPointer函数;NormalArrayDispatch调用glNormalPointer函数;SecondaryColorArrayDispatch调用glSecondaryColorPointer函数;TexCoordArrayDispatch调用glTexCoordPointer函数;VertexAttribArrayDispatch负责调用glVertexAttrib*Pointer系列函数。

osg/VertexArrayState.cpp
void VertexArrayState::assignVertexArrayDispatcher()
{
    if (correctArrayDispatchAssigned(_vertexArray.get())) return;

#ifdef OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
    if (!_state->getUseVertexAttributeAliasing())
    {
        _vertexArray = new VertexArrayDispatch();
    }
    else
#endif
    {
        if (_vertexArray.valid()) return;
        VAS_NOTICE<<"VertexArrayState::assignVertexArrayDispatcher() _state->getVertexAlias()._location="<<_state->getVertexAlias()._location<<std::endl;
        _vertexArray = new VertexAttribArrayDispatch(_state->getVertexAlias()._location);
    }
}

1、创建

1.1VertexArrayState的创建

当前窗体处于渲染状态时进行创建。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值