All pastes #95223 Raw Edit

Miscellany

public text v1 · immutable
#95223 ·published 2006-07-21 21:02 UTC
rendered paste body
procedure TLBlitterGL.Blit_Tex_Scr(const scr, img: TLGraphic; src, dst: PLRect);
var
  x: Longint = 0;
  y: Longint = 0;
  w, h: Cardinal;
begin
  if Assigned(dst) then begin
    x:=dst^.x; y:=dst^.y;
    w:=dst^.w; h:=dst^.h;
  end else begin
    w:=scr.w;
    h:=scr.h;
  end;
  
  with PLGLRec(scr.Data)^ do begin
    glBindTexture(GL_TEXTURE_2D, Texture);
    Writeln('Doing it Texture = ', Texture, ' x = ', x, ' y = ', y, ' w = ', w, ' h = ', h, ' SX = ', StretchX, ' SY = ', StretchY);
    glBegin(GL_QUADS);
      glTexCoord2f(0       ,        0); glVertex2i(x    ,     y);
      glTexCoord2f(StretchX,        0); glVertex2i(x + w,     y);
      glTexCoord2f(StretchX, StretchY); glVertex2i(x + w, y + h);
      glTexCoord2f(0       , StretchY); glVertex2i(x    , y + h);
    glEnd();
  end;
end;