Author Topic: 🎄🎁✨ Holiday Season Code Sampler 2021  (Read 6424 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #30 on: December 23, 2021, 01:57:09 pm »
Nice effects Petr, drawings too. The effect was really nice surprise with the text. Reminds me of Circle Inverses I think I will have go digging and try some experiments with that.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #31 on: December 23, 2021, 07:34:46 pm »
Hi boys and girls of QB64land,

here my wishes
an OpenGl wish for health, peace and funny moments
Code: QB64: [Select]
  1.  Dim Shared GlInit As Integer, s As Single, Glactive As Integer
  2.  
  3. A = _NewImage(800, 600, 32)
  4.  
  5.  
  6. Const Yellow1 = _RGB32(200, 200, 10, 255), Yellow2 = _RGB32(200, 200, 60, 255), Black = _RGB32(0, 0, 0, 255), Red = _RGB32(230, 0, 0, 255)
  7. _Title "Happy Christmas QB64 community!"
  8.  
  9. Locate 2, ((_Width / 2) - 80) / 8: Print "Opengl graphic demo"
  10. GlInit = -1
  11. Glactive = -1
  12. r = 1
  13. z = 10
  14. s = _Pi(2) / z
  15.     If r > 0.35 Then r = r - 0.05
  16.     For w = 0 To _Pi(2) Step s / 2
  17.  
  18.         _Delay .15
  19.     Next w
  20. Color Yellow1
  21. Print " Happy Christmas QB64 community"
  22.  
  23. 'area subs-------------
  24.  
  25. 'area GL --------------------
  26. Sub _GL ()
  27.     Shared w As Single
  28.     If Not Glactive Then Exit Sub
  29.     If GlInit Then
  30.         _glViewport 0, 0, _Width, _Height
  31.         _glClearColor 0, 0, 1, 1
  32.         GlInit = 0
  33.     End If
  34.     _glClear _GL_COLOR_BUFFER_BIT
  35.     RotatingStarsFull 0, -0.2, r, -w
  36.     IncrDrawPoint 0, -0.2, r, 10, -w
  37.     IncrRotStarsvoid 0, -0.2, r, -w
  38.     'Q
  39.     RotatingStarsFull -0.7, 0.8, 0.05, -w
  40.     RotatingStarsFull -0.8, 0.8, 0.05, -w
  41.     RotatingStarsFull -0.9, 0.7, 0.05, -w
  42.     RotatingStarsFull -0.9, 0.6, 0.05, -w
  43.     RotatingStarsFull -0.9, 0.5, 0.05, -w
  44.     RotatingStarsFull -0.8, 0.4, 0.05, -w
  45.     RotatingStarsFull -0.7, 0.4, 0.05, -w
  46.     RotatingStarsFull -0.6, 0.7, 0.05, -w
  47.     RotatingStarsFull -0.6, 0.6, 0.05, -w
  48.     RotatingStarsFull -0.6, 0.5, 0.05, -w
  49.     RotatingStarsFull -0.55, 0.4, 0.05, -w
  50.     'B
  51.  
  52.     RotatingStarsFull -0.2, 0.8, 0.05, -w
  53.     RotatingStarsFull -0.4, 0.8, 0.05, -w
  54.     RotatingStarsFull -0.4, 0.7, 0.05, -w
  55.     RotatingStarsFull -0.4, 0.6, 0.05, -w
  56.     RotatingStarsFull -0.4, 0.5, 0.05, -w
  57.     RotatingStarsFull -0.4, 0.4, 0.05, -w
  58.     RotatingStarsFull -0.2, 0.4, 0.05, -w
  59.     RotatingStarsFull -0.1, 0.7, 0.05, -w
  60.     RotatingStarsFull -0.2, 0.6, 0.05, -w
  61.     RotatingStarsFull -0.1, 0.5, 0.05, -w
  62.     '6
  63.     RotatingStarsFull 0.4, 0.8, 0.05, -w
  64.     RotatingStarsFull 0.3, 0.8, 0.05, -w
  65.     RotatingStarsFull 0.2, 0.7, 0.05, -w
  66.     RotatingStarsFull 0.1, 0.6, 0.05, -w
  67.     RotatingStarsFull 0.1, 0.5, 0.05, -w
  68.     RotatingStarsFull 0.2, 0.4, 0.05, -w
  69.     RotatingStarsFull 0.3, 0.3, 0.05, -w
  70.     RotatingStarsFull 0.3, 0.3, 0.05, -w
  71.     RotatingStarsFull 0.4, 0.4, 0.05, -w
  72.     RotatingStarsFull 0.3, 0.5, 0.05, -w
  73.     RotatingStarsFull 0.4, 0.5, 0.05, -w
  74.     RotatingStarsFull 0.2, 0.5, 0.05, -w
  75.  
  76.     '4
  77.     RotatingStarsFull 0.8, 0.8, 0.05, -w
  78.     RotatingStarsFull 0.7, 0.7, 0.05, -w
  79.     RotatingStarsFull 0.8, 0.7, 0.05, -w
  80.     RotatingStarsFull 0.6, 0.5, 0.05, -w
  81.     RotatingStarsFull 0.8, 0.6, 0.05, -w
  82.     RotatingStarsFull 0.65, 0.6, 0.05, -w
  83.     RotatingStarsFull 0.7, 0.5, 0.05, -w
  84.     RotatingStarsFull 0.9, 0.5, 0.05, -w
  85.     RotatingStarsFull 0.8, 0.5, 0.05, -w
  86.     RotatingStarsFull 0.8, 0.4, 0.05, -w
  87.     RotatingStarsFull 0.8, 0.3, 0.05, -w
  88.  
  89.     _glFlush
  90.  
  91. Sub IncrDrawPoint (x As Single, y As Single, r1 As Single, s1 As Integer, w As Single)
  92.     Static s2 As Integer
  93.     If s2 - s1 = 0 Then s2 = 2 Else s2 = s2 + 1
  94.     drawpoint x, y, r1, s2, 2 * s, w
  95.  
  96. Sub IncrRotStarsvoid (x As Single, y As Single, r1 As Single, w As Single)
  97.     Static r2 As Single
  98.     If r2 >= r1 Then r2 = 0 Else r2 = r2 + 0.001
  99.     RotatingStarsVoid x, y, r2, w
  100.  
  101. Sub drawpoint (x As Single, y As Single, r1 As Single, s1 As Integer, s2 As Single, w As Single)
  102.     Dim i As Single, cx As Single, cy As Single
  103.     _glColor4f 0.8, .8, 0.1, 1.0
  104.     _glPointSize s1 ' it works with 2 or more !
  105.     _glBegin _GL_POINTS
  106.     For i = 0 To _Pi(2) Step s2
  107.         cx = (Cos(i + w) * r1) + x
  108.         cy = (Sin(i + w) * r1) + y
  109.         _glVertex2f cx, cy
  110.     Next i
  111.     _glEnd
  112.  
  113.  
  114.  
  115.  
  116. Sub RotatingStarsFull (x As Single, y As Single, r1 As Single, w As Single)
  117.     Dim i, cx As Single, cy As Single, j As Integer, k As Integer, h As Integer
  118.     _glColor4f 0.8, .8, 0.1, 1.0
  119.  
  120.     _glBegin _GL_TRIANGLE_FAN
  121.  
  122.     h = 0
  123.     For i = 0 To _Pi(2) Step s
  124.         h = h + 1
  125.         If h Mod 2 = 0 Then
  126.             j = 2: k = 1
  127.         Else
  128.             j = 1: k = 2
  129.         End If
  130.  
  131.         cx = (Cos(i - s + w) * (r1 / k)) + x
  132.         cy = (Sin(i - s + w) * (r1 / k)) + y
  133.         _glVertex2f cx, cy
  134.  
  135.         cx = (Cos(i + w) * (r1 / j)) + x
  136.         cy = (Sin(i + w) * (r1 / j)) + y
  137.         _glVertex2f cx, cy
  138.         cx = (Cos(i + s + w) * (r1 / k)) + x
  139.         cy = (Sin(i + s + w) * (r1 / k)) + y
  140.         _glVertex2f cx, cy
  141.     Next i
  142.  
  143.     _glEnd
  144.  
  145. Sub RotatingStarsVoid (x As Single, y As Single, r1 As Single, w As Single)
  146.     Dim i, cx As Single, cy As Single, j As Integer, k As Integer, h As Integer
  147.     _glColor4f 0.8, 1, 0.1, 1.0
  148.  
  149.     _glBegin _GL_LINES
  150.  
  151.     h = 0
  152.     For i = 0 To _Pi(2) Step s
  153.         h = h + 1
  154.         If h Mod 2 = 0 Then
  155.             j = 2: k = 1
  156.         Else
  157.             j = 1: k = 2
  158.         End If
  159.  
  160.  
  161.         cx = (Cos(i + w) * (r1 / j)) + x
  162.         cy = (Sin(i + w) * (r1 / j)) + y
  163.         _glVertex2f cx, cy
  164.         cx = (Cos(i + s + w) * (r1 / k)) + x
  165.         cy = (Sin(i + s + w) * (r1 / k)) + y
  166.         _glVertex2f cx, cy
  167.     Next i
  168.  
  169.     _glEnd
  170.  

Happy Christmas.
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #32 on: December 23, 2021, 09:09:32 pm »
Merry New Year @TempodiBasic

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #33 on: December 23, 2021, 11:31:25 pm »
  [ You are not allowed to view this attachment ]  
Mary kiss moose. Peas on Earth.

  [ You are not allowed to view this attachment ]  
« Last Edit: December 23, 2021, 11:44:40 pm by johnno56 »
Logic is the beginning of wisdom.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #34 on: December 24, 2021, 04:59:42 am »
@johnno56

thanks Johnno56

but there is a bug! peas are on the snow not on the Earth!

This is my handmade fix
  [ You are not allowed to view this attachment ]  
:-)

Thanks for hoping and joking ... it is a good light in this 4rth wave of Covid19!
Programming isn't difficult, only it's  consuming time and coffee

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #35 on: December 24, 2021, 06:15:39 am »
That was something that I did not think of... lol
I thought you might have mentioned that it may be the wrong season for growing peas... lol
or... perhaps the Moose is blind and hard of hearing... Normally frightened of people...
or... Why is Mary out in the snow wearing, what looks like, a cotton dress? lol

Ho! Ho! Ho!  Code on!
Logic is the beginning of wisdom.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: 🎄🎁✨ Holiday Season Code Sampler 2021
« Reply #36 on: December 26, 2021, 02:01:27 pm »
@johnno56
Yeah, you're right! Too many misteries on this lighting picture

@QB64 World

Enjoy yourself boys and girls of Qb64 world!

I have discovered this fine lyric of Alan Parson Project.
Soirèè Fantastique
https://www.youtube.com/watch?v=JeWZqC5kdv4&list=RDLI8NDA_-zOo&index=7
That is my old time, but strangely I have never heard them except for some quickly apparition in the Sunday music show on TV!
So I'm discovering them again.
Programming isn't difficult, only it's  consuming time and coffee