//
// cocos2d::CCRenderTexture::begin from 0x10046749c to 0x100467650 (436 bytes)
//
// 2 xrefs:
// > cocos2d::CCRenderTexture::beginWithClear @ 0x1004676c4
// > cocos2d::CCRenderTexture::draw @ 0x1004678bc
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:05:32 +0000
//
void __fastcall cocos2d::CCRenderTexture::begin(__int64 a1)
{
__int64 v2; // x20
double *ContentSizeInPixels; // x0
float v4; // s0
float v5; // s0
float v6; // s8
float v7; // s9
__int64 v8; // x20
unsigned int v9; // w0
unsigned int v10; // w20
GLuint v11; // w0
GLuint v12; // w0
void *__p[2]; // [xsp+8h] [xbp-88h] BYREF
char v14; // [xsp+1Fh] [xbp-71h]
_BYTE v15[64]; // [xsp+20h] [xbp-70h] BYREF
float v16[2]; // [xsp+60h] [xbp-30h] BYREF
__int64 v17; // [xsp+68h] [xbp-28h] BYREF
kmGLMatrixMode(5889);
kmGLPushMatrix();
kmGLMatrixMode(5888);
kmGLPushMatrix();
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::setProjection(v2, *(_DWORD *)(v2 + 316));
ContentSizeInPixels = (double *)cocos2d::CCTexture2D::getContentSizeInPixels(*(_QWORD *)(a1 + 344));
sub_100026438(&v17, ContentSizeInPixels);
v4 = *(float *)(a1 + 404);
if ( v4 > 0.0 )
LODWORD(v17) = roundf(v4 * *(float *)&v17);
v5 = *(float *)(a1 + 408);
if ( v5 > 0.0 )
HIDWORD(v17) = roundf(v5 * *((float *)&v17 + 1));
cocos2d::CCDirector::getWinSizeInPixels((float *)v2, v16);
v6 = v16[0] / *(float *)&v17;
v7 = v16[1] / *((float *)&v17 + 1);
glViewport(0, 0, (int)*(float *)&v17, (int)*((float *)&v17 + 1));
kmMat4OrthographicProjection((__int64)v15, -1.0 / v6, 1.0 / v6, -1.0 / v7, 1.0 / v7, -1.0, 1.0);
kmGLMultMatrix((__int64)v15);
glGetIntegerv(0x8CA6u, (GLint *)(a1 + 336));
glBindFramebuffer(0x8D40u, *(_DWORD *)(a1 + 328));
v8 = cocos2d::CCConfiguration::sharedConfiguration();
sub_100009900(__p, "GL_QCOM");
v9 = (unsigned int)cocos2d::CCConfiguration::checkForGLExtension(v8, (const char *)__p);
v10 = v9;
if ( v14 < 0 )
{
operator delete(__p[0]);
if ( !v10 )
return;
}
else if ( !v9 )
{
return;
}
v11 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 352) + 104LL))(*(_QWORD *)(a1 + 352));
glFramebufferTexture2D(0x8D40u, 0x8CE0u, 0xDE1u, v11, 0);
glClear(0x4100u);
v12 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 344) + 104LL))(*(_QWORD *)(a1 + 344));
glFramebufferTexture2D(0x8D40u, 0x8CE0u, 0xDE1u, v12, 0);
}