Author Topic: OpenGL for Dummies  (Read 1091 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
OpenGL for Dummies
« on: July 12, 2020, 12:25:24 am »
I'm new to OpenGL and have done a few short, simple things. Now I'd like to add 3D functionality to my larger (1000+ line)
programs.  Merely tacking SUB _GL and END SUB to these programs causes them, when run, to immediately generate an unreponsive window error. They compile ok. 

I'm using QB64 v1.3 on Windows XP.

What might be going on?
It works better if you plug it in.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: OpenGL for Dummies
« Reply #1 on: July 12, 2020, 01:17:15 am »
Some commands simply will not work with GL.  Try this little code:

INPUT whatever$

SUB  _GL
END SUB


GL cant work with any command that pauses execution like that.  It sets of the ICBMs in your computer instead, and destroys the world.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: OpenGL for Dummies
« Reply #2 on: July 12, 2020, 01:40:40 am »
Neither program does keyboard input with INPUT, but one makes a call to your GetOpenFileName when requested, and
that doesn't happen as part of normal program flow.

I added _DELAY and SLEEP into a short demo program with  GL and that was fine (not in the _GL sub).  Indeed, INPUT
locks it up *if* executed, but the program can contain it.

I am still mystified.  What other commands are forbidden?

I've now tested several of my old programs.   The only progress I've made is that one old program worked with the _GL sub added when I removed a _SCREENMOVE _MIDDLE.  With chess I've tried removing all libraries (and calls to them), _TITLE,
_ICON, all mouse support, and even tried changing SCREEN _NEWIMAGE(xm,ym,32) to using specific numbers. 

I repeat, in case anyone missed it, that's there's nothing in SUB _GL.  It's merely being there causes the program to crash
right away.  Sure it's called automatically 60 times a second....or supposed to be.....likely crashes the first time around for me.

Oh, and it doesn't just crash.  It zooms my CPUs to 100% usage.  I could toast marshmallows on them.
« Last Edit: July 12, 2020, 06:07:03 am by Richard Frost »
It works better if you plug it in.