31 procedure DrawSpriteRotated (Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); |
31 procedure DrawSpriteRotated (Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); |
32 procedure DrawSpriteRotatedF (Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); |
32 procedure DrawSpriteRotatedF (Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); |
33 |
33 |
34 procedure DrawTexture (X, Y: LongInt; Texture: PTexture); inline; |
34 procedure DrawTexture (X, Y: LongInt; Texture: PTexture); inline; |
35 procedure DrawTexture (X, Y: LongInt; Texture: PTexture; Scale: GLfloat); |
35 procedure DrawTexture (X, Y: LongInt; Texture: PTexture; Scale: GLfloat); |
|
36 procedure DrawTexture2 (X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat); |
36 procedure DrawTextureFromRect (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline; |
37 procedure DrawTextureFromRect (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline; |
37 procedure DrawTextureFromRect (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline; |
38 procedure DrawTextureFromRect (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline; |
38 procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture; Dir: LongInt); |
39 procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture; Dir: LongInt); |
39 procedure DrawTextureCentered (X, Top: LongInt; Source: PTexture); |
40 procedure DrawTextureCentered (X, Top: LongInt; Source: PTexture); |
40 procedure DrawTextureF (Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); |
41 procedure DrawTextureF (Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); |
165 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb)); |
166 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb)); |
166 |
167 |
167 glPopMatrix |
168 glPopMatrix |
168 end; |
169 end; |
169 |
170 |
|
171 { this contains tweaks in order to avoid land tile borders in blurry land mode } |
|
172 procedure DrawTexture2(X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat); |
|
173 var |
|
174 TextureBuffer: array [0..3] of TVertex2f; |
|
175 begin |
|
176 glPushMatrix(); |
|
177 glTranslatef(X, Y, 0); |
|
178 glScalef(Scale, Scale, 1); |
|
179 |
|
180 glBindTexture(GL_TEXTURE_2D, Texture^.id); |
|
181 |
|
182 TextureBuffer[0].X:= Texture^.tb[0].X + Overlap; |
|
183 TextureBuffer[0].Y:= Texture^.tb[0].Y + Overlap; |
|
184 TextureBuffer[1].X:= Texture^.tb[1].X - Overlap; |
|
185 TextureBuffer[1].Y:= Texture^.tb[1].Y + Overlap; |
|
186 TextureBuffer[2].X:= Texture^.tb[2].X - Overlap; |
|
187 TextureBuffer[2].Y:= Texture^.tb[2].Y - Overlap; |
|
188 TextureBuffer[3].X:= Texture^.tb[3].X + Overlap; |
|
189 TextureBuffer[3].Y:= Texture^.tb[3].Y - Overlap; |
|
190 |
|
191 glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb); |
|
192 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer); |
|
193 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb)); |
|
194 |
|
195 glPopMatrix(); |
|
196 end; |
|
197 |
170 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); |
198 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt); |
171 begin |
199 begin |
172 DrawTextureRotatedF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0) |
200 DrawTextureRotatedF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0) |
173 end; |
201 end; |
174 |
202 |