//
// cocos2d::CCRenderTexture::begin from 0x1006c85c0 to 0x1006c87cf (527 bytes)
//
// 11 xrefs:
// > cocos2d::CCTransitionCrossFade::onEnter @ 0x1000a7bd3
// > cocos2d::CCTransitionCrossFade::onEnter @ 0x1000a7c94
// > cocos2d::CCTransitionProgress::onEnter @ 0x100278bce
// > sub_1003914D0 @ 0x10039177e
// > cocos2d::CCRenderTexture::beginWithClear_3 @ 0x1006c881a
// > cocos2d::CCRenderTexture::beginWithClear @ 0x1006c88c7
// > cocos2d::CCRenderTexture::beginWithClear_2 @ 0x1006c8a5f
// > cocos2d::CCRenderTexture::clear @ 0x1006c8ba0
// > cocos2d::CCRenderTexture::clearDepth @ 0x1006c8c73
// > cocos2d::CCRenderTexture::draw @ 0x1006c8dfb
// > cocos2d::CCRenderTexture::newCCImage @ 0x1006c9108
//
// 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 12:35:35 +0000
//
void __fastcall cocos2d::CCRenderTexture::begin(__int64 a1)
{
__int64 v1; // r14
_QWORD *ContentSizeInPixels; // rax
__m128 v3; // xmm1
__m128 v4; // xmm2
__m128 v5; // xmm1
__m128 v6; // xmm0
__m128 v7; // xmm0
__m128 v8; // xmm1
__m128 v9; // xmm2
__m128 v10; // xmm3
__int64 v11; // rax
bool v12; // r14
GLuint v13; // eax
GLuint v14; // eax
_BYTE v15[64]; // [rsp+0h] [rbp-80h] BYREF
float v16[2]; // [rsp+40h] [rbp-40h] BYREF
char v17; // [rsp+48h] [rbp-38h] BYREF
char v18[15]; // [rsp+49h] [rbp-37h] BYREF
void *__p; // [rsp+58h] [rbp-28h]
float v20; // [rsp+60h] [rbp-20h]
float v21; // [rsp+64h] [rbp-1Ch]
__int64 v22; // [rsp+68h] [rbp-18h] BYREF
kmGLMatrixMode(5889);
kmGLPushMatrix();
kmGLMatrixMode(5888);
kmGLPushMatrix();
v1 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::setProjection(v1, *(_DWORD *)(v1 + 316));
ContentSizeInPixels = (_QWORD *)cocos2d::CCTexture2D::getContentSizeInPixels(*(_QWORD *)(a1 + 344));
sub_100278630(&v22, ContentSizeInPixels);
v3 = (__m128)*(unsigned int *)(a1 + 404);
if ( v3.f32[0] > 0.0 )
{
v3.f32[0] = v3.f32[0] * *(float *)&v22;
v4 = _mm_or_ps(_mm_and_ps((__m128)xmmword_100A035F0, v3), (__m128)xmmword_100A03600);
v4.f32[0] = v4.f32[0] + v3.f32[0];
LODWORD(v22) = _mm_round_ss((__m128)0LL, v4, 11).u32[0];
}
v5 = (__m128)*(unsigned int *)(a1 + 408);
if ( v5.f32[0] > 0.0 )
{
v5.f32[0] = v5.f32[0] * *((float *)&v22 + 1);
v6 = _mm_or_ps(_mm_and_ps((__m128)xmmword_100A035F0, v5), (__m128)xmmword_100A03600);
v6.f32[0] = v6.f32[0] + v5.f32[0];
HIDWORD(v22) = _mm_round_ss(v6, v6, 11).u32[0];
}
cocos2d::CCDirector::getWinSizeInPixels(v16, (float *)v1);
v21 = v16[0] / *(float *)&v22;
v20 = v16[1] / *((float *)&v22 + 1);
glViewport(0, 0, (int)*(float *)&v22, (int)*((float *)&v22 + 1));
v7 = (__m128)0xBF800000;
v7.f32[0] = -1.0 / v21;
v8 = (__m128)0x3F800000u;
v8.f32[0] = 1.0 / v21;
v9 = (__m128)0xBF800000;
v9.f32[0] = -1.0 / v20;
v10 = (__m128)0x3F800000u;
v10.f32[0] = 1.0 / v20;
kmMat4OrthographicProjection((__int64)v15, v7, v8, v9, v10, -1.0, 1.0);
kmGLMultMatrix((__int64)v15);
glGetIntegerv(0x8CA6u, (GLint *)(a1 + 336));
glBindFramebuffer(0x8D40u, *(_DWORD *)(a1 + 328));
v11 = cocos2d::CCConfiguration::sharedConfiguration();
v17 = 14;
strcpy(v18, "GL_QCOM");
v12 = cocos2d::CCConfiguration::checkForGLExtension(v11, (__int64)&v17);
if ( (v17 & 1) != 0 )
operator delete(__p);
if ( v12 )
{
v13 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 352) + 104LL))(*(_QWORD *)(a1 + 352));
glFramebufferTexture2D(0x8D40u, 0x8CE0u, 0xDE1u, v13, 0);
glClear(0x4100u);
v14 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 344) + 104LL))(*(_QWORD *)(a1 + 344));
glFramebufferTexture2D(0x8D40u, 0x8CE0u, 0xDE1u, v14, 0);
}
}