Canvas

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Canvas

Post by Kjell »

:!:

Shader-less canvas ( fullscreen sprite ) for use with for example RenderTarget. Takes the texture coordinates as arguments ( usually 1,1 unless you're using AutoPowerOfTwo ). Assumes being called from GL_MODELVIEW mode.

Code: Select all

void renderCanvas(float S, float T)
{
  glPushMatrix();
  glLoadIdentity();

  glMatrixMode(0x1701);
  glPushMatrix();
  glLoadIdentity();

  glBegin(0x7);
  glTexCoord2f(0,0); glVertex2i(-1,-1);
  glTexCoord2f(S,0); glVertex2i( 1,-1);
  glTexCoord2f(S,T); glVertex2i( 1, 1);
  glTexCoord2f(0,T); glVertex2i(-1, 1);
  glEnd();

  glPopMatrix();

  glMatrixMode(0x1700);
  glPopMatrix();
}
K
Post Reply