当前位置: 首页>>代码示例>>C++>>正文


C++ setupVBO函数代码示例

本文整理汇总了C++中setupVBO函数的典型用法代码示例。如果您正苦于以下问题:C++ setupVBO函数的具体用法?C++ setupVBO怎么用?C++ setupVBO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setupVBO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initIndices

//implementation ParticleSystemQuad
// overriding the init method
bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
{
    // base initialization
    if( ParticleSystem::initWithTotalParticles(numberOfParticles) )
    {
        // allocating data space
        if( ! this->allocMemory() ) {
            this->release();
            return false;
        }

        initIndices();
        if (Configuration::getInstance()->supportsShareableVAO())
        {
            setupVBOandVAO();
        }
        else
        {
            setupVBO();
        }

        setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP));

#if CC_ENABLE_CACHE_TEXTURE_DATA
        // Need to listen the event only when not use batchnode, because it will use VBO
        auto listener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, CC_CALLBACK_1(ParticleSystemQuad::listenRendererRecreated, this));
        _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
#endif

        return true;
    }
    return false;
}
开发者ID:253056965,项目名称:cocos2d-x-lite,代码行数:35,代码来源:CCParticleSystemQuad.cpp

示例2: setupIndices

NS_CC_BEGIN

//implementation CCParticleSystemQuad
// overriding the init method
bool CCParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles)
{
    // base initialization
    if( CCParticleSystem::initWithTotalParticles(numberOfParticles) )
    {
        // allocating data space
        if( ! this->allocMemory() ) {
            this->release();
            return false;
        }

        setupIndices();
#if CC_TEXTURE_ATLAS_USE_VAO
        setupVBOandVAO();
#else
        setupVBO();
#endif

        setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));


        // Need to listen the event only when not use batchnode, because it will use VBO
        CCNotificationCenter::sharedNotificationCenter()->addObserver(this,
                callfuncO_selector(CCParticleSystemQuad::listenBackToForeground),
                EVNET_COME_TO_FOREGROUND,
                NULL);

        return true;
    }
    return false;
}
开发者ID:Ratel13,项目名称:super-animation-samples,代码行数:35,代码来源:CCParticleSystemQuad.cpp

示例3: setupVBOandVAO

void CCParticleSystemQuad::listenBackToForeground(CCObject *obj)
{
#if CC_TEXTURE_ATLAS_USE_VAO
        setupVBOandVAO();
#else
        setupVBO();
#endif
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:8,代码来源:CCParticleSystemQuad.cpp

示例4: initOpenGL

//procedura inicjuj¹ca ró¿ne sprawy zwi¹zane z rysowaniem w OpenGL
void initOpenGL() {
	tex0 = readTexture("metal.tga");
	tex1 = readTexture("stones2.tga");
	tex2 = readTexture("latarka.tga");
	setupShaders();
	setupVBO();
	setupVAO();
	glEnable(GL_DEPTH_TEST);
}
开发者ID:kkapitan,项目名称:Maze,代码行数:10,代码来源:main_file.cpp

示例5: draw

void Polyhedron::init(GLuint program)
{
	//Generate the vertices needed for VBO and VAO
	draw();
	//Setup the VBO
	setupVBO();
	//Setup the VAO
	setupVAO(program);
}
开发者ID:rbVessal,项目名称:GeometryWarz,代码行数:9,代码来源:Polyhedron.cpp

示例6: setupVBOandVAO

void TextureAtlas::listenBackToForeground(Object *obj)
{  
#if CC_TEXTURE_ATLAS_USE_VAO
    setupVBOandVAO();    
#else    
    setupVBO();
#endif
    
    // set _dirty to true to force it rebinding buffer
    _dirty = true;
}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:11,代码来源:CCTextureAtlas.cpp

示例7: setupVBOandVAO

KDvoid CCTextureAtlas::listenBackToForeground ( CCObject* pObject )
{  
#if CC_TEXTURE_ATLAS_USE_VAO
    setupVBOandVAO ( );    
#else    
    setupVBO ( );
#endif
    
    // set m_bDirty to true to force it rebinding buffer
    m_bDirty = KD_TRUE;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:11,代码来源:CCTextureAtlas.cpp

示例8: setupVBOandVAO

void ParticleSystemQuad::listenRendererRecreated(EventCustom* event)
{
    if (Configuration::getInstance()->supportsShareableVAO())
    {
        setupVBOandVAO();
    }
    else
    {
        setupVBO();
    }
}
开发者ID:CatalystApps,项目名称:Cocos2dxv3_GAFSampleGame,代码行数:11,代码来源:CCParticleSystemQuad.cpp

示例9: setupVBOAndVAO

void Renderer::setupBuffer()
{
    if(Configuration::getInstance()->supportsShareableVAO())
    {
        setupVBOAndVAO();
    }
    else
    {
        setupVBO();
    }
}
开发者ID:0xiaohui00,项目名称:Cocos2dx-Wechat,代码行数:11,代码来源:CCRenderer.cpp

示例10: CCASSERT

bool TextureAtlas::initWithTexture(Texture2D *texture, ssize_t capacity)
{
    CCASSERT(capacity>=0, "Capacity must be >= 0");
    
//    CCASSERT(texture != nullptr, "texture should not be null");
    _capacity = capacity;
    _totalQuads = 0;

    // retained in property
    this->_texture = texture;
    CC_SAFE_RETAIN(_texture);

    // Re-initialization is not allowed
    CCASSERT(_quads == nullptr && _indices == nullptr, "");

    _quads = (V3F_C4B_T2F_Quad*)malloc( _capacity * sizeof(V3F_C4B_T2F_Quad) );
    _indices = (GLushort *)malloc( _capacity * 6 * sizeof(GLushort) );
    
    if( ! ( _quads && _indices) && _capacity > 0) 
    {
        //CCLOG("cocos2d: TextureAtlas: not enough memory");
        CC_SAFE_FREE(_quads);
        CC_SAFE_FREE(_indices);

        // release texture, should set it to null, because the destruction will
        // release it too. see cocos2d-x issue #484
        CC_SAFE_RELEASE_NULL(_texture);
        return false;
    }

    memset( _quads, 0, _capacity * sizeof(V3F_C4B_T2F_Quad) );
    memset( _indices, 0, _capacity * 6 * sizeof(GLushort) );
    
#if CC_ENABLE_CACHE_TEXTURE_DATA
    /** listen the event that renderer was recreated on Android/WP8 */
    _rendererRecreatedListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, CC_CALLBACK_1(TextureAtlas::listenRendererRecreated, this));
    Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_rendererRecreatedListener, -1);
#endif
    
    this->setupIndices();

    if (Configuration::getInstance()->supportsShareableVAO())
    {
        setupVBOandVAO();
    }
    else
    {
        setupVBO();
    }

    _dirty = true;

    return true;
}
开发者ID:akinlin,项目名称:PowerOfTheMind,代码行数:54,代码来源:CCTextureAtlas.cpp

示例11: setupVBOandVAO

void CCTextureAtlas::listenBackToForeground(const char* noteName, CCDictionary* params)
{  
#if CC_TEXTURE_ATLAS_USE_VAO
    setupVBOandVAO();
#else    
    setupVBO();
#endif
    
    // set m_bDirty to true to force it rebinding buffer
    m_bDirty = true;
}
开发者ID:BradB132,项目名称:cocos2d-x,代码行数:11,代码来源:CCTextureAtlas.cpp

示例12: CCASSERT

bool TextureAtlas::initWithTexture(Texture2D *texture, int capacity)
{
    CCASSERT(capacity>=0, "Capacity must be >= 0");
    
//    CCASSERT(texture != NULL, "texture should not be null");
    _capacity = capacity;
    _totalQuads = 0;

    // retained in property
    this->_texture = texture;
    CC_SAFE_RETAIN(_texture);

    // Re-initialization is not allowed
    CCASSERT(_quads == NULL && _indices == NULL, "");

    _quads = (V3F_C4B_T2F_Quad*)malloc( _capacity * sizeof(V3F_C4B_T2F_Quad) );
    _indices = (GLushort *)malloc( _capacity * 6 * sizeof(GLushort) );
    
    if( ! ( _quads && _indices) && _capacity > 0) 
    {
        //CCLOG("cocos2d: TextureAtlas: not enough memory");
        CC_SAFE_FREE(_quads);
        CC_SAFE_FREE(_indices);

        // release texture, should set it to null, because the destruction will
        // release it too. see cocos2d-x issue #484
        CC_SAFE_RELEASE_NULL(_texture);
        return false;
    }

    memset( _quads, 0, _capacity * sizeof(V3F_C4B_T2F_Quad) );
    memset( _indices, 0, _capacity * 6 * sizeof(GLushort) );
    
#if CC_ENABLE_CACHE_TEXTURE_DATA
    // listen the event when app go to background
    NotificationCenter::getInstance()->addObserver(this,
                                                           callfuncO_selector(TextureAtlas::listenBackToForeground),
                                                           EVNET_COME_TO_FOREGROUND,
                                                           NULL);
#endif
    
    this->setupIndices();

#if CC_TEXTURE_ATLAS_USE_VAO
    setupVBOandVAO();    
#else    
    setupVBO();
#endif

    _dirty = true;

    return true;
}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:53,代码来源:CCTextureAtlas.cpp

示例13: CC_SAFE_RETAIN

KDbool CCTextureAtlas::initWithTexture ( CCTexture2D* pTexture, KDuint uCapacity )
{
//	CCAssert ( pTexture != KD_NULL, "texture should not be null" );
    
	m_uCapacity   = uCapacity;
	m_uTotalQuads = 0;

	// retained in property
	m_pTexture = pTexture;
	CC_SAFE_RETAIN ( m_pTexture );

	// Re-initialization is not allowed
	CCAssert ( m_pQuads == KD_NULL && m_pIndices == KD_NULL, "" );

	m_pQuads   = (ccV3F_C4B_T2F_Quad *) kdCalloc ( 1, sizeof ( ccV3F_C4B_T2F_Quad ) * m_uCapacity );
	m_pIndices = (GLushort *) kdCalloc ( 1, sizeof ( GLushort ) * m_uCapacity * 6 );
	if ( !( m_pQuads && m_pIndices ) && m_uCapacity > 0 ) 
	{
		//CCLOG ( "XMCocos2D : CCTextureAtlas: not enough memory" );

		CC_SAFE_FREE ( m_pQuads );
		CC_SAFE_FREE ( m_pIndices );

		// release texture, should set it to null, because the destruction will
		// release it too. see cocos2d-x issue #484
		CC_SAFE_RELEASE ( m_pTexture );

		return KD_FALSE;
	}

#if CC_ENABLE_CACHE_TEXTURE_DATA
    // listen the event when app go to background
    CCNotificationCenter::sharedNotificationCenter ( )->addObserver 
	(
		this, callfuncO_selector ( CCTextureAtlas::listenBackToForeground ),
		EVENT_COME_TO_FOREGROUND, KD_NULL 
	);
#endif

	this->setupIndices ( );

#if CC_TEXTURE_ATLAS_USE_VAO
    setupVBOandVAO ( );    
#else    
    setupVBO ( );
#endif

	m_bDirty = KD_TRUE;	

	return KD_TRUE;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:51,代码来源:CCTextureAtlas.cpp

示例14: setupVBOandVAO

void TextureAtlas::listenRendererRecreated(EventCustom* event)
{  
    if (Configuration::getInstance()->supportsShareableVAO())
    {
        setupVBOandVAO();
    }
    else
    {
        setupVBO();
    }
    
    // set _dirty to true to force it rebinding buffer
    _dirty = true;
}
开发者ID:akinlin,项目名称:PowerOfTheMind,代码行数:14,代码来源:CCTextureAtlas.cpp

示例15: init

void init() {

    glClearColor(0.5, 0.5, 0.5, 1.0);
    glShadeModel(GL_SMOOTH);
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHT1);
    glEnable(GL_LIGHT2);


    glLightfv(GL_LIGHT0, GL_AMBIENT, red_light);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, red_light);
    glLightfv(GL_LIGHT0, GL_SPECULAR, red_light);

    glLightfv(GL_LIGHT1, GL_AMBIENT, white_light);
    glLightfv(GL_LIGHT1, GL_DIFFUSE, white_light);
    glLightfv(GL_LIGHT1, GL_SPECULAR, white_light);

    glLightfv(GL_LIGHT2, GL_AMBIENT, white_light);
    glLightfv(GL_LIGHT2, GL_DIFFUSE, white_light);
    glLightfv(GL_LIGHT2, GL_SPECULAR, white_light);

    glLightf(GL_LIGHT2, GL_SPOT_CUTOFF, 10.0);
    glLightf(GL_LIGHT2, GL_SPOT_EXPONENT, 5.0);

    angle = 0.0f;
    ye    = 5.0;
    xe    = 0.0f;
    ze    = 0.0f;

    setupShaders(
            (char*)"pointlight.vert", 
            (char*)"pointlight.frag",
            &ProgramA, 
            &vertexShaderObjectA,
            &fragmentShaderObjectA);
    setupShaders(
            (char*)"dirLightAmbDiffSpecPix.vert", 
            (char*)"dirLightAmbDiffSpecPix.frag",
            &ProgramA, 
            &vertexShaderObjectA,
            &fragmentShaderObjectA);
    setupVBO();
    setupVBOfromObj((char*)"rev2.obj");
    glUseProgram(ProgramA);
}
开发者ID:kgadek,项目名称:kpfp,代码行数:49,代码来源:gadekkonrad_projekt.cpp


注:本文中的setupVBO函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。