3

I'm trying to reverse a game to see how it works using GLDebugger.. The window size if 765 x 553.

Texture2D 184 looks like: enter image description here

and Texture2D 203 looks like:

enter image description here

The result of the code is (ignore the dollar sign and exclamation mark): enter image description here

The code behind it all is:

glEnable(GL_SCISSOR_TEST)
glScissor(516, 335, 249, 168)
glEnable(GL_SCISSOR_TEST)
glScissor(550, 341, 154, 154)
glDisable(GL_TEXTURE_RECTANGLE)
glEnable(GL_TEXTURE_2D)

glBindTexture(GL_TEXTURE_2D, 184)
glActiveTextureARB(GL_TEXTURE1)
glEnable(GL_TEXTURE_RECTANGLE)
glBindTexture(GL_TEXTURE_RECTANGLE, 203)
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, 7681)
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, 8448)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, 34168)
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, 768)

glBegin(GL_QUADS)
glColor3f(1, 1, 1)
glMultiTexCoord2fARB(GL_TEXTURE0, 0, 1)
glMultiTexCoord2fARB(GL_TEXTURE1, -194.55215, 353.57529)
glVertex2f(355.44785, -141.57529)
glMultiTexCoord2fARB(GL_TEXTURE0, 0, 0)
glMultiTexCoord2fARB(GL_TEXTURE1, -212.4122, -194.13358)
glVertex2f(337.5878, 406.13358)
glMultiTexCoord2fARB(GL_TEXTURE0, 1, 0)
glMultiTexCoord2fARB(GL_TEXTURE1, 335.29663, -211.99362)
glVertex2f(885.29663, 423.99362)
glMultiTexCoord2fARB(GL_TEXTURE0, 1, 1)
glMultiTexCoord2fARB(GL_TEXTURE1, 353.15674, 335.71524)
glVertex2f(903.15674, -123.71524)
glEnd()

I want to know what the above code does because I want to know how such a large map turns into something so tiny :S

Can someone perhaps break it down or use these images or different images or anything at all to explain it?

4

1 回答 1

1

要认识到的重要一点是,很简单,这段代码所做的只是“剪掉”你所在的区域,在其上应用圆形过滤器,然后将其绘制在屏幕上。

需要 glEnable 才能使用 glScissor 命令。为什么他们启用它并连续使用它两次,这超出了我的理解。据我了解,此代码只需要启用和使用一次。

然后我们看到主纹理绑定到 GL_TEXTURE_2D,而较小的纹理绑定到 GL_TEXTURE_RECTANGLE。设置了许多环境标志,以便用作过滤器的 GL_TEXTURE_RECTANGLE 通过组合某些事物并在其他事物上使用源和操作数来产生正确的结果。

一旦我们进入glBegin,我们就开始实际绘制到屏幕上。glEnd 表示在屏幕上绘制的结束。

于 2012-11-19T03:52:51.657 回答