GL: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_GL}} In order to use OpenGL drawing commands, you must do so from inside a SUB procedure called '''_GL''', which enables the commands to be rendered. {{PageSyntax}} :SUB _GL :: ''REM Your OpenGL code here : END SUB {{PageDescription}} * OpenGL commands are valid outside of '''SUB _GL''', as long as the sub procedure exists in your code. * Attempting to use OpenGL commands without having '''SUB _GL''' in a program will result in a '''Syn...") |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:[[SUB]] _GL | : [[SUB]] _GL | ||
: | : 'Your OpenGL code here | ||
: [[END]] [[SUB]] | : [[END]] [[SUB]] | ||
{{PageDescription}} | {{PageDescription}} | ||
Line 16: | Line 17: | ||
{{PageExamples}} | |||
{{CodeStart}} | |||
{{CodeStart}} | |||
{{Cl|DIM}} allowGL {{Cl|AS}} {{Cl|_BYTE}} | {{Cl|DIM}} allowGL {{Cl|AS}} {{Cl|_BYTE}} | ||
Line 32: | Line 32: | ||
{{Cl|SUB}} {{Cl|_GL}} | {{Cl|SUB}} {{Cl|_GL}} | ||
{{Cl|IF}} NOT allowGL {{Cl|THEN}} {{Cl|EXIT}} {{Cl|SUB}} 'used to bypass running the code below until | {{Cl|IF}} {{Cl|NOT}} allowGL {{Cl|THEN}} {{Cl|EXIT}} {{Cl|SUB}} 'used to bypass running the code below until | ||
' startup routines are done in the main module | ' startup routines are done in the main module | ||
'OpenGL code starts here | 'OpenGL code starts here | ||
'The code in this area will be run automatically at ~60fps | 'The code in this area will be run automatically at ~60fps | ||
{{Cl|END}} {{Cl|SUB}} | {{Cl|END}} {{Cl|SUB}} | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[ | * [[Keyword Reference - Alphabetical#glA|List of OpenGL commands]] ''All commands in the list are valid. For those without a wiki page, usage follows OpenGL standards.'' | ||
* [[_GLRENDER]] | |||
* [[SUB]] | * [[SUB]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 00:39, 29 January 2023
In order to use OpenGL drawing commands, you must do so from inside a SUB procedure called _GL, which enables the commands to be rendered.
Syntax
Description
- OpenGL commands are valid outside of SUB _GL, as long as the sub procedure exists in your code.
- Attempting to use OpenGL commands without having SUB _GL in a program will result in a Syntax error, even if the syntax is valid.
- SUB _GL cannot be invoked manually. The code inside it will be called automatically at approximately 60 frames per second.
- Using INPUT inside SUB _GL will crash your program.
- If your program needs to perform any operations before SUB _GL must be run, it is recommended to use a shared variable as a flag to allow SUB _GL's contents to be run. See example below.
Examples
DIM allowGL AS _BYTE 'perform startup routines like loading assets allowGL = -1 'sets allowGL to true so SUB _GL can run DO _LIMIT 1 'runs the main loop at 1 cycle per second 'notice how the main loop doesn't do anything, as SUB _GL will be running 'continuously. LOOP SUB _GL IF NOT allowGL THEN EXIT SUB 'used to bypass running the code below until ' startup routines are done in the main module 'OpenGL code starts here 'The code in this area will be run automatically at ~60fps END SUB |
See also
- List of OpenGL commands All commands in the list are valid. For those without a wiki page, usage follows OpenGL standards.
- _GLRENDER
- SUB