Author Topic: 3D Polygon Graphic Maker  (Read 1922 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
3D Polygon Graphic Maker
« on: August 28, 2020, 10:01:23 pm »
I'm extremely close to finishing this program but I am at my usual standstill with the _PUTIMAGE and _COPYIMAGE commands it's driving me nuts again. Can someone tell me why this isn't working? When I press the left mouse button it's supposed to place the shape onto the screen so someone can make a new shape for the same screen. Of course CLS clears it in every loop but it should still work with COPYIMAGE and PUTIMAGE and DISPLAY. Read the _TITLE for instructions on how to use it. The amazing thing is, I was just experimenting with my other shapes maker and I added a loop and here's 3D. :) So I added depth changes, rotation, size changes, and location with the mouse. The main loop starts at line 103. I'm also wondering if I have to use 2 NEWIMAGE's like I have here, would CLIPBOARDIMAGE still work when it can only do one image? Any help is appreciated, thanks.

Code: QB64: [Select]
  1. start:
  2. sides = 3
  3. length = 150
  4. full = 0
  5. c = 0
  6. _TITLE "Mouse To Locate, Mouse Wheel To Change Sides, C To Copy To Clipboard, +/- To Change Size, Arrow Keys To Change Depth And Rotate."
  7. image& = _NEWIMAGE(1000, 800, 32)
  8. SCREEN image&
  9.  
  10. PRINT "                                      Polygon Maker"
  11. PRINT "                          By SierraKen (with some help from B+!)"
  12. full:
  13. INPUT "Select Color Emptiness (1-50 Where 50 Being Most Empty.)", full
  14. IF full > 50 OR full < 1 OR full <> INT(full) THEN GOTO full:
  15. full = full / 10
  16.  
  17. colors:
  18. c = c + 1
  19.  
  20. IF c = 1 THEN LOCATE 2, 45: PRINT "Click A Shape Color With Your Mouse"
  21. IF c = 2 THEN LOCATE 2, 45: PRINT "      Click A Background Color"
  22.  
  23. 'Color Wheel
  24. FOR r = 1 TO 255 STEP 2
  25.     sz = sz + .2
  26.     CIRCLE (500, 400), sz, _RGB32(r, 0, 0)
  27. FOR g = 1 TO 255 STEP 2
  28.     sz = sz + .2
  29.     CIRCLE (500, 400), sz, _RGB32(0, g, 0)
  30. FOR b = 1 TO 255 STEP 2
  31.     sz = sz + .2
  32.     CIRCLE (500, 400), sz, _RGB32(0, 0, b)
  33. FOR rg = 1 TO 255 STEP 2
  34.     sz = sz + .2
  35.     CIRCLE (500, 400), sz, _RGB32(rg, rg, 0)
  36. NEXT rg
  37. FOR gb = 1 TO 255 STEP 2
  38.     sz = sz + .2
  39.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb)
  40. NEXT gb
  41. FOR rb = 1 TO 255 STEP 2
  42.     sz = sz + .2
  43.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb)
  44. NEXT rb
  45. FOR rg = 1 TO 255 STEP 2
  46.     sz = sz + .2
  47.     CIRCLE (500, 400), sz, _RGB32(rg, rg / 2, 0)
  48. NEXT rg
  49. FOR rg = 1 TO 255 STEP 2
  50.     sz = sz + .2
  51.     CIRCLE (500, 400), sz, _RGB32(rg / 2, rg, 0)
  52. NEXT rg
  53. FOR gb = 1 TO 255 STEP 2
  54.     sz = sz + .2
  55.     CIRCLE (500, 400), sz, _RGB32(0, gb / 2, gb)
  56. NEXT gb
  57. FOR gb = 1 TO 255 STEP 2
  58.     sz = sz + .2
  59.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb / 2)
  60. NEXT gb
  61. FOR rb = 1 TO 255 STEP 2
  62.     sz = sz + .2
  63.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb / 2)
  64. NEXT rb
  65. FOR rb = 1 TO 255 STEP 2
  66.     sz = sz + .2
  67.     CIRCLE (500, 400), sz, _RGB32(rb / 2, 0, rb)
  68. NEXT rb
  69. FOR w = 1 TO 255 STEP 2
  70.     sz = sz + .2
  71.     CIRCLE (500, 400), sz, _RGB32(w, w, w)
  72. sz = 0
  73. mouseLeftButton = 0
  74.     _LIMIT 7
  75.     mouseWheel = 0
  76.         mouseX = _MOUSEX
  77.         mouseY = _MOUSEY
  78.         mouseLeftButton = _MOUSEBUTTON(1)
  79.         mouseRightButton = _MOUSEBUTTON(2)
  80.         mouseMiddleButton = _MOUSEBUTTON(3)
  81.         mouseWheel = mouseWheel + _MOUSEWHEEL
  82.     LOOP
  83.     IF mouseLeftButton = -1 AND c = 1 THEN mouseLeftButton = 0: col& = POINT(mouseX, mouseY): GOTO colors:
  84.     IF mouseLeftButton = -1 AND c = 2 THEN mouseLeftButton = 0: backcol& = POINT(mouseX, mouseY): GOTO nex:
  85.  
  86. 'Create Shape
  87. nex:
  88. COLOR , backcol&
  89. image2& = _NEWIMAGE(800, 600, 32)
  90.     CLS
  91.     _LIMIT 300
  92.     SCREEN image&, image2&
  93.     mouseWheel = 0
  94.         mouseX = _MOUSEX
  95.         mouseY = _MOUSEY
  96.         mouseLeftButton = _MOUSEBUTTON(1)
  97.         mouseRightButton = _MOUSEBUTTON(2)
  98.         mouseMiddleButton = _MOUSEBUTTON(3)
  99.         mouseWheel = mouseWheel + _MOUSEWHEEL
  100.     LOOP
  101.     a$ = INKEY$
  102.     IF a$ = " " THEN GOTO start:
  103.     IF a$ = CHR$(27) THEN END
  104.     IF a$ = "+" THEN length = length + 1
  105.     IF a$ = "-" THEN length = length - 1
  106.     IF a$ = CHR$(0) + CHR$(77) THEN a = a + 1
  107.     IF a$ = CHR$(0) + CHR$(75) THEN a = a - 1
  108.     IF a$ = CHR$(0) + CHR$(72) THEN v = v + 1
  109.     IF a$ = CHR$(0) + CHR$(80) THEN v = v - 1
  110.     IF v < -149 THEN v = -149
  111.     IF v > 400 THEN v = 400
  112.     IF a < 0 THEN a = 360
  113.     IF a > 360 THEN a = 0
  114.     IF length > 800 THEN length = 800
  115.     IF length < 5 THEN length = 5
  116.     IF mouseWheel = -1 THEN sides = sides + 1
  117.     IF mouseWheel = 1 THEN sides = sides - 1
  118.     IF sides < 3 THEN sides = 3
  119.     IF sides > 20 THEN sides = 20
  120.  
  121.     FOR t = .25 TO length + v STEP full
  122.         FOR angle = 1 + a TO 360 + a STEP 360 / sides
  123.             oldx = x
  124.             oldy = y
  125.             x = (COS(_D2R(angle)) * length) + mouseX
  126.             y = (SIN(_D2R(angle)) * length) + mouseY
  127.             LINE (x - t, y - t)-(oldx - t, oldy - t), col&
  128.         NEXT angle
  129.     NEXT t
  130.     IF a$ = "C" OR a$ = "c" THEN _CLIPBOARDIMAGE = image&
  131.     IF mouseLeftButton THEN image2& = _COPYIMAGE(0)
  132.     _PUTIMAGE , image&, image2&
  133.     _DISPLAY
  134.  


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: 3D Polygon Graphic Maker
« Reply #1 on: August 28, 2020, 10:28:55 pm »
Like this?
Code: QB64: [Select]
  1. start:
  2. sides = 3
  3. length = 150
  4. full = 0
  5. c = 0
  6. _TITLE "Mouse To Locate, Mouse Wheel To Change Sides, C To Copy To Clipboard, +/- To Change Size, Arrow Keys To Change Depth And Rotate."
  7. SCREEN _NEWIMAGE(1000, 700, 32)
  8.  
  9.  
  10. PRINT "                                      Polygon Maker"
  11. PRINT "                          By SierraKen (with some help from B+!)"
  12. full:
  13. INPUT "Select Color Emptiness (1-50 Where 50 Being Most Empty.)", full
  14. IF full > 50 OR full < 1 OR full <> INT(full) THEN GOTO full:
  15. full = full / 10
  16.  
  17. colors:
  18. c = c + 1
  19.  
  20. IF c = 1 THEN LOCATE 2, 45: PRINT "Click A Shape Color With Your Mouse"
  21. IF c = 2 THEN LOCATE 2, 45: PRINT "      Click A Background Color"
  22.  
  23. 'Color Wheel
  24. FOR r = 1 TO 255 STEP 2
  25.     sz = sz + .2
  26.     CIRCLE (500, 400), sz, _RGB32(r, 0, 0)
  27. FOR g = 1 TO 255 STEP 2
  28.     sz = sz + .2
  29.     CIRCLE (500, 400), sz, _RGB32(0, g, 0)
  30. FOR b = 1 TO 255 STEP 2
  31.     sz = sz + .2
  32.     CIRCLE (500, 400), sz, _RGB32(0, 0, b)
  33. FOR rg = 1 TO 255 STEP 2
  34.     sz = sz + .2
  35.     CIRCLE (500, 400), sz, _RGB32(rg, rg, 0)
  36. NEXT rg
  37. FOR gb = 1 TO 255 STEP 2
  38.     sz = sz + .2
  39.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb)
  40. NEXT gb
  41. FOR rb = 1 TO 255 STEP 2
  42.     sz = sz + .2
  43.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb)
  44. NEXT rb
  45. FOR rg = 1 TO 255 STEP 2
  46.     sz = sz + .2
  47.     CIRCLE (500, 400), sz, _RGB32(rg, rg / 2, 0)
  48. NEXT rg
  49. FOR rg = 1 TO 255 STEP 2
  50.     sz = sz + .2
  51.     CIRCLE (500, 400), sz, _RGB32(rg / 2, rg, 0)
  52. NEXT rg
  53. FOR gb = 1 TO 255 STEP 2
  54.     sz = sz + .2
  55.     CIRCLE (500, 400), sz, _RGB32(0, gb / 2, gb)
  56. NEXT gb
  57. FOR gb = 1 TO 255 STEP 2
  58.     sz = sz + .2
  59.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb / 2)
  60. NEXT gb
  61. FOR rb = 1 TO 255 STEP 2
  62.     sz = sz + .2
  63.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb / 2)
  64. NEXT rb
  65. FOR rb = 1 TO 255 STEP 2
  66.     sz = sz + .2
  67.     CIRCLE (500, 400), sz, _RGB32(rb / 2, 0, rb)
  68. NEXT rb
  69. FOR w = 1 TO 255 STEP 2
  70.     sz = sz + .2
  71.     CIRCLE (500, 400), sz, _RGB32(w, w, w)
  72. sz = 0
  73. mouseLeftButton = 0
  74.     _LIMIT 7
  75.     mouseWheel = 0
  76.         mouseX = _MOUSEX
  77.         mouseY = _MOUSEY
  78.         mouseLeftButton = _MOUSEBUTTON(1)
  79.         mouseRightButton = _MOUSEBUTTON(2)
  80.         mouseMiddleButton = _MOUSEBUTTON(3)
  81.         mouseWheel = mouseWheel + _MOUSEWHEEL
  82.     LOOP
  83.     IF mouseLeftButton = -1 AND c = 1 THEN mouseLeftButton = 0: col& = POINT(mouseX, mouseY): GOTO colors:
  84.     IF mouseLeftButton = -1 AND c = 2 THEN mouseLeftButton = 0: backcol& = POINT(mouseX, mouseY): GOTO nex:
  85.  
  86. 'Create Shape
  87. nex:
  88. COLOR , backcol&
  89. image2& = _NEWIMAGE(1000, 700, 32)
  90. _PUTIMAGE , 0, image2& 'screen to image
  91.     _PUTIMAGE , image2&, 0 'image to screen
  92.     _LIMIT 300
  93.  
  94.     mouseWheel = 0
  95.         mouseX = _MOUSEX
  96.         mouseY = _MOUSEY
  97.         mouseLeftButton = _MOUSEBUTTON(1)
  98.         mouseRightButton = _MOUSEBUTTON(2)
  99.         mouseMiddleButton = _MOUSEBUTTON(3)
  100.         mouseWheel = mouseWheel + _MOUSEWHEEL
  101.     LOOP
  102.     a$ = INKEY$
  103.     IF a$ = " " THEN GOTO start:
  104.     IF a$ = CHR$(27) THEN END
  105.     IF a$ = "+" THEN length = length + 1
  106.     IF a$ = "-" THEN length = length - 1
  107.     IF a$ = CHR$(0) + CHR$(77) THEN a = a + 1
  108.     IF a$ = CHR$(0) + CHR$(75) THEN a = a - 1
  109.     IF a$ = CHR$(0) + CHR$(72) THEN v = v + 1
  110.     IF a$ = CHR$(0) + CHR$(80) THEN v = v - 1
  111.     IF v < -149 THEN v = -149
  112.     IF v > 400 THEN v = 400
  113.     IF a < 0 THEN a = 360
  114.     IF a > 360 THEN a = 0
  115.     IF length > 800 THEN length = 800
  116.     IF length < 5 THEN length = 5
  117.     IF mouseWheel = -1 THEN sides = sides + 1
  118.     IF mouseWheel = 1 THEN sides = sides - 1
  119.     IF sides < 3 THEN sides = 3
  120.     IF sides > 20 THEN sides = 20
  121.  
  122.     FOR t = .25 TO length + v STEP full
  123.         FOR angle = 1 + a TO 360 + a STEP 360 / sides
  124.             oldx = x
  125.             oldy = y
  126.             x = (COS(_D2R(angle)) * length) + mouseX
  127.             y = (SIN(_D2R(angle)) * length) + mouseY
  128.             LINE (x - t, y - t)-(oldx - t, oldy - t), col&
  129.         NEXT angle
  130.     NEXT t
  131.     IF a$ = "C" OR a$ = "c" THEN _CLIPBOARDIMAGE = image&
  132.     IF mouseLeftButton THEN _PUTIMAGE , 0, image2& ' screen to image2
  133.  
  134.     _DISPLAY
  135.  
  136.  
  137.  
Save objects to screen.PNG


I am impressed how you figured to rotate the sides!
« Last Edit: August 28, 2020, 10:30:03 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
Re: 3D Polygon Graphic Maker
« Reply #2 on: August 28, 2020, 11:02:38 pm »
Thanks Tons B+! :)). I did notice that the background color was gone, so I fixed it. Yeah rotating the polygons were actually pretty easy if you just add to the angle up to 360 and then shift back to 0 and the other way around. :) I used your code from earlier on my other shapes program for the COS and SIN equations. There one MINOR thing that would be nice on this program is if when you press C to copy the image to the buffer, it doesn't copy the current polygon that's being moved around with the mouse. I think that would have to deal with another COPYIMAGE or something and since you have helped me this far, I'm not going to try and make it worse by me. LOL People can just use the last polygon as part of their image. Thanks again B+, I see what you did with PUTIMAGE on the mouse click. This will be a good learning example for my future works.

Code: QB64: [Select]
  1. start:
  2. sides = 3
  3. length = 150
  4. full = 0
  5. c = 0
  6. _TITLE "Mouse To Locate, Mouse Wheel To Change Sides, C To Copy To Clipboard, +/- To Change Size, Arrow Keys To Change Depth And Rotate."
  7. SCREEN _NEWIMAGE(1000, 700, 32)
  8.  
  9.  
  10. PRINT "                                      Polygon Maker"
  11. PRINT "                          By SierraKen (with some help from B+!)"
  12. full:
  13. INPUT "Select Color Emptiness (1-50 Where 50 Being Most Empty.)", full
  14. IF full > 50 OR full < 1 OR full <> INT(full) THEN GOTO full:
  15. full = full / 10
  16.  
  17. colors:
  18. c = c + 1
  19.  
  20. IF c = 1 THEN LOCATE 2, 45: PRINT "Click A Shape Color With Your Mouse"
  21. IF c = 2 THEN LOCATE 2, 45: PRINT "      Click A Background Color"
  22.  
  23. 'Color Wheel
  24. FOR r = 1 TO 255 STEP 2
  25.     sz = sz + .2
  26.     CIRCLE (500, 400), sz, _RGB32(r, 0, 0)
  27. FOR g = 1 TO 255 STEP 2
  28.     sz = sz + .2
  29.     CIRCLE (500, 400), sz, _RGB32(0, g, 0)
  30. FOR b = 1 TO 255 STEP 2
  31.     sz = sz + .2
  32.     CIRCLE (500, 400), sz, _RGB32(0, 0, b)
  33. FOR rg = 1 TO 255 STEP 2
  34.     sz = sz + .2
  35.     CIRCLE (500, 400), sz, _RGB32(rg, rg, 0)
  36. NEXT rg
  37. FOR gb = 1 TO 255 STEP 2
  38.     sz = sz + .2
  39.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb)
  40. NEXT gb
  41. FOR rb = 1 TO 255 STEP 2
  42.     sz = sz + .2
  43.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb)
  44. NEXT rb
  45. FOR rg = 1 TO 255 STEP 2
  46.     sz = sz + .2
  47.     CIRCLE (500, 400), sz, _RGB32(rg, rg / 2, 0)
  48. NEXT rg
  49. FOR rg = 1 TO 255 STEP 2
  50.     sz = sz + .2
  51.     CIRCLE (500, 400), sz, _RGB32(rg / 2, rg, 0)
  52. NEXT rg
  53. FOR gb = 1 TO 255 STEP 2
  54.     sz = sz + .2
  55.     CIRCLE (500, 400), sz, _RGB32(0, gb / 2, gb)
  56. NEXT gb
  57. FOR gb = 1 TO 255 STEP 2
  58.     sz = sz + .2
  59.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb / 2)
  60. NEXT gb
  61. FOR rb = 1 TO 255 STEP 2
  62.     sz = sz + .2
  63.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb / 2)
  64. NEXT rb
  65. FOR rb = 1 TO 255 STEP 2
  66.     sz = sz + .2
  67.     CIRCLE (500, 400), sz, _RGB32(rb / 2, 0, rb)
  68. NEXT rb
  69. FOR w = 1 TO 255 STEP 2
  70.     sz = sz + .2
  71.     CIRCLE (500, 400), sz, _RGB32(w, w, w)
  72. sz = 0
  73. mouseLeftButton = 0
  74.     _LIMIT 7
  75.     mouseWheel = 0
  76.         mouseX = _MOUSEX
  77.         mouseY = _MOUSEY
  78.         mouseLeftButton = _MOUSEBUTTON(1)
  79.         mouseRightButton = _MOUSEBUTTON(2)
  80.         mouseMiddleButton = _MOUSEBUTTON(3)
  81.         mouseWheel = mouseWheel + _MOUSEWHEEL
  82.     LOOP
  83.     IF mouseLeftButton = -1 AND c = 1 THEN mouseLeftButton = 0: col& = POINT(mouseX, mouseY): GOTO colors:
  84.     IF mouseLeftButton = -1 AND c = 2 THEN mouseLeftButton = 0: backcol& = POINT(mouseX, mouseY): GOTO nex:
  85.  
  86. 'Create Shape
  87. nex:
  88. mouseLeftButton = 0
  89. PAINT (2, 2), backcol&
  90. image2& = _NEWIMAGE(1000, 700, 32)
  91. _PUTIMAGE , 0, image2& 'screen to image
  92.     _PUTIMAGE , image2&, 0 'image to screen
  93.     _LIMIT 300
  94.  
  95.     mouseWheel = 0
  96.         mouseX = _MOUSEX
  97.         mouseY = _MOUSEY
  98.         mouseLeftButton = _MOUSEBUTTON(1)
  99.         mouseRightButton = _MOUSEBUTTON(2)
  100.         mouseMiddleButton = _MOUSEBUTTON(3)
  101.         mouseWheel = mouseWheel + _MOUSEWHEEL
  102.     LOOP
  103.     a$ = INKEY$
  104.     IF a$ = " " THEN GOTO start:
  105.     IF a$ = CHR$(27) THEN END
  106.     IF a$ = "+" THEN length = length + 1
  107.     IF a$ = "-" THEN length = length - 1
  108.     IF a$ = CHR$(0) + CHR$(77) THEN a = a + 1
  109.     IF a$ = CHR$(0) + CHR$(75) THEN a = a - 1
  110.     IF a$ = CHR$(0) + CHR$(72) THEN v = v + 1
  111.     IF a$ = CHR$(0) + CHR$(80) THEN v = v - 1
  112.     IF v < -149 THEN v = -149
  113.     IF v > 400 THEN v = 400
  114.     IF a < 0 THEN a = 360
  115.     IF a > 360 THEN a = 0
  116.     IF length > 800 THEN length = 800
  117.     IF length < 5 THEN length = 5
  118.     IF mouseWheel = -1 THEN sides = sides + 1
  119.     IF mouseWheel = 1 THEN sides = sides - 1
  120.     IF sides < 3 THEN sides = 3
  121.     IF sides > 20 THEN sides = 20
  122.  
  123.     FOR t = .25 TO length + v STEP full
  124.         FOR angle = 1 + a TO 360 + a STEP 360 / sides
  125.             oldx = x
  126.             oldy = y
  127.             x = (COS(_D2R(angle)) * length) + mouseX
  128.             y = (SIN(_D2R(angle)) * length) + mouseY
  129.             LINE (x - t, y - t)-(oldx - t, oldy - t), col&
  130.         NEXT angle
  131.     NEXT t
  132.     IF a$ = "C" OR a$ = "c" THEN _CLIPBOARDIMAGE = image&
  133.     IF mouseLeftButton THEN _PUTIMAGE , 0, image2& ' screen to image2
  134.     _DISPLAY
  135.  
3D Polygons.jpg
* 3D Polygons.jpg (Filesize: 365.32 KB, Dimensions: 1000x700, Views: 189)
« Last Edit: August 28, 2020, 11:03:44 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: 3D Polygon Graphic Maker
« Reply #3 on: August 28, 2020, 11:08:29 pm »
If you want the image without the current polygon, you already have it stored in image2&. That is what is being put up on screen before each redraw of current poly.
« Last Edit: August 28, 2020, 11:11:11 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
Re: 3D Polygon Graphic Maker
« Reply #4 on: August 28, 2020, 11:24:19 pm »
ROFL AWESOME!!! Thanks :).

Here is the update and a picture of 2 houses I made with it in just a couple minutes. 

Code: QB64: [Select]
  1. start:
  2. sides = 3
  3. length = 150
  4. full = 0
  5. c = 0
  6. _TITLE "Mouse To Locate, Mouse Wheel To Change Sides, C To Copy To Clipboard, +/- To Change Size, Arrow Keys To Change Depth And Rotate."
  7. SCREEN _NEWIMAGE(1000, 700, 32)
  8.  
  9.  
  10. PRINT "                                      Polygon Maker"
  11. PRINT "                          By SierraKen (with some help from B+!)"
  12. full:
  13. INPUT "Select Color Emptiness (1-50 Where 50 Being Most Empty.)", full
  14. IF full > 50 OR full < 1 OR full <> INT(full) THEN GOTO full:
  15. full = full / 10
  16.  
  17. colors:
  18. c = c + 1
  19.  
  20. IF c = 1 THEN LOCATE 2, 45: PRINT "Click A Shape Color With Your Mouse"
  21. IF c = 2 THEN LOCATE 2, 45: PRINT "      Click A Background Color"
  22.  
  23. 'Color Wheel
  24. FOR r = 1 TO 255 STEP 2
  25.     sz = sz + .2
  26.     CIRCLE (500, 400), sz, _RGB32(r, 0, 0)
  27. FOR g = 1 TO 255 STEP 2
  28.     sz = sz + .2
  29.     CIRCLE (500, 400), sz, _RGB32(0, g, 0)
  30. FOR b = 1 TO 255 STEP 2
  31.     sz = sz + .2
  32.     CIRCLE (500, 400), sz, _RGB32(0, 0, b)
  33. FOR rg = 1 TO 255 STEP 2
  34.     sz = sz + .2
  35.     CIRCLE (500, 400), sz, _RGB32(rg, rg, 0)
  36. NEXT rg
  37. FOR gb = 1 TO 255 STEP 2
  38.     sz = sz + .2
  39.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb)
  40. NEXT gb
  41. FOR rb = 1 TO 255 STEP 2
  42.     sz = sz + .2
  43.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb)
  44. NEXT rb
  45. FOR rg = 1 TO 255 STEP 2
  46.     sz = sz + .2
  47.     CIRCLE (500, 400), sz, _RGB32(rg, rg / 2, 0)
  48. NEXT rg
  49. FOR rg = 1 TO 255 STEP 2
  50.     sz = sz + .2
  51.     CIRCLE (500, 400), sz, _RGB32(rg / 2, rg, 0)
  52. NEXT rg
  53. FOR gb = 1 TO 255 STEP 2
  54.     sz = sz + .2
  55.     CIRCLE (500, 400), sz, _RGB32(0, gb / 2, gb)
  56. NEXT gb
  57. FOR gb = 1 TO 255 STEP 2
  58.     sz = sz + .2
  59.     CIRCLE (500, 400), sz, _RGB32(0, gb, gb / 2)
  60. NEXT gb
  61. FOR rb = 1 TO 255 STEP 2
  62.     sz = sz + .2
  63.     CIRCLE (500, 400), sz, _RGB32(rb, 0, rb / 2)
  64. NEXT rb
  65. FOR rb = 1 TO 255 STEP 2
  66.     sz = sz + .2
  67.     CIRCLE (500, 400), sz, _RGB32(rb / 2, 0, rb)
  68. NEXT rb
  69. FOR w = 1 TO 255 STEP 2
  70.     sz = sz + .2
  71.     CIRCLE (500, 400), sz, _RGB32(w, w, w)
  72. sz = 0
  73. mouseLeftButton = 0
  74.     _LIMIT 7
  75.     mouseWheel = 0
  76.         mouseX = _MOUSEX
  77.         mouseY = _MOUSEY
  78.         mouseLeftButton = _MOUSEBUTTON(1)
  79.         mouseRightButton = _MOUSEBUTTON(2)
  80.         mouseMiddleButton = _MOUSEBUTTON(3)
  81.         mouseWheel = mouseWheel + _MOUSEWHEEL
  82.     LOOP
  83.     IF mouseLeftButton = -1 AND c = 1 THEN mouseLeftButton = 0: col& = POINT(mouseX, mouseY): GOTO colors:
  84.     IF mouseLeftButton = -1 AND c = 2 THEN mouseLeftButton = 0: backcol& = POINT(mouseX, mouseY): GOTO nex:
  85.  
  86. 'Create Shape
  87. nex:
  88. mouseLeftButton = 0
  89. PAINT (2, 2), backcol&
  90. image2& = _NEWIMAGE(1000, 700, 32)
  91. _PUTIMAGE , 0, image2& 'screen to image
  92.     _PUTIMAGE , image2&, 0 'image to screen
  93.     _LIMIT 300
  94.  
  95.     mouseWheel = 0
  96.         mouseX = _MOUSEX
  97.         mouseY = _MOUSEY
  98.         mouseLeftButton = _MOUSEBUTTON(1)
  99.         mouseRightButton = _MOUSEBUTTON(2)
  100.         mouseMiddleButton = _MOUSEBUTTON(3)
  101.         mouseWheel = mouseWheel + _MOUSEWHEEL
  102.     LOOP
  103.     a$ = INKEY$
  104.     IF a$ = " " THEN GOTO start:
  105.     IF a$ = CHR$(27) THEN END
  106.     IF a$ = "+" THEN length = length + 1
  107.     IF a$ = "-" THEN length = length - 1
  108.     IF a$ = CHR$(0) + CHR$(77) THEN a = a + 1
  109.     IF a$ = CHR$(0) + CHR$(75) THEN a = a - 1
  110.     IF a$ = CHR$(0) + CHR$(72) THEN v = v + 1
  111.     IF a$ = CHR$(0) + CHR$(80) THEN v = v - 1
  112.     IF v < -149 THEN v = -149
  113.     IF v > 400 THEN v = 400
  114.     IF a < 0 THEN a = 360
  115.     IF a > 360 THEN a = 0
  116.     IF length > 800 THEN length = 800
  117.     IF length < 5 THEN length = 5
  118.     IF mouseWheel = -1 THEN sides = sides + 1
  119.     IF mouseWheel = 1 THEN sides = sides - 1
  120.     IF sides < 3 THEN sides = 3
  121.     IF sides > 20 THEN sides = 20
  122.  
  123.     FOR t = .25 TO length + v STEP full
  124.         FOR angle = 1 + a TO 360 + a STEP 360 / sides
  125.             oldx = x
  126.             oldy = y
  127.             x = (COS(_D2R(angle)) * length) + mouseX
  128.             y = (SIN(_D2R(angle)) * length) + mouseY
  129.             LINE (x - t, y - t)-(oldx - t, oldy - t), col&
  130.         NEXT angle
  131.     NEXT t
  132.     IF a$ = "C" OR a$ = "c" THEN _CLIPBOARDIMAGE = image2&
  133.     IF mouseLeftButton THEN _PUTIMAGE , 0, image2& ' screen to image2
  134.  
  135.     _DISPLAY
  136.  
3D Houses.jpg
* 3D Houses.jpg (Filesize: 183.24 KB, Dimensions: 1000x700, Views: 176)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
Re: 3D Polygon Graphic Maker
« Reply #5 on: August 28, 2020, 11:41:01 pm »
It also can do (mostly) filled-in polygons too. When you start it, you give a value up to 50, 50 being the most emptiness. Here is what it looks like with selecting 1 instead of 50.

3D Funky Houses.jpg
* 3D Funky Houses.jpg (Filesize: 97.85 KB, Dimensions: 1000x700, Views: 186)