0

I have a 512x512 png image. It is loaded into a texture using SlickUtil, but I cannot figure out how to cut a specific quad from the texture to bind to my glQuad.

Its like a sprite sheet, where I could cut specific images from there.

4

1 回答 1

0

只需使用 OpenGL 纹理坐标即可。在旧的 GL 中,这将是:

glBegin (GL_QUADS);
  glTexCoord2f (0.0, 0.5); glVertex2f (0, 0);
  glTexCoord2f (0.5, 0.5); glVertex2f (1, 0);
  glTexCoord2f (0.5, 1.0); glVertex2f (1, 1);
  glTexCoord2f (0.0, 1.0); glVertex2f (0, 1);
glEnd ();

这将使用图像的左上四分之一。

于 2012-08-31T10:23:15.313 回答