Rem Texture Made In Code Example
Rem By TDK_Man For The DBC Coding Challenges
Rem These textures are totally free to use in your own programs
Rem A mention of where they cam from would be nice - but not necessary! :)
 
Gosub Setup
Gosub MakeTextures
Gosub MakeObject
 
Do
  If ScanCode() Then Gosub ReTexture
  XAngle# = WrapValue(Object Angle X(1)+0.5)
  YAngle# = WrapValue(Object Angle Y(1)+0.5)
  ZAngle# = WrapValue(Object Angle Z(1)+0.5)
  Rotate Object 1,XAngle#,YAngle#,ZAngle#
  Sync
  Center Text 400,4,"This Texture: "+TextureName$(TextureNum)
  Center Text 400,580,"Press Any Key For The Next Texture"
Loop
 
ReTexture:
  Inc TextureNum
  If TextureNum = NumTextures+1 Then TextureNum = 1
  Texture Object 1,TextureNum
  Repeat
  Until ScanCode() = 0
Return
 
MakeObject:
  Make Object Cube 1,20
  Texture Object 1,TextureNum
  Set Object 1,1,0,0
  Position Camera 0,10,-30
  Point Camera 0,0,0
  Set Camera View 0,0,800,600
Return
 
MakeTextures:
  Create Bitmap 1,1024,768
 
  Rem 1. Brick
  Ink RGB(164,53,4),0: Box 0,0,60,28
  Get Image 2000,0,0,60,28
  CLS 0
  Ink RGB(190,190,170),0: Box 0,0,512,512
  For Ny=0 To 15
    For Nx=0 To 9
      Paste Image 2000,Nx*64-Offset,Ny*32
      Ink RGB(14,8,8),0
      For N=1 To Rnd(500)+500
        Dot (Nx*64-Offset)+Rnd(59),Ny*32+Rnd(27)
      Next N
    Next Nx
    Inc Offset,30: If Offset=60 Then Offset=0
  Next Ny
  Blur Bitmap 1,1
  Get Image 1,0,0,512,512
 
  Rem 2. Castle Wall
  CLS RGB(200,200,200): Ink RGB(90,90,100),0
  For N=0 To 3: Circle 6,6,4-N: Next N
  For N=0 To 3: Circle 123,6,4-N: Next N
  For N=0 To 3: Circle 6,59,4-N: Next N
  For N=0 To 3: Circle 123,59,4-N: Next N
  Box 6,2,124,63: Box 2,6,127,59
  For N=1 To 4000
    C=Rnd(200): Ink RGB(C,C,C),0: Dot Rnd(122)+4,Rnd(58)+4
  Next N
  Sync
  Get Image 100,0,0,128,64
  For Ny=0 To 15
    For Nx=0 To 9
      Paste Image 100,Nx*128-Offset,Ny*64
    Next Nx
    Inc Offset,64: If Offset=128 Then Offset=0
  Next Ny
  Delete Image 100
  Blur Bitmap 1,1
  Get Image 2,0,0,512,512
 
  Rem 3. Sand
  CLS RGB(200,180,70)
  For N=1 To 10000
    Shade = Rnd(105)+100
    Ink RGB(Shade,Shade,0),0
    Dot Rnd(512),Rnd(512)
  Next N
  Blur Bitmap 1,1
  Get Image 3,0,0,512,512
 
  Rem 4. Floor
  CLS RGB(200,200,200)
  Ink RGB(90,90,100),0
  Box 4,4,204,104
  For N=1 To 3000
    C=Rnd(200)
    Ink RGB(C,C,C),0: Dot Rnd(196)+4,Rnd(100)+4
  Next N
  Get Image 100,0,0,208,108
  For N=1 To 350
    X=Rnd(512): X=(X/64)*64
    Y=Rnd(512): Y=(Y/64)*64
    Paste Image 100,X,Y
  Next N
  Delete Image 100
  Blur Bitmap 1,1
  Get Image 4,0,0,512,512
 
  Rem 5. Water
  Shade=250
  For N=0 To 600
    Ink RGB(0,0,Shade),0: Line 0,N,800,N
    Dec Shade,8: If Shade<=100 Then Shade=250
  Next N
  Blur Bitmap 1,2
  For N=1 To 50
    Shade=150: X=Rnd(512): Y=Rnd(512): Rad=Rnd(10)+10
    For N2 = 1 To 5
      Ink RGB(0,0,Shade),0: Circle X,Y,Rad-N2
      Dec Shade,4
    Next N2
  Next N
  Blur Bitmap 1,2
  For N=1 To 300
    X=Rnd(592): Y=Rnd(570): Get Image 100,X,Y,X+20,Y+20,1
    X=Rnd(512): Y=Rnd(512): Paste Image 100,X,Y
  Next N
  Blur Bitmap 1,2
  For N=1 To 300
    Y=Rnd(600): X=Rnd(512): C=Rnd(55)+200
    Ink RGB(0,C,C),0: Box X,Y,X+20,Y
  Next N
  Blur Bitmap 1,2
  For N=1 To 200
    Y=Rnd(600): R=Rnd(600)
    If R<50
      Ink RGB(255,255,255),0
    Else
      Ink RGB(0,0,Rnd(155)+100),0
    Endif
    Line 0,Y,800,Y
  Next N
  Blur Bitmap 1,2
  sine#=4.0: velocity#=0
  For X=0 To 600
    IF sine#>=0
      Dec velocity#,.03
    ELSE
      Inc velocity#,.03
    Endif
    Inc sine#,velocity#
    Get Image 100,X,0,X+1,600,1: Paste Image 100,X,sine#-20
  Next X
  Delete Image 100
  Blur Bitmap 1,5
  Get Image 5,0,0,512,512
 
  Rem 6. SackCloth
  CLS RGB(155,155,0)
  For N=1 To 500
    Shade=Rnd(50)+100
    Ink RGB(Shade,Shade,0),0
    X=Rnd(512): Y=Rnd(512)
    Line X,0,X,512: Line 0,Y,512,Y
  Next N
  Blur Bitmap 1,4
  Get Image 6,0,0,512,512
 
  Rem 7. Redwood
  CLS RGB(110,20,10)
  For N=1 To 500
    Shade=Rnd(50)+100
    Ink RGB(Shade,Shade-60,0),0
    X=Rnd(512)
    Line X,0,X,512
  Next N
  Blur Bitmap 1,4
  Get Image 7,0,0,512,512
 
  Rem 8. Oak
  CLS RGB(250,240,200)
  For N=1 To 1000
    Shade=Rnd(100)+100
    Ink RGB(Shade,Shade-60,0),0
    X=Rnd(512)
    Line X,0,X,512
  Next N
  Blur Bitmap 1,4
  Get Image 8,0,0,512,512
 
  Rem 9. Pine
  CLS RGB(220,200,200)
  For N=1 To 1000
    Shade=Rnd(50)+100
    Ink RGB(Shade,Shade-30,0),0
    X=Rnd(512)
    Line X,0,X,512
  Next N
  Blur Bitmap 1,4
  Get Image 9,0,0,512,512
 
  Rem 10. Grass
  CLS RGB(0,40,0)
  For N=1 To 10000
    Ink RGB(Rnd(25),Rnd(155)+100,Rnd(25)),0
    Dot Rnd(512),Rnd(512)
  Next N
  Blur Bitmap 1,2
  Get Image 10,0,0,512,512
 
  Rem 11. RoofTile
  Ink RGB(164,83,4),0: Box 0,0,60,28
  Get Image 100,0,0,60,28
  CLS 0
  Ink RGB(60,10,10),0
  Box 0,0,512,512
  For Ny=0 To 15
    For Nx=0 To 8
      Paste Image 100,Nx*64-Offset,Ny*32
    Next Nx
    Inc Offset,30: If Offset=60 Then Offset=0
  Next Ny
  For N=1 To 10000
    Ink RGB(Rnd(255),Rnd(255),80),0
    Dot Rnd(512),Rnd(512)
  Next N
  Blur Bitmap 1,2
  Get Image 11,0,0,512,512
 
  Rem 12. Rusty Metal
  C=170: CLS RGB(C,C,C)
  For Y = 120 To 205
    Inc C
    Ink RGB(C,C,C),0
    Line 0,Y,512,Y
  Next Y
  For Y=205 To 290
    Dec C
    Ink RGB(C,C,C),0
    Line 0,Y,512,Y
  Next Y
  Blur Bitmap 1,2
  Ink RGB(207,90,5),0
  For I=1 To 10
    X=Rnd(512): Y=Rnd(512)
    For N=1 To 100
      X2=Rnd(200)-100: Y2=Rnd(200)-100
      Circle X+X2,Y+Y2,Rnd(2)+2
    Next N
    Blur Bitmap 1,6
  Next I
  Get Image 12,0,0,512,512
 
  Rem 13. Bathroom Tiles
  Ink RGB(100,100,255),0: Box 0,0,30,30
  Ink RGB(0,0,100),0: Box 1,1,30,30
  Ink RGB(0,80,200),0: Box 1,1,29,29
  Get Image 100,0,0,31,31
  CLS RGB(225,225,225)
  For Ny=0 To 31
    For Nx=0 To 31
      Paste Image 100,Nx*32+1,Ny*32+1
    Next Nx
  Next Ny
  Get Image 13,0,0,512,512
 
  Rem 14. Wooden Slats
  CLS 0
  For N=0 To 511 Step 32
    R=100: G=50: B=0
    Ink RGB(130,116,0),0
    Line 0,N,512,N
    Ink RGB(198,126,0),0
    For I=1 To 28
      Line 0,N+I,512,N+I
    Next I
    Ink RGB(255,245,159),0
    Line 0,N+29,512,N+29
  Next N
  Get Image 14,0,0,512,512
 
  Rem 15. Iron Bars
  CLS 0: C=95
  For I=0 To 5
    Ink RGB(C,C,C),0
    Line 0,I,512,I: Rem Horizontal
    Inc C,32
  Next I
  C=255
  For I=6 To 11
    Ink RGB(C,C,C),0
    Line 0,I,512,I: Rem Horizontal
    Dec C,32
  Next I
  Get Image 100,0,0,512,12
  CLS 0: C=95
  For I=0 To 5
    Ink RGB(C,C,C),0
    Line I,0,I,512: Rem Horizontal
    Inc C,32
  Next I
  C=255
  For I=6 To 11
    Ink RGB(C,C,C),0
    Line I,0,I,512: Rem Horizontal
    Dec C,32
  Next I
  Get Image 101,0,0,12,512
  CLS 0
  For N=1 To 16
    Paste Image 100,0,N*32-22: Rem Horiz
  Next N
  For N=1 To 16
    Paste Image 101,N*32-22,0
  Next N
  Delete Image 100
  Delete Image 101
  Get Image 15,0,0,512,512
 
  Rem 16. Fine Wire Mesh
  C=255
  CLS RGB(C,C,C)
  Rad=30
  For N=1 To 3
    For I=1 To 15
      Dec C,4
      Ink RGB(C,C,C),0
      Circle 256,256,Rad
      Inc Rad,2
    Next I
    For I=1 To 15
      Inc C,4
      Ink RGB(C,C,C),0
      Circle 256,256,Rad
      Inc Rad,2
    Next I
    Blur Bitmap 1,1
  Next N
  Blur Bitmap 1,4
  Ink 0,0
  For N=1 To 512 Step 4
    Line 0,N,512,N
    Line 0,N+1,512,N+1
    Line N,0,N,512
    Line N+1,0,N+1,512
  Next N
  Get Image 16,0,0,512,512
 
  Set Current Bitmap 0
  Delete Bitmap 1
  Ink RGB(255,255,255),0
Return
 
Setup:
  Set Display Mode 800,600,16
  Sync On: Sync Rate 60: CLS 0: Sync
  Backdrop On: Color Backdrop 0: Sync
  Hide Mouse
  Randomize Timer()
  TextureNum = 1: NumTextures = 16
  Dim TextureName$(20)
  TextureName$(1) = "Brick"
  TextureName$(2) = "Castle Wall"
  TextureName$(3) = "Sand"
  TextureName$(4) = "Floor"
  TextureName$(5) = "Water"
  TextureName$(6) = "Sackcloth"
  TextureName$(7) = "Redwood"
  TextureName$(8) = "Oak"
  TextureName$(9) = "Pine"
  TextureName$(10) = "Grass"
  TextureName$(11) = "Roof Tile"
  TextureName$(12) = "Rusty Metal"
  TextureName$(13) = "Swimming Pool Tiles"
  TextureName$(14) = "Wooden Slats"
  TextureName$(15) = "Steel Bars"
  TextureName$(16) = "Fine Wire Mesh"
  Center Text 400,240,"Please Wait - Generating Textures..."
  Set Camera View 0,0,1,1
Return