Author Topic: IDE Bug  (Read 7273 times)

0 Members and 1 Guest are viewing this topic.

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
IDE Bug
« 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

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: IDE Bug
« Reply #1 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....

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: IDE Bug
« Reply #2 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.

Offline gaslouk

  • Newbie
  • Posts: 29
    • View Profile
Re: IDE Bug
« Reply #3 on: March 28, 2020, 11:48:58 pm »
I
« Last Edit: March 29, 2020, 01:21:20 am by gaslouk »

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: IDE Bug
« Reply #4 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.  
« Last Edit: March 29, 2020, 01:42:57 pm by Unseen Machine »

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: IDE Bug
« Reply #5 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.
Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: IDE Bug
« Reply #6 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.  
« Last Edit: March 29, 2020, 09:35:48 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: IDE Bug
« Reply #7 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?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: IDE Bug
« Reply #8 on: March 29, 2020, 09:37:19 pm »
Hi Steve, In case my fix is too terse, I added context.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: IDE Bug
« Reply #9 on: March 30, 2020, 07:19:58 am »
Yes Bplus
now the second example posted by UnseenMachine works...
You've nailed it!
Programming isn't difficult, only it's  consuming time and coffee

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: IDE Bug
« Reply #10 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.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: IDE Bug
« Reply #11 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.
Granted after becoming radioactive I only have a half-life!

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: IDE Bug
« Reply #12 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

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: IDE Bug
« Reply #13 on: April 01, 2020, 01:16:54 pm »
Good to see you again John. It's been a while.
In order to understand recursion, one must first understand recursion.

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: IDE Bug
« Reply #14 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