//
// cocos2d::CCRenderTexture::begin from 0x180061590 to 0x180061820 (656 bytes)
//
// 9 xrefs:
// > cocos2d::CCTransitionCrossFade::onEnter @ 0x180056a36
// > cocos2d::CCTransitionCrossFade::onEnter @ 0x180056af0
// > cocos2d::CCTransitionProgress::onEnter @ 0x180059576
// > cocos2d::CCRenderTexture::beginWithClear @ 0x180061852
// > cocos2d::CCRenderTexture::clearDepth @ 0x180061ad5
// > cocos2d::CCRenderTexture::draw @ 0x180061d9a
// > cocos2d::CCRenderTexture::newCCImage @ 0x180062593
// > ??> @ 0x18014cf68
// > ??> @ 0x1801bd648
//
// This function is hookable on this platform (idp: pc, 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:21:51 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::CCRenderTexture::begin(cocos2d::CCRenderTexture *this)
{
struct cocos2d::CCDirector *v2; // rbx
const struct cocos2d::CCSize *ContentSizeInPixels; // rax
float v4; // xmm0_4
float v5; // xmm0_4
float v6; // xmm6_4
int v7; // edx
int v8; // r8d
int v9; // r9d
struct cocos2d::CCConfiguration *v10; // rax
char v11; // bl
void *v12; // r8
unsigned int v13; // eax
unsigned int v14; // eax
float v15; // [rsp+40h] [rbp-A8h] BYREF
float v16; // [rsp+44h] [rbp-A4h]
_DWORD v17[2]; // [rsp+48h] [rbp-A0h] BYREF
void *Block[3]; // [rsp+50h] [rbp-98h] BYREF
unsigned __int64 v19; // [rsp+68h] [rbp-80h]
_BYTE v20[64]; // [rsp+70h] [rbp-78h] BYREF
kmGLMatrixMode(5889);
kmGLPushMatrix();
kmGLMatrixMode(5888);
kmGLPushMatrix();
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::setProjection(v2, *((unsigned int *)v2 + 79));
ContentSizeInPixels = cocos2d::CCTexture2D::getContentSizeInPixels(*((cocos2d::CCTexture2D **)this + 43));
cocos2d::cc_timeval::operator=(&v15, ContentSizeInPixels);
v4 = *((float *)this + 101);
if ( v4 > 0.0 )
v15 = roundf(v4 * v15);
v5 = *((float *)this + 102);
if ( v5 > 0.0 )
v16 = roundf(v5 * v16);
cocos2d::CCDirector::getWinSizeInPixels(v2, v17);
v6 = *(float *)&v17[1] / v16;
glViewport(0, 0, (int)v15, (int)v16);
kmMat4OrthographicProjection((unsigned int)v20, v7, v8, v9, 1.0 / v6, -1082130432, 1065353216);
kmGLMultMatrix(v20);
glGetIntegerv(0x8CA6u, (GLint *)this + 84);
_glewBindFramebuffer(36160, *((unsigned int *)this + 82));
sub_180005A10(Block, "GL_QCOM");
v10 = cocos2d::CCConfiguration::sharedConfiguration();
v11 = cocos2d::CCConfiguration::checkForGLExtension(v10, Block);
if ( v19 > 0xF )
{
v12 = Block[0];
if ( v19 + 1 >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v12);
}
if ( v11 )
{
v13 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 44) + 96LL))(*((_QWORD *)this + 44));
_glewFramebufferTexture2D(36160, 36064, 3553, v13, 0);
glClear(0x4100u);
v14 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 43) + 96LL))(*((_QWORD *)this + 43));
_glewFramebufferTexture2D(36160, 36064, 3553, v14, 0);
}
}