Author Topic: another _Pointsize issue in OpenGl!  (Read 2971 times)

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
another _Pointsize issue in OpenGl!
« on: January 17, 2021, 06:42:34 pm »
Hi guys and gals
I was playing with a code posted by Ashish about plasma and while I's modding the code I lost the output!
I have spent different time (hours) thinking and searching about a bug in my mode...
when I was to abandoning the modded code  I've tryed to change _glPointSize from default 1 to 2 and you see what I have got:
  [ You are not allowed to view this attachment ]  
What do you think of these 2 different output changing the Point Size from default 1 to  2.
Thanks to read
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: another _Pointsize issue in OpenGl!
« Reply #1 on: January 17, 2021, 06:58:28 pm »
Here the code to try and check
Code: QB64: [Select]
  1. 1 CONST R = 0, G = 1, B = 2 'CODED BY ASHISH  modded by TempodiBasic
  2. SCREEN _NEWIMAGE(300, 300, 32): DIM init AS INTEGER, screen2(299, 299, 2) AS INTEGER: init = 0
  3. 3
  4. IF init <> -1 THEN
  5.     FOR y = 0 TO 299
  6.        4 FOR x = 0 TO 299
  7.            5 PSET (x, y), _RGB32(screen2(x, y, R), screen2(x, y, G), screen2(x, y, B))
  8.        6 NEXT x
  9.    7 NEXT y
  10.     AdjournMatrix
  11. a$ = INKEY$
  12. IF a$ = CHR$(32) THEN SOUND 41, 18: init = 999: PRINT " Standard mode": _DELAY 1: CLS ' standard graphic mode
  13. IF a$ = CHR$(13) THEN SOUND 141, 18: init = 999: PRINT " Opengl mode": _DELAY 1: CLS: init = -1 ' Opengl graphic mode
  14. 10 IF a$ = CHR$(27) THEN END ELSE GOTO 3
  15.  
  16. SUB AdjournMatrix
  17.     SHARED screen2() AS INTEGER
  18.     STATIC i, j
  19.     i = i + .1
  20.     j = j - .1
  21.     FOR Y = 0 TO 299
  22.         FOR x = 0 TO 299
  23.             screen2(x, Y, R) = 230 * (COS(j)) * ABS(SIN(i + x / 20) - COS(j + Y / 20))
  24.             screen2(x, Y, G) = 200 * ABS(SIN(i) + COS(j))
  25.             screen2(x, Y, B) = 50 * ABS(SIN(i)) * ABS(COS((x + Y) / 20) - SIN((x - Y) / 20))
  26.         NEXT x
  27.     NEXT Y
  28.  
  29. SUB _GL
  30.     SHARED init AS INTEGER, screen2() AS INTEGER
  31.  
  32.     IF init = 999 THEN
  33.         EXIT SUB
  34.     END IF
  35.  
  36.     IF init = 0 THEN ' init = 0 actives Opengl inizialization
  37.         _glViewport 0, 0, 299, 299
  38.         _glClearColor 0, 0, 0, 1
  39.         _glPointSize 1
  40.         ga = 1
  41.         init = 999
  42.     END IF
  43.  
  44.     _glClear _GL_COLOR_BUFFER_BIT
  45.     ' draw matrix
  46.     FOR y = 0 TO 299
  47.         FOR x = 0 TO 299
  48.             gr = Proportion(0, 255, 0, 1, screen2(x, y, R))
  49.             gb = Proportion(0, 255, 0, 1, screen2(x, y, B))
  50.             gg = Proportion(0, 255, 0, 1, screen2(x, y, G))
  51.             _glColor4f gr, gg, gb, ga
  52.             _glBegin _GL_POINTS
  53.             _glVertex2f Proportion(0, 299, -1, 1, x), Proportion(0, 299, 1, -1, y)
  54.             _glEnd
  55.         NEXT x
  56.     NEXT y
  57.     AdjournMatrix
  58.     _glFlush
  59.  
  60. FUNCTION Proportion (min1, max1, min2, max2, value)
  61.     'delta1: value = Delta2: x
  62.     Proportion = ((value * (max2 - min2)) / (max1 - min1)) + min2
  63.  

As you can see the original code is the ShortestPlasmaGenerator from Ashish. I have worked on the output and the structure data.
Pressing Space Bar key you active the standard graphic mode
pressing Enter key you active the OpenGl mode
pressing ESCape key you quit the demonstration code

If you set _GlPointSize to 1 you'll get the issue, while if _GlPointSize is bigger it is ok
Now I'll test the code into Linux Ubuntu Os on the same machine in a VM.
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: another _Pointsize issue in OpenGl!
« Reply #2 on: January 17, 2021, 08:41:42 pm »
Hi
here from into Lubuntu 14  in VM  running QB64 x32 version 1.3 I got the same results using
_GlPointSize 1 or 2
here screenshot
  [ You are not allowed to view this attachment ]  
It lasts to think if it is OS dependent or QB64 version dependent.
Only further tests on other machines can solve the issue.
Thanks to read
Programming isn't difficult, only it's  consuming time and coffee

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: another _Pointsize issue in OpenGl!
« Reply #3 on: January 18, 2021, 07:59:39 pm »
Hi Guys and Gals
Attention please!
here the result of running the above code into QB64 1.3 32bit in Windows 10.... it works so something has been broken from 1.3 to 1.4!
see screenshot
  [ You are not allowed to view this attachment ]  
but the tale has not ended for now.
If you take the build version 1.5  64bit in windows10 it works again!  Something broken has beed fixed!
see screenshot
  [ You are not allowed to view this attachment ]  

Good Job QB64 developers team !
Programming isn't difficult, only it's  consuming time and coffee