void cxSpriteBindTexture(cxAny pview) { cxSprite this = pview; cxOpenGLSetBlendFactor(this->sfactor, this->dfactor); cxShaderUsing(this->shader,this->texture->isAtlas); cxTextureBind(this->texture); }
void cxSpriteDraw(cxAny pview) { cxSprite this = pview; CX_RETURN(this->texture == NULL); cxOpenGLSetBlendFactor(this->sfactor, this->dfactor); cxShaderUsing(this->shader,this->texture->isAtlas); cxTextureBind(this->texture); cxOpenGLActiveAttribs(cxVertexAttribFlagPosColorTex); glVertexAttribPointer(cxVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, sizeof(cxVec3f), &this->vbox); glVertexAttribPointer(cxVertexAttribTexcoord, 2, GL_FLOAT, GL_FALSE, sizeof(cxTexCoord2f), &this->tbox); glVertexAttribPointer(cxVertexAttribColor, 4, GL_FLOAT, GL_FALSE, sizeof(cxColor4f), &this->cbox); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); }
void cxAtlasDraw(cxAny pview) { cxAtlas this = pview; CX_RETURN(this->number == 0 || this->cxSprite.texture == NULL); cxOpenGLSetBlendFactor(this->cxSprite.sfactor, this->cxSprite.dfactor); cxShaderUsing(this->cxSprite.shader,this->cxSprite.texture->isAtlas); cxTextureBind(this->cxSprite.texture); if(!this->isInit){ this->isInit = true; cxAtlasDrawInit(pview); } if(cxOpenGLInstance()->support_GL_OES_vertex_array_object){ cxAtlasVAODraw(pview); }else{ cxAtlasVBODraw(pview); } }