daily pastebin goal
89%
SHARE
TWEET

Untitled

a guest May 18th, 2018 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SuperStrict
  2.  
  3. Framework xorsteam.xors3d
  4. Import brl.basic
  5.  
  6. ' Window blah blah blah
  7. xCreateLog()
  8. xGraphics3D(800, 600)
  9. SeedRnd(MilliSecs())
  10.  
  11.  
  12.  
  13. ' Texture dimensions
  14. Const TEX_SIZE:Int = 256
  15.  
  16.  
  17. ' Fill by WritePixel
  18. Local texture:Int = xCreateTexture(TEX_SIZE, TEX_SIZE)
  19.  
  20.  
  21. ' Fill texture random
  22. For Local j:Int = 0 Until TEX_SIZE
  23.     For Local i:Int = 0 Until TEX_SIZE
  24.         ' Generate random color
  25.         Local color:Int = ColorARGB(255, Rand(255), Rand(255), Rand(255))
  26.        
  27.         ' Write pixel to texture 1
  28.         xWritePixel(i, j, color, xTextureBuffer(texture)) 'texture1_buffer)
  29.        
  30.         ' Write pixel fast to texture 2
  31.         'xWritePixelFast(i, j, color, texture2_buffer)
  32.     Next
  33. Next
  34.  
  35. End
  36. ' Save buffers
  37. 'xSaveBuffer(texture1_buffer, "xors_test_writepixel.bmp")
  38.  
  39.  
  40.  
  41. ' This function works fine! Tested in B3D, BlitzMax, MiniB3D and B3dSDK
  42. Function ColorARGB:Int(Alpha:Int, Red:Int, Green:Int, Blue:Int)
  43.     Return ((Alpha And 255) Shl 24) Or ((Red And 255) Shl 16) Or ((Green And 255) Shl 8) Or (Blue And 255)
  44. EndFunction
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top