QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Unseen Machine on March 28, 2020, 05:01:47 pm

Title: IDE Bug
Post by: Unseen Machine on March 28, 2020, 05:01:47 pm
Hi all,

So i got two problems....

This Corona Virus lockdown has me sat at home with  little to do so i figured i would make a few _GL demos for you guys but i've just downloaded the latest IDE and it's telling me ive got syntax errors!!!

I've included the files needed for this, just unzip to your QB64 folder.

Code: QB64: [Select]
  1. REM $include:'GDK_GL\GDK_GL.bi'
  2.  
  3. Init = False
  4.  
  5. DIM SHARED Model AS MODEL
  6. SCREEN _NEWIMAGE(800, 600, 32)
  7.  
  8. REM $include:'GDK_GL\GDK_GL.bm'
  9.  
  10. SUB _GL
  11.  
  12.     GDK_GL_CLS
  13.  
  14.     IF Init = False THEN
  15.         'gdk_gl_model_load model, "GDK_Gl\demon.mdl"
  16.         Init = True
  17.     ELSE
  18.  
  19.     END IF
  20.     _DISPLAY
  21.  

Remove the ' from the GDK_GL_MODEL_LOAD commmand and youll see that suddenly the
Code: QB64: [Select]
  1. IF Init= False THEN
suddenly has a syntax error!

Anyone got any idea why?

and secondly...

ive been trying to sort out a question ive been asked on mic input but when trying to compile my program i get a compilation error. Apparently audio.hpp is missing even though i know it's where it's supposed to be, i created a fresh install of QB64, reinstalled the libs and still got the same error...any insight would be great

thanks foks

Unseen
Title: Re: IDE Bug
Post by: Unseen Machine on March 28, 2020, 05:38:58 pm
Problem one i solved myself, seems i was calling the model load as a sub when it's actually a function! But still, i dont see why when i was doing it wrong it said i had a syntax error on the wrong line....
Title: Re: IDE Bug
Post by: bplus on March 28, 2020, 06:16:33 pm
If QB64 can't find a file sitting right there in your folder like an .ico, try ./ prefix.
Title: Re: IDE Bug
Post by: gaslouk on March 28, 2020, 11:48:58 pm
I
Title: Re: IDE Bug
Post by: Unseen Machine on March 29, 2020, 01:34:46 pm

*** FIXED ****
Sooooo...I'v got another problem...

This code is about as simple as GL gets and should work without issue, i get to see the triangle but for some reason it looks lie my screen tries resizing and then the program crashes...please test it and if you get similar results or not please let me know...

Thanks

Unseen

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(400, 300)
  2.  
  3. _FPS 30 '    // Set maximium frames per second
  4.  
  5. DIM SHARED CamX!, CamY!, CamZ!, CamXRot%, CamYRot%, CamZRot%
  6.  
  7. '// Initial camera settings
  8. CamZ! = -10
  9.  
  10.     _LIMIT 30
  11.  
  12.     _DISPLAY
  13.  
  14.  
  15.  
  16. SUB _GL
  17.  
  18.     _glClearColor 0, 0, 0, 1 '// Set background (clear) color to black
  19.     _glClearDepth 1 '                 // Set clear depth value to farthest
  20.     _glEnable _GL_DEPTH_TEST '         // Enables depth buffer for hidden surface removal
  21.  
  22.     '// Setup a perspective view
  23.     _glMatrixMode _GL_PROJECTION
  24.     _gluPerspective 60, 400 / 300, .1, 400
  25.     _glMatrixMode _GL_MODELVIEW
  26.  
  27.     _glClear _GL_COLOR_BUFFER_BIT OR _GL_DEPTH_BUFFER_BIT '// Clear screen and depth buffers
  28.  
  29.     '// Set the view to the cameras position
  30.     _glRotatef CamXRot%, 1, 0, 0
  31.     _glRotatef CamYRot%, 0, 1, 0
  32.     _glRotatef CamZRot%, 0, 0, 1
  33.     _glTranslatef CamX!, CamY!, CamZ!
  34.  
  35.     '// Draw the triangle
  36.     _glBegin _GL_TRIANGLES
  37.     _glColor3f 1, 0, 0
  38.     _glVertex3f -1, -1, 0
  39.     _glColor3f 0, 1, 0
  40.     _glVertex3f 0, 1, 0
  41.     _glColor3f 0, 0, 1
  42.     _glVertex3f 1, -1, 0
  43.     _glEnd
  44.  
  45.  
  46.  
Title: Re: IDE Bug
Post by: TempodiBasic on March 29, 2020, 08:42:44 pm
Hi UnseenMachine
fine to see you

as feedback
with first code corrected I got a black screen window
Code: QB64: [Select]
  1. REM $INCLUDE:'GDK_GL\GDK_GL.bi'
  2.  
  3. Init = False
  4.  
  5. DIM SHARED Model AS MODEL
  6. SCREEN _NEWIMAGE(800, 600, 32)
  7.  
  8. REM $INCLUDE:'GDK_GL\GDK_GL.bm'
  9.  
  10. SUB _GL
  11.  
  12.     GDK_GL_CLS
  13.  
  14.     IF Init = False THEN
  15.         a = GDK_GL_MODEL_LOAD(Model, "GDK_Gl\demon.mdl")
  16.         IF a = -1 THEN Init = True ELSE PRINT "ERROR"
  17.     ELSE
  18.  
  19.     END IF
  20.     _DISPLAY
  21.  
  22.  

while with the 2nd code I get  the same black screen window in which appears a coloured triangle just for a second and then it disappears. But if I move the window it appears another time just for a second.

I see that you use both _LIMIT 30 and before this _FPS 30
but about this last I have found no documentation... it seems a _QB64function as a SUB with one integer parameter.
Wiki onlike lacks of documentation about it, but parser shows it with the color of variables... and no warning or error about it!

I hope these feedbacks can be useful.
I'm using QB64x64  version 1.4  gitub 0f49b2c on windows10 64 bit.
Title: Re: IDE Bug
Post by: bplus on March 29, 2020, 08:48:46 pm

*** FIXED ****
Sooooo...I'v got another problem...

This code is about as simple as GL gets and should work without issue, i get to see the triangle but for some reason it looks lie my screen tries resizing and then the program crashes...please test it and if you get similar results or not please let me know...

Thanks

Unseen

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(400, 300)
  2.  
  3. _FPS 30 '    // Set maximium frames per second
  4.  
  5. DIM SHARED CamX!, CamY!, CamZ!, CamXRot%, CamYRot%, CamZRot%
  6.  
  7. '// Initial camera settings
  8. CamZ! = -10
  9.  
  10.     _LIMIT 30
  11.  
  12.     _DISPLAY
  13.  
  14.  
  15.  
  16. SUB _GL
  17.  
  18.     _glClearColor 0, 0, 0, 1 '// Set background (clear) color to black
  19.     _glClearDepth 1 '                 // Set clear depth value to farthest
  20.     _glEnable _GL_DEPTH_TEST '         // Enables depth buffer for hidden surface removal
  21.  
  22.     '// Setup a perspective view
  23.     _glMatrixMode _GL_PROJECTION
  24.     _gluPerspective 60, 400 / 300, .1, 400
  25.     _glMatrixMode _GL_MODELVIEW
  26.  
  27.     _glClear _GL_COLOR_BUFFER_BIT OR _GL_DEPTH_BUFFER_BIT '// Clear screen and depth buffers
  28.  
  29.     '// Set the view to the cameras position
  30.     _glRotatef CamXRot%, 1, 0, 0
  31.     _glRotatef CamYRot%, 0, 1, 0
  32.     _glRotatef CamZRot%, 0, 0, 1
  33.     _glTranslatef CamX!, CamY!, CamZ!
  34.  
  35.     '// Draw the triangle
  36.     _glBegin _GL_TRIANGLES
  37.     _glColor3f 1, 0, 0
  38.     _glVertex3f -1, -1, 0
  39.     _glColor3f 0, 1, 0
  40.     _glVertex3f 0, 1, 0
  41.     _glColor3f 0, 0, 1
  42.     _glVertex3f 1, -1, 0
  43.     _glEnd
  44.  
  45.  
  46.  


Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(400, 300, 32) '<<<<<<<<<<<<<<<<<< your code needs the 32
  2.  
Title: Re: IDE Bug
Post by: SMcNeill on March 29, 2020, 09:15:50 pm
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(400, 300, 32) '<<<<<<<<<<<<<<<<<< need the 32
  2.  

Unless your intention is to make a screen 0 text screen 400x300 characters in size?  6400x2400 pixels or so?
Title: Re: IDE Bug
Post by: bplus on March 29, 2020, 09:37:19 pm
Hi Steve, In case my fix is too terse, I added context.
Title: Re: IDE Bug
Post by: TempodiBasic on March 30, 2020, 07:19:58 am
Yes Bplus
now the second example posted by UnseenMachine works...
You've nailed it!
Title: Re: IDE Bug
Post by: Qwerkey on March 30, 2020, 07:32:06 am
@Unseen Machine It is good to see you back.  We are currently curating good Programs into the Samples section.  When you have completed this batch of Open_GL demos, please create a post in Programs and we may place these into Samples Gallery / SUB_GL.
Title: Re: IDE Bug
Post by: Cobalt on March 30, 2020, 12:20:50 pm
Unless your intention is to make a screen 0 text screen 400x300 characters in size?  6400x2400 pixels or so?

Base screen 0 text is 8x16 right?  so  3200x4800 pixels or there abouts. which is odd cause people are making graphics screens that are darn close to that but don't crash so why can we not have a text screen that big without crashing? I don't think the text screens can even come that close to that size.
Title: Re: IDE Bug
Post by: Unseen Machine on April 01, 2020, 01:13:57 pm
Hi all,

Yeah i clocked that mistake, seems it took me a few days to rember the intricities of QB64 and to some extent my own libraries!

Quote
@Unseen Machine It is good to see you back.  We are currently curating good Programs into the Samples section.  When you have completed this batch of Open_GL demos, please create a post in Programs and we may place these into Samples Gallery / SUB_GL.

Will do and do you have any specific demo's youd like? Right now i'm working on re-writing my Quake Chess game (i've lost the original code)

Thanks and happy coding...

Unseen
Title: Re: IDE Bug
Post by: TerryRitchie on April 01, 2020, 01:16:54 pm
Good to see you again John. It's been a while.
Title: Re: IDE Bug
Post by: Unseen Machine on April 05, 2020, 11:56:43 am
So, back to my bug where QB64 can't find libraries whne compiling my code.

I broke it down to as basic as i could and ive figured it out. When using a c lib that #include's another c library the compiler cant find that second included file. To demonstrate...

Unzip the included folder (only contains two text files i made for this test) and run the following code...

Code: QB64: [Select]
  1. PRINT Test
  2.  
  3.  
  4. DECLARE LIBRARY "Tests\Test_Include", "Tests\Test"
  5.   FUNCTION Test%
  6.  

You should see it report a failiure to compile and when you look at the compilelog it reports that it cant find Test.hpp.

Removing the Binding to Test_Include.h and it will compile!

Code: QB64: [Select]
  1. PRINT Test
  2.  
  3. DECLARE LIBRARY "Tests\Test"
  4.   FUNCTION Test%
  5.  

This means that all my wrappers/c++ libraries that use external libraries are no longer compatible with QB64 for the time being till this gets fixed...

Unseen
Title: Re: IDE Bug
Post by: FellippeHeitor on April 05, 2020, 12:00:50 pm
You mean it worked in 1.3 and we broke it in 1.4?
Title: Re: IDE Bug
Post by: Unseen Machine on April 05, 2020, 12:10:04 pm
I dunno about that...I know it used to work when i last used those libraries but that was like 2017! Still the fact it cant seem to link to included libraries is worrying...

Unseen
Title: Re: IDE Bug
Post by: FellippeHeitor on April 07, 2020, 11:40:22 pm
The C++ compiler we ship (gcc) was upgraded from 1.2 to 1.3. From 1.3 to 1.4 there have been no changes.

If you'd be willing to let us know if that is the issue, you could try your code in 1.2 and, if it works there, the faulty behaviour is likely some compiler setting that changed by default in the newer version.

https://www.qb64.org/portal/historical-qb64/
Title: Re: IDE Bug
Post by: Cobalt on April 08, 2020, 10:18:03 am
I have tried QB64 from V1.00 (from 2015) to current 1.4 and this does NOT work in any version of QB64 I have tried.

Are you positive it has ever worked in GL QB64 and your not thinking of SDL QB64?

test 0.98 too, still will not work there.

okay went so far as SDL .954, still doesn't work there. 

at this point I can say this has never seemed to work with GL  versions of QB64.
Title: Re: IDE Bug
Post by: Unseen Machine on April 08, 2020, 10:24:38 am
Quote
Are you positive it has ever worked in GL QB64 and your not thinking of SDL QB64?

Errr, Nope! As previously stated i dont know when compatability was lost though it probaly was with SDL qb when it last worked/i last used these libs as accessing opengl is why i developed the SFML wrappers, once GL was native i stopped using them so never realised they no longer worked.

Is there a way to fix this? Surely theres no reason that we shouldnt be able to link to external libraries...without this abilty QB64 will have a hard time working with external libs/packages such as SFML, Box2d etc...

Thanks folks,

Unseen
Title: Re: IDE Bug
Post by: Cobalt on April 08, 2020, 10:47:45 am
I should point out I was using your TESTs example, and I can not find the log in the older versions of QB64 to confirm that its the same error. but they all produced the "Compilation error" when trying to compile.
Title: Re: IDE Bug
Post by: Unseen Machine on April 08, 2020, 10:51:58 am
Ive just checked with the most recent SDL (0.954?) verison from the historical section and it compiled without any problems so i think we've found the point at which it stopped working...now how do (i'd love to say 'WE' but i've got no idea where to start) you guys fix this? is it possible?

Thanks

Unseen
Title: Re: IDE Bug
Post by: FellippeHeitor on April 08, 2020, 12:22:31 pm
Quote
Ive just checked with the most recent SDL (0.954?)

  [ This attachment cannot be displayed inline in 'Print Page' view ]  

Just to make sure, please.
Title: Re: IDE Bug
Post by: Unseen Machine on April 08, 2020, 02:00:22 pm
Yep, 0.954. I am going to download version 1.0 and see if it works on that and report back on my findings.

Thanks

Unseen
Title: Re: IDE Bug
Post by: Unseen Machine on April 08, 2020, 02:11:37 pm
0.978 - Compilation failiure...

So it seems in the switch from SDL we lost something else...

Weird no one else has noticed in all this time though....

Unseen
Title: Re: IDE Bug
Post by: Dav on April 08, 2020, 05:54:47 pm
I tried 'Tests' in QB64 v0.954h (the last SDL version I have) and it failed.  I have most SDL versions backuped on a drive somewhere, so I can dig some oldies out and try them.  I think I even have that special QB64 version of just Qbasic commands, no QB64 keywards added.

- Dav
Title: Re: IDE Bug
Post by: FellippeHeitor on April 08, 2020, 07:05:04 pm
If you ever make those available in some sort of online storage we could fetch we'd be interested in completing the collection at https://www.qb64.org/portal/historical-qb64/
Title: Re: IDE Bug
Post by: Cobalt on April 08, 2020, 09:15:24 pm
Ive just checked with the most recent SDL (0.954?) verison from the historical section and it compiled without any problems so i think we've found the point at which it stopped working...now how do (i'd love to say 'WE' but i've got no idea where to start) you guys fix this? is it possible?

Thanks

Unseen

Wonder what is different about your version and mine and Dav's. as both ours erred out
I tried 'Tests' in QB64 v0.954h (the last SDL version I have) and it failed.  I have most SDL versions backuped on a drive somewhere, so I can dig some oldies out and try them.  I think I even have that special QB64 version of just Qbasic commands, no QB64 keywards added.

- Dav
Title: Re: IDE Bug
Post by: Unseen Machine on April 09, 2020, 03:18:58 am
Lol,  i havent been working with the same files it seems! Ive been using my SFMl audio wrapper (which compiled and ran perfectly in .954), ill try again with tests later on (as ive just woken up and the dog needs walking) and figure out what ive done wrong in creating them.

Thanks gang

Unseen
Title: Re: IDE Bug
Post by: Unseen Machine on April 09, 2020, 09:29:34 am
So ive checked,

Code: QB64: [Select]
  1. PRINT Test
  2.  
  3. DECLARE LIBRARY "Tests\Test_include"
  4.     FUNCTION Test%
  5.  
  6.  

Compiles fine and prints -1 to the screen using version .954

If you use

Code: QB64: [Select]
  1. DECLARE LIBRARY "Tests\Test_Include", "Tests\Test"

It fails but under .954 i get no (or cant find) a compile log so i dont know why it's failing. My thought is it might be because we are referencing the same file twice, once in the Test_include file and once again in the declare....but i dunno

Either way, this (the first code block) works in .954 and doesnt in .978

Unseen