//
// cocos2d::CCRenderTexture::draw from 0x18005fb90 to 0x18005fd98 (520 bytes)
//
// 5 xrefs:
// > ??> @ 0x1800f9f30
// > ??> @ 0x180139504
// > ??> @ 0x180139538
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b3408
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall cocos2d::CCRenderTexture::draw(cocos2d::CCRenderTexture *this)
{
GLbitfield m_uClearFlags; // eax
cocos2d::CCArray *m_pChildren; // rax
cocos2d::ccArray *data; // rbx
__int64 num; // rax
cocos2d::CCSprite **arr; // rbx
cocos2d::CCSprite **i; // rsi
cocos2d::CCSprite *v8; // rcx
cocos2d::CCDirector *v9; // rbx
GLfloat v10; // [rsp+20h] [rbp-28h] BYREF
GLint s; // [rsp+24h] [rbp-24h] BYREF
GLfloat params[4]; // [rsp+28h] [rbp-20h] BYREF
if ( this->m_bAutoDraw )
{
cocos2d::CCRenderTexture::begin(this);
m_uClearFlags = this->m_uClearFlags;
if ( m_uClearFlags )
{
v10 = 0.0;
s = 0;
*(_OWORD *)params = 0;
if ( (m_uClearFlags & 0x4000) != 0 )
{
glGetFloatv(0xC22u, params);
glClearColor(this->m_sClearColor.r, this->m_sClearColor.g, this->m_sClearColor.b, this->m_sClearColor.a);
}
if ( (this->m_uClearFlags & 0x100) != 0 )
{
glGetFloatv(0xB73u, &v10);
glClearDepth(this->m_fClearDepth);
}
if ( (this->m_uClearFlags & 0x400) != 0 )
{
glGetIntegerv(0xB91u, &s);
glClearStencil(this->m_nClearStencil);
}
glClear(this->m_uClearFlags);
if ( (this->m_uClearFlags & 0x4000) != 0 )
glClearColor(params[0], params[1], params[2], params[3]);
if ( (this->m_uClearFlags & 0x100) != 0 )
glClearDepth(v10);
if ( (this->m_uClearFlags & 0x400) != 0 )
glClearStencil(s);
}
((void (__fastcall *)(cocos2d::CCRenderTexture *))this->sortAllChildren)(this);
m_pChildren = this->m_pChildren;
if ( m_pChildren )
{
data = m_pChildren->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (cocos2d::CCSprite **)data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v8 = *arr;
if ( !*arr )
break;
if ( v8 != this->m_pSprite )
((void (__fastcall *)(cocos2d::CCSprite *))v8->visit)(v8);
}
}
}
v9 = cocos2d::CCDirector::sharedDirector();
_glewBindFramebuffer(36160, (unsigned int)this->m_nOldFBO);
cocos2d::CCDirector::setViewport(v9);
kmGLMatrixMode(5889);
kmGLPopMatrix();
kmGLMatrixMode(5888);
kmGLPopMatrix();
}
}