1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-01 09:10:37 +00:00

Update help files [ci-skip]

Removed broken _GL command list
This commit is contained in:
FellippeHeitor 2021-10-09 14:29:36 -03:00
parent 11a6422926
commit ba9f0ec3c6
108 changed files with 1 additions and 10336 deletions

View file

@ -1,25 +0,0 @@
#REDIRECT [[Data types]]
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
ANY disables type checking for a variable used in a [[SUB]] or [[FUNCTION]] declaration.
{{PageSyntax}}
:: variable AS ANY
* [[Keywords currently not supported by QB64|Not supported in QB64.]]
* ANY can become any type variable or value later in the program.
* Commonly used in [[SUB]] or [[FUNCTION]] [[DECLARE|declarations]] to not type a parameter.
''See also:''
* [[DECLARE]]
{{PageNavigation}}

View file

@ -1,477 +0,0 @@
==ASCII and Extended Codes==
{| align="right"
| __TOC__
|}
<center>[http://en.wikipedia.org/wiki/Code_page_437 MS-DOS code page 437]:</center>
:{| border="1" cellpadding="2"
! colspan="8"|[http://ascii.cl/control-characters.htm ASCII Control 0 to 31]   |        ASCII Keyboard Character Codes 32 to 127               
|-
! Code ||Character <tt>[key]</tt> || Code || Character || Code || Character || Code || Character
|-
| 0 ||        (NUL) || 32 ||  [<tt>[[SPACE$|Spacebar]]</tt>]|| 64 ||  <tt>@</tt> || 96 ||  <tt>`</tt>
|-
| 1 ||  ☺   (SOH) || 33 ||  ! || 65 ||  A || 97 ||  a
|-
| 2 ||  ☻   (STX) || 34 ||  " || 66 ||  B || 98 ||  b
|-
| 3 ||  ♥   (ETX) || 35 ||  # || 67 ||  C || 99 ||  c
|-
| 4 ||  ♦   (EOT) || 36 ||  $ || 68 ||  D || 100 ||  d
|-
| 5 ||  ♣   (ENQ) || 37 ||  % || 69 ||  E || 101 ||  e
|-
| 6 ||  ♠   (ACK) || 38 ||  & || 70 ||  F || 102 ||  f
|-
| 7 ||  •   (BEL)   <tt>[[BEEP]]</tt>|| 39 ||  ' || 71 ||  G || 103 ||  g
|-
| 8 ||  ◘    [<tt>BackSpace</tt>] **|| 40 ||  ( || 72 ||  H || 104 ||  h
|-
| 9 ||  ○   (HT)    [<tt>TAB</tt>] **|| 41 ||  ) || 73 ||  I || 105 ||   i
|-
| 10 ||  ◙   (LineFeed)  **|| 42 ||  * || 74 ||  J || 106 ||  j
|-
| 11 ||  ♂   (VT) **|| 43 ||  + || 75 ||  K || 107 ||  k
|-
| 12 ||  ♀   (FormFeed) **|| 44 ||  , || 76 ||  L || 108 ||  l
|-
| 13 ||  ♪   (CR) [<tt>Enter</tt>] **|| 45 ||  - || 77 ||  M || 109 ||  m
|-
| 14 ||  ♫   (SO) || 46 ||  . || 78 ||  N || 110 ||  n
|-
| 15 ||  ☼   (SI) || 47 ||  / || 79 ||  O || 111 ||  o
|-
| 16 ||  ►   (DLE) || 48 ||  0 || 80 ||  P || 112 ||  p
|-
| 17 ||  ◄   (DC1) || 49 ||  1 || 81 ||  Q || 113 ||  q
|-
| 18 ||  ↕   (DC2) || 50 ||  2 || 82 ||  R || 114 ||  r
|-
| 19 ||  ‼   (DC3) || 51 ||  3 || 83 ||  S || 115 ||  s
|-
| 20 ||  ¶   (DC4) || 52 ||  4 || 84 ||  T || 116 ||  t
|-
| 21 ||  §   (NAK) || 53 ||  5 || 85 ||  U || 117 ||  u
|-
| 22 ||  ▬   (SYN) || 54 ||  6 || 86 ||  V || 118 ||  v
|-
| 23 ||  ↨   (ETB) || 55 ||  7 || 87 ||  W || 119 ||  w
|-
| 24 ||  ↑   (CAN) || 56 ||  8 || 88 ||  X || 120 ||  x
|-
| 25 ||  ↓   (EM) || 57 ||  9 || 89 ||  Y || 121 ||  y
|-
| 26 ||  →   (SUB)    <tt>[[EOF]]</tt> || 58 ||  : || 90 ||  Z || 122 ||  z
|-
| 27 ||  ←   (ESC)   [<tt>Esc</tt>]|| 59 ||  ; || 91 ||  [ || 123 ||  {
|-
| 28 ||  ∟   (FS) **|| 60 ||  < || 92 ||  \ || 124 ||  <nowiki>|</nowiki>
|-
| 29 ||  ↔   (GS) **|| 61 ||  = || 93 ||  ] || 125 ||  }
|-
| 30 ||  ▲   (RS) **|| 62 ||  > || 94 ||  ^ || 126 ||  ~
|-
| 31 ||  ▼   (US) **|| 63 ||  ? || 95 ||  _ || 127 ||  ⌂ (DEL) *
|-
! colspan="8"| IBM, International, graphical, mathematical and other characters
|-
! Code || Character || Code || Character || Code || Character || Code || Character
|-
| 128 ||  Ç || 160 ||  á || 192 ||  └ || 224 ||  α
|-
| 129 ||  ü || 161 ||  í || 193 ||  ┴ || 225 ||  ß
|-
| 130 ||  é || 162 ||  ó || 194 ||  ┬ || 226 ||  Γ
|-
| 131 ||  â || 163 ||  ú || 195 ||  ├ || 227 ||  π
|-
| 132 ||  ä || 164 ||  ñ || 196 ||  ─ || 228 ||  Σ
|-
| 133 ||  à || 165 ||  Ñ || 197 ||  ┼ || 229 ||  σ
|-
| 134 ||  å || 166 ||  ª || 198 ||  ╞ || 230 ||  µ
|-
| 135 ||  ç || 167 ||  º || 199 ||  ╟ || 231 ||  τ
|-
| 136 ||  ê || 168 ||  ¿ || 200 ||  ╚ || 232 ||  Φ
|-
| 137 ||  ë || 169 ||  ⌐ || 201 ||  ╔ || 233 ||  Θ
|-
| 138 ||  è || 170 ||  ¬ || 202 ||  ╩ || 234 ||  Ω
|-
| 139 ||  ï || 171 ||  ½ || 203 ||  ╦ || 235 ||  δ
|-
| 140 ||  î || 172 ||  ¼ || 204 ||  ╠ || 236 ||  ∞
|-
| 141 ||  ì || 173 ||  ¡ || 205 ||  ═ || 237 ||  φ
|-
| 142 ||  Ä || 174 ||  « || 206 ||  ╬ || 238 ||  ε
|-
| 143 ||  Å || 175 ||  » || 207 ||  ╧ || 239 ||  ∩
|-
| 144 ||  É || 176 ||  ░ || 208 ||  ╨ || 240 ||  ≡
|-
| 145 ||  æ || 177 ||  ▒ || 209 ||  ╤ || 241 ||  ±
|-
| 146 ||  Æ || 178 ||  ▓ || 210 ||  ╥ || 242 ||  ≥
|-
| 147 ||  ô || 179 ||  │ || 211 ||  ╙ || 243 ||  ≤
|-
| 148 ||  ö || 180 ||  ┤ || 212 ||  ╘ || 244 ||  ⌠
|-
| 149 ||  ò || 181 ||  ╡ || 213 ||  ╒ || 245 ||  ⌡
|-
| 150 ||  û || 182 ||  ╢ || 214 ||  ╓ || 246 ||  ÷
|-
| 151 ||  ù || 183 ||  ╖ || 215 ||  ╫ || 247 ||  ≈
|-
| 152 ||  ÿ || 184 ||  ╕ || 216 ||  ╪ || 248 ||  °
|-
| 153 ||  Ö || 185 ||  ╣ || 217 ||  ┘ || 249 ||  ∙
|-
| 154 ||  Ü || 186 ||  ║ || 218 ||  ┌ || 250 ||  ·
|-
| 155 ||  ¢ || 187 ||  ╗ || 219 ||  █ || 251 ||  √
|-
| 156 ||  £ || 188 ||  ╝ || 220 ||  ▄ || 252 ||  ⁿ
|-
| 157 ||  ¥ || 189 ||  ╜ || 221 ||  ▌ || 253 ||  ²
|-
| 158 ||  ₧ || 190 ||  ╛ || 222 ||  ▐ || 254 ||  ■
|-
| 159 ||  ƒ || 191 ||  ┐ || 223 || ▀ || 255 ||  ''NBSP'' ***
|}
:''' * DEL was used to erase paper tape data by punching out all of the 7 holes.'''
:'''** Control characters 8 to 13 and 28 to 31 can move text formatting when [[PRINT|printed]] and do not display'''
:'''*** NBSP is a Non-breaking Space used to indent text. Some browsers may handle this character differently'''
<center>[http://www.lammertbies.nl/comm/info/ascii-characters.html More information about ASCII Control Characters] </center>
<center>[[Unicode|Unicode Character Table]]</center>
==Control Characters==
* [[INKEY$]] will return Control + letter key press combinations as the equivalent control characters or bold '''function keys''' listed below:
{{WhiteStart}} CTRL + A = CHR$(1) ☺ StartHeader (SOH) CTRL + B = CHR$(2) ☻ StartText (STX)
CTRL + C = CHR$(3) ♥ EndText (ETX) CTRL + D = CHR$(4) ♦ EndOfTransmit (EOT)
CTRL + E = CHR$(5) ♣ Enquiry (ENQ) CTRL + F = CHR$(6) ♠ Acknowledge (ACK)
CTRL + G = CHR$(7) {{text|•|red}} [[BEEP|Bell]] (BEL) CTRL + H = CHR$(8) ◘ '''[Backspace]''' (BSP)
CTRL + I = CHR$(9) {{text|○|red}} Horiz.Tab '''[Tab]''' CTRL + J = CHR$(10) {{text|◙|red}} LineFeed(printer) (LF)
CTRL + K = CHR$(11) {{text|♂|red}} Vert. Tab (VT) CTRL + L = CHR$(12) {{text|♀|red}} FormFeed(printer) (FF)
CTRL + M = CHR$(13) {{text|♪|red}} '''[Enter]''' (CR) CTRL + N = CHR$(14) ♫ ShiftOut (SO)
CTRL + O = CHR$(15) ☼ ShiftIn (SI) CTRL + P = CHR$(16) ► DataLinkEscape (DLE)
CTRL + Q = CHR$(17) ◄ DevControl1 (DC1) CTRL + R = CHR$(18) ↕ DeviceControl2 (DC2)
CTRL + S = CHR$(19) ‼ DevControl3 (DC3) CTRL + T = CHR$(20) ¶ DeviceControl4 (DC4)
CTRL + U = CHR$(21) § NegativeACK (NAK) CTRL + V = CHR$(22) ▬ Synchronous Idle (SYN)
CTRL + W = CHR$(23) ↨ EndTXBlock (ETB) CTRL + X = CHR$(24) ↑ Cancel (CAN)
CTRL + Y = CHR$(25) ↓ EndMedium (EM) CTRL + Z = CHR$(26) → End Of File(SUB) (EOF)
'''{{text|Red symbols will format text and not [[PRINT]] the symbol.|red}} [[_PRINTSTRING]] can print in QB64'''
{{WhiteEnd}}
* Control characters '''1 to 26''' can be used to simulate ''Ctrl + letter'' key shortcuts in Windows programs using [[_SCREENPRINT]].
* [[_CONTROLCHR]] OFF can also be used in QB64 to allow control characters to be printed without formatting the text.
<center>'''ASCII in Text and Printing'''</center>
* Characters '''0'''(NULL) and '''255'''(NBSP) can also be used to print spaces('''32'''). Useful for making file names harder to delete too.
* Character '''7''' will create a [[BEEP]] sound when printed in '''QB64''' or an error sound in QBasic using a '''SCREEN 0''' window.
* Character '''8''' is returned when the '''Backspace''' key is pressed.
* Characters '''9 thru 13''' and '''28 thru 31''' can affect screen or file text placements and do not display the character when [[PRINT|printed]]:
:* Character '''9''' will '''Tab''' space the cursor 8 column spaces when printed.
:* Character '''10''' moves the cursor or ''"line feeds"'' the printer head down one row.
:* Character '''11''' vertical tabs the cursor back to top left position of page or screen. Acts like [[CLS]].
:* Character '''12''' acts like [[CLS]] when printed. ''"Form feeds"'' the page out of printers.
:* Character '''13''' is the cursor or typing '''"carriage return"''' to the start of the line on left side. Returned when '''Enter''' key pressed.
:* Character '''28''' designates a File Separator. Moves the print cursor one space right. Combination Ctrl + \
:* Character '''29''' designates a Group Separator. Moves the print cursor one space left. Combination Ctrl + ]
:* Character '''30''' designates a Record Separator. Moves the print cursor one row up. Combination Ctrl + ^
:* Character '''31''' designates a Unit Separator. Moves the print cursor one row down. Combination Ctrl + _
* '''QB64''' can display all of the control characters without formatting the text using [[_PRINTSTRING]].
* Characters '''13''' and '''10''' can be combined to create the '''CrLf''' carriage return used in files or printing. crlf$ = CHR$(13) + CHR$(10).
* Character '''16''', the data link escape(DLE) character, can designate that a control character is being sent from a [[OPEN COM|COM port]].
: ''Example:'' (DLE) <XON> <DATA PACKET> (DLE) <XOFF> or (DLE) <STX> <DATA PACKET> (DLE) <ETX>
* Character '''17''', Device Control 1, is used with [[OPEN COM|COM ports]] to mark the start of a transmission as "XON". The character is read.
* Character '''19''', Device Control 3, is used with [[OPEN COM|COM ports]] to mark the end of a transmission as "XOFF". The character is NOT read.
* Character '''26''' can be used to designate the end of a file. See [[EOF]].
* Character '''27''' '''{{text|←|green}}''' is returned when the '''Escape''' key is pressed.
<center>'''Control character [[PRINT]] actions can be controlled using [[_CONTROLCHR]] OFF or ON in QB64.'''</center>
{{CodeStart}} '' ''
{{Cl|SCREEN}} 12
{{Cl|COLOR}} 14: {{Cl|PRINT}} "Press Control + letter key combinations."
DO
K$ = {{Cl|INKEY$}}
{{Cl|IF...THEN|IF}} {{Cl|LEN}}(K$) {{Cl|THEN}}
code = {{Cl|ASC}}(K$)
{{Cl|IF...THEN|IF}} code < 32 {{Cl|THEN}} {{Cl|_PRINTSTRING}} (220, 100), "Ctrl + " + {{Cl|CHR$}}(code + 64) + " = " + K$ + " "
{{Cl|END IF}}
{{Cl|LOOP}} {{Cl|UNTIL}} K$ = {{Cl|CHR$}}(27)
{{Cl|END}} '' ''
{{CodeEnd}}
<center>'''ASCII Character Usage'''</center>
* Characters are one byte and take up one space(byte) in a [[STRING]] value or variable.
* Extended(non-keyboard) characters can be entered by holding down ''Alt'' key and entering the code number on the Number pad.
* [[PRINT]]s text characters and symbols or formats the screen, printer or file.
* [[BINARY]] files often store values below 256 in the one byte character. To read the value get the code with [[ASC]].
* Numerical values placed into a [[BINARY]] or [[RANDOM]] file using a [[GET]] or [[PUT]] variable, they will be stored in [[_MK$]] format.
* Characters '''176''' to '''223''' can be used to create screen borders or boundaries in an ASCII game. See: [[SCREEN (function)]]
* Character '''253'''(small 2) can be found as the first character byte of a [[BSAVE]]d image file opened in [[BINARY]] mode.
* Character '''255''' can be used as the NBSP(non-breaking space) character on web pages to fill in extra spaces.
* Can be used to crudely encrypt a file so others cannot read it by shifting the code values. See [[CHR$]] example 2.
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==[[ASC]] Codes==
<center>'''[[ASC]] cannot read empty [[INKEY$]] = "" loop reads! Check for them before reading [[ASC]] key press codes!'''</center>
{{WhiteStart}}' '''ASCII Keyboard Codes'''
'
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Sys ScL Pause'''
' 27 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +133 +134 - - -
'''' `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSp Ins Hme PUp NumL / * -'''
' 126 33 64 35 36 37 94 38 42 40 41 95 43 8 +82 +71 +73 - 47 42 45
''' 96 49 50 51 52 53 54 55 56 57 48 45 61''
'''' Tab Q W E R T Y U I O P [{ ]} \| Del End PDn 7Hme 8/▲ 9PU + '''
' 9 81 87 69 82 84 89 85 73 79 80 123 125 124 +83 +79 +81 +71 +72 +73 43
''' 113 119 101 114 116 121 117 105 111 112 91 93 92 55 56 57 ''
'''' CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-►
' - 65 83 68 70 71 72 74 75 76 58 34 13 +75 +76 +77 '''E'''
''' 97 115 100 102 103 104 106 107 108 59 39 52 53 54 '' '''n'''
'''' Shift Z X C V B N M ,< .> /? Shift ▲ 1End 2/▼ 3PD t'''
' * 90 88 67 86 66 78 77 60 62 63 * +72 +79 +80 +81 '''e'''
''' 122 120 99 118 98 110 109 44 46 47 49 50 51 '' '''r'''
'''' Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0Ins .Del '''
' * - * 32 * - - * +75 +80 +77 +82 +83 13
' '' 48 46''
'
' ''' ''Italics'' = LCase/NumLock On ____________ + = 2 Byte: CHR$(0) + CHR$(code)'''
'{{small|NOTE: The above commented table can be copied and pasted directly into the QB64 IDE}}
{{WhiteEnd}}
<center>Use '''{{text|ASC(RIGHT$(key$, 1))|green}}''' or '''{{text|ASC(key$, 2)|green}}''' in QB64 to read a two byte code when '''{{text|ASC(key$) <nowiki>=</nowiki> 0|green}}'''</center>
<center>'''* See the Two Byte Ctrl, Alt and Shift + Function key combinations below'''</center>
{{CodeStart}}' Demo displays all ASCII codes and 2 byte code combinations
{{Cl|DO...LOOP|DO}}: K$ = {{Cl|INKEY$}}
{{Cl|IF...THEN|IF}} K$ <> "" {{Cl|THEN}} 'ASC will return an error if an empty string is read!
{{Cl|IF...THEN|IF}} {{Cl|ASC}}(K$) > 0 {{Cl|THEN}}
{{Cl|PRINT}} "{{Cl|CHR$}}(" + {{Cl|LTRIM$}}({{Cl|STR$}}({{Cl|ASC}}(K$))) + ")" 'display normal keypress codes
{{Cl|ELSE}} {{Cl|PRINT}} "{{Cl|CHR$}}(0) + {{Cl|CHR$}}(" + {{Cl|LTRIM$}}({{Cl|STR$}}({{Cl|ASC}}(K$, 2))) + ")" 'display 2 byte codes
{{Cl|END IF}}
{{Cl|END IF}}
{{Cl|LOOP}} {{Cl|UNTIL}} K$ = {{Cl|CHR$}}(27) 'escape key press exits '' ''
{{CodeEnd}}
: ''Note:'' In QB64 [[ASC]](K$, 2) can read the second byte of the 2 byte code when [[ASC]](K$) reads the first byte as 0.
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==Two Byte Codes==
<center>'''Two Byte ASCII Keyboard Return Values'''</center>
* [[INKEY$]] returns both bytes when two byte keys or key combinations are pressed. The second byte = [[RIGHT$]](keypress$, 1)
* If the character returned is a two byte code, [[ASC]] will return 0. '''Warning:''' ASC cannot read empty [[INKEY$]] string values!
* In '''QB64''' only, [[ASC]](keypress$, 2) can return the second byte code. Don't read empty string values!
* String values returned can be compared in an [[IF...THEN|IF]] or [[SELECT CASE]] routine by using the actual string definitions such as:
:IF INKEY$ = CHR$(0) + CHR$(80) THEN row = row + 1 '''or''' IF INKEY$ = CHR$(0) + "P" THEN row = row + 1
{{WhiteStart}} '''Two Byte Character Codes    Key                 CHR$(0) + "?" '''
CHR$(0) + CHR$(16-50) [Alt] + letter
CHR$(0) + CHR$(59) [F1] ";"
CHR$(0) + CHR$(60) [F2] "<"
CHR$(0) + CHR$(61) [F3] "="
CHR$(0) + CHR$(62) [F4] ">"
CHR$(0) + CHR$(63) [F5] "?"
CHR$(0) + CHR$(64) [F6] "@"
CHR$(0) + CHR$(65) [F7] "A"
CHR$(0) + CHR$(66) [F8] "B"
CHR$(0) + CHR$(67) [F9] "C"
CHR$(0) + CHR$(68) [F10] "D"
CHR$(0) + CHR$(71) [Home] "G"
CHR$(0) + CHR$(72) [↑] Up Arrow "H"
CHR$(0) + CHR$(73) [Page Up] "I"
CHR$(0) + CHR$(75) [←] Left Arrow "K"
CHR$(0) + CHR$(76) [5 NumberPad] "L" (NumLock off in QB64)
CHR$(0) + CHR$(77) [→] Right Arrow "M"
CHR$(0) + CHR$(79) [End] "O"
CHR$(0) + CHR$(80) [↓] Down Arrow "P"
CHR$(0) + CHR$(81) [Page Down] "Q"
CHR$(0) + CHR$(82) [Insert] "R"
CHR$(0) + CHR$(83) [Delete] "S"
CHR$(0) + CHR$(84-93) [Shift] + F1-10
CHR$(0) + CHR$(94-103) [Ctrl] + F1-10
CHR$(0) + CHR$(104-113) [Alt] + F1-10
CHR$(0) + CHR$(114-119) [Ctrl] + keypad
CHR$(0) + CHR$(120-129) [Alt] + number
CHR$(0) + CHR$(130 or 131) [Alt] + _/- or +/= "é" or "â"
CHR$(0) + CHR$(133) [F11] "à"
CHR$(0) + CHR$(134) [F12] "å"
CHR$(0) + CHR$(135) [Shift] + [F11] "ç"
CHR$(0) + CHR$(136) [Shift] + [F12] "ê"
CHR$(0) + CHR$(137) [Ctrl] + [F11] "ë"
CHR$(0) + CHR$(138) [Ctrl] + [F12] "è"
CHR$(0) + CHR$(139) [Alt] + [F11] "ï"
CHR$(0) + CHR$(140) [Alt] + [F12] "î"
{{WhiteEnd}}
:In '''QB64''', [[CVI]] can be used to get the [[_KEYDOWN]] 2-byte code value. Example: '''{{text|status <nowiki>=</nowiki> _KEYDOWN(CVI(CHR$(0) + "P"))|green}}'''
<center>'''See [[Scancodes]] for other keyboard function keys.'''</center>
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==Code Examples==
''Example 1:'' Using arrow keys to move a text character. A change from a previous position tells program when to PRINT:
{{CodeStart}}movey = 1: movex = 1 'text coordinates can never be 0
at$ = "@" 'text sprite could be almost any ASCII character
{{Cl|LOCATE}} movey, movex: {{Cl|PRINT}} at$;
DO
px = movex: py = movey 'previous positions
B$ = {{Cl|INKEY$}}
{{Cl|IF...THEN|IF}} B$ = {{Cl|CHR$}}(0) + {{Cl|CHR$}}(72) {{Cl|AND (boolean)|AND}} movey > 1 {{Cl|THEN}} movey = movey - 1 'rows 1 to 23 only
{{Cl|IF...THEN|IF}} B$ = {{Cl|CHR$}}(0) + {{Cl|CHR$}}(80) {{Cl|AND (boolean)|AND}} movey < 23 {{Cl|THEN}} movey = movey + 1
{{Cl|IF...THEN|IF}} B$ = {{Cl|CHR$}}(0) + {{Cl|CHR$}}(75) {{Cl|AND (boolean)|AND}} movex > 1 {{Cl|THEN}} movex = movex - 1 'columns 1 to 80 only
{{Cl|IF...THEN|IF}} B$ = {{Cl|CHR$}}(0) + {{Cl|CHR$}}(77) {{Cl|AND (boolean)|AND}} movex < 80 {{Cl|THEN}} movex = movex + 1
{{Cl|IF...THEN|IF}} px <> movex {{Cl|OR (boolean)|OR}} py <> movey {{Cl|THEN}} 'only changes when needed
{{Cl|LOCATE}} py, px: {{Cl|PRINT}} {{Cl|SPACE$}}(1); 'erase old sprite
{{Cl|LOCATE}} movey, movex: {{Cl|PRINT}} at$; 'show new position
{{Cl|END IF}}
{{Cl|LOOP}} {{Cl|UNTIL}} B$ = {{Cl|CHR$}}(27) 'ESCape key exit
{{Cl|END}}
{{CodeEnd}}
''Example 2:'' Routine displays all keypress codes including Ctrl, Alt and Shift combinations. Ctrl + letter = control codes 1 to 26.
{{CodeStart}}
'' ''
SCREEN 13
tmp$ = " CHR$(###),\\,\ \ "
tmp2$ = " CHR$(0) + CHR$(###) \ \"
COLOR 14: LOCATE 3, 3: PRINT "The code can tell what key is pressed"
COLOR 12: LOCATE 5, 14: PRINT CHR$(3); SPACE$(3);
COLOR 13: PRINT CHR$(5); SPACE$(3);
COLOR 12: PRINT CHR$(4); SPACE$(3);
COLOR 13: PRINT CHR$(6)
COLOR 10: LOCATE 7, 4: PRINT " Hit a key to find the ASCII Code"
COLOR 5: LOCATE 13, 1: PRINT " Codes below 33 are called control keys"
LOCATE 14, 1: PRINT " CHR$(0) + are 2 byte Extended key codes"
COLOR 13: LOCATE 16, 1: PRINT " Extended: Press Alt + numberpad: Enter"
LOCATE 18, 1: PRINT " Try some Ctrl, Alt, or Shift Combo's"
COLOR 5: LOCATE 20, 1: PRINT " INKEY$ is used to detect the key entry"
COLOR 2: LOCATE 22, 15: PRINT CHR$(1); " "; CHR$(2)
COLOR 4: LOCATE 24, 10: PRINT "To Quit hit the TAB key";
COLOR 9
DO
DO: {{Cl|SLEEP}}: A$ = {{Cl|INKEY$}}: LOOP UNTIL A$ <> "" 'legal ASC read keys
IF {{Cl|ASC}}(A$) > 0 THEN ' normal key codes
code% = ASC(A$)
SELECT CASE code%
CASE 7: Key$ = "Beep"
CASE 8: Key$ = "Backspace"
CASE 9: Key$ = "Tab Key"
CASE 10: Key$ = "Line Feed"
CASE 12: Key$ = "Form Feed"
CASE 13: Key$ = "Enter"
CASE 27: Key$ = "Escape"
CASE 32: Key$ = "Space Bar"
CASE 48 TO 57: Key$ = "Number"
CASE 65 TO 90: Key$ = "Uppercase"
CASE 97 TO 122: Key$ = "Lowercase"
CASE ELSE: Key$ = ""
END SELECT
SELECT CASE code% 'check for unprintable control combo characters
CASE 10 TO 13: Kcode% = 32
CASE ELSE: Kcode% = code%
END SELECT
COLOR 9: LOCATE 10, 5: {{Cl|PRINT USING}} tmp$; code%; {{Cl|CHR$}}(Kcode%); Key$;
END IF
IF {{Cl|ASC}}(A$) = 0 THEN 'two byte key codes
code% = ASC({{Cl|RIGHT$}}(A$, 1)) 'QBasic code
'code% = ASC(A$, 2) 'QB64 code alternative
SELECT CASE code%
CASE 16 TO 50: Key$ = "Alt+ letter"
CASE 72: Key$ = CHR$(24) + " Arrow"
CASE 75: Key$ = CHR$(27) + " Arrow"
CASE 77: Key$ = CHR$(26) + " Arrow"
CASE 80: Key$ = CHR$(25) + " Arrow"
CASE 83: Key$ = "Delete"
CASE 59: Key$ = "F1"
CASE 60: Key$ = "F2"
CASE 61: Key$ = "F3"
CASE 62: Key$ = "F4"
CASE 63: Key$ = "F5"
CASE 64: Key$ = "F6"
CASE 65: Key$ = "F7"
CASE 66: Key$ = "F8"
CASE 67: Key$ = "F9"
CASE 68: Key$ = "F10"
CASE 71: Key$ = "Home"
CASE 73: Key$ = "Page " + CHR$(24)
CASE 79: Key$ = "End"
CASE 81: Key$ = "Page " + CHR$(25)
CASE 82: Key$ = "Insert"
CASE 83: Key$ = "Delete"
CASE 84 TO 93: Key$ = "Shift+ F"
CASE 94 TO 103: Key$ = "Ctrl+ F"
CASE 104 TO 113: Key$ = "Alt+ F"
CASE 114 TO 119: Key$ = "Ctrl + pad"
CASE 120 TO 129: Key$ = "Alt+ number"
CASE 132: Key$ = "Ctrl + pad"
CASE 133: Key$ = "F11"
CASE 134: Key$ = "F12"
CASE 135: Key$ = "Shift+ F11"
CASE 136: Key$ = "Shift+ F12"
CASE 137: Key$ = "Ctrl+ F11"
CASE 138: Key$ = "Ctrl+ F12"
CASE 139: Key$ = "Alt+ F11"
CASE 140: Key$ = "Alt+ F12"
CASE ELSE: Key$ = ""
END SELECT
LOCATE 10, 5: {{Cl|PRINT USING}} tmp2$; code%; Key$
END IF
LOOP UNTIL A$ = CHR$(9)
SOUND 400, 4
SLEEP 3
SYSTEM '' ''
{{CodeEnd}}
{{small|Code by Ted Weissgerber}}
''Explanation:'' The routine checks for a keypress and [[SLEEP]] guarantees that [[ASC]] will never read an empty string from INKEY$. When the keypress is determined to be two bytes ([[ASC]](A$) = 0) the second SELECT CASE routine is used. You can even display non-keyboard extended characters. Just press Alt + numberpad code, release and press enter.
:::Note: Ctrl + letter keys will list the contol keys as normal codes. EX: Ctrl + G will BEEP (CHR$(7)).
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==References==
''Printable ASCII Table:'' [[_PRINTIMAGE]] (see Example 2 on page)
{{PageSeeAlso}}
* [[_KEYHIT]], [[_KEYDOWN]]
* [[_MAPUNICODE]], [[_MAPUNICODE (function)]]
* [[Code Pages]] {{text|(Various Unicode Languages)}}
* [[ASC (statement)]] {{text|(QB64 only)}}
* [[ASC]], [[INSTR]]
* [[CHR$]], [[INKEY$]]
* [[LEFT$]], [[MID$]], [[RIGHT$]]
* [[PRINT]], [[SCREEN]]
* [[MKI$]], [[MKL$]], [[MKS$]], [[MKD$]], [[_MK$]]
* [[_PRINTSTRING]], [[_SCREENPRINT]]
* [[_CONTROLCHR]] {{text|(turns control PRINT actions OFF/ON)}}
* [[Scancodes]](keyboard), [[Unicode]](character table)
* [[Text Using Graphics]]
{{PageNavigation}}

View file

@ -1,337 +0,0 @@
{| align="center"
| __TOC__
|}
===What are Arrays?===
Arrays are simply variables with a number of elements that can each hold data in memory. To designate a certain element, integers denote the value's position in memory. Don't let talk about memory scare you! Basic does all of the work for you just by using the simple commands in this tutorial. Besides that, you have already been using memory since you created your first variable!
Arrays can store element bytes of information like any other variable depending on the type of the variable. The total memory bytes used by an array type can be determined using the table below multiplied by the number of array elements:
:::::: [[STRING]] = 1 byte per character
:::::: [[INTEGER]] = 2 bytes (signed Integer values from -32768 to 32767)
:::::: [[LONG]] = 4 bytes (signed Integer values from -2147483648 to 2147483647)
:::::: [[SINGLE]] = 4 bytes (up to 7 digit floating decimal point values)
:::::: [[DOUBLE]] = 8 bytes (up to 15 digit floating point values)
:::::: [[_BIT]] * 8 = 1 byte(signed Integer values of -1 or 0)
:::::: [[_BYTE]] = 1 byte (signed Integer values from -128 to 127)
:::::: [[_INTEGER64]] = 8 bytes (signed values from -9223372036854775808 to 9223372036854775807
:::::: [[_FLOAT]] = 10 bytes (better than Double accuracy)
While QBasic uses signed values '''QB64''' can use signed or [[_UNSIGNED]] values for [[_BIT]], [[_BYTE]], [[INTEGER]], [[LONG]] or [[_INTEGER64]] variable type values.
The array's variable type must be determined when the array is created. If no type is used, the default type is [[SINGLE]].
<center>[[#toc|Return to Top]]</center>
===When do I need an Array?===
'''When you find yourself creating several variables with numbers in their names.''' This may seem simplistic, but normally programmers tend to use similar names to denote similar value types. This makes arrays perfect in many cases. You can get several values of the same type simply by referring to the element positions in an array. Plus you can have thousands of possibilities when needed.
Arrays can be created to hold values until they are needed. They can hold image or file data too! There are many possible uses!
The only drawback is that the data is lost when the program ends, but array data can be permanently stored in files when you want to save the data. All that you need is a simple loop to transfer the data sequencially or save the entire array to a [[BINARY]] file using '''QB64''' with a simple [[PUT]] statement. You also can retrieve the array data using one [[GET]].
<center>[[#toc|Return to Top]]</center>
===Creating Array Variables===
First we need to create a place in memory for the array. To do that we have to tell Basic the array's name, type of values it will hold and how many values we need to access. This is called dimensioning an array.
How good are you at counting from zero? This might seem like a simple question, but think about this. How many elements would we have if they were numbered 0 through 10? If you said 11, then you were correct. Some people have problems counting when 0 is involved so Basic has an option to allow all arrays to start at 1.
[[OPTION BASE]] 1 will cause all array dimensions to begin at 1, [[OPTION BASE]] 0 will cause all dimensions to begin at 0. The default when just using the maximum array size is 0. Use whatever option you are comfortable with.
Arrays in QuickBASIC 4.5 and QBASIC are limited to 32767 elements, while arrays in '''QB64''' are limited to 2147483647 elements (over 2 billion). When the 64-bit version of QB64 is implemented 9223372036854775807 elements will be the limit (but only on 64-bit systems).
{{KW|DIM}} reserves the array's name, variable type and number of elements in memory before the array is used. DIM reserves a {{KW|STATIC}} (unchangeable) array unless the {{KW|$DYNAMIC}} (changeable) metacommand is used at the program's start or {{KW|REDIM}} was used to dimension the array originally.
''Example 1:'' Dimensions an array named 'Array' that is capable of holding 101 integer values including element 0.
{{CodeStart}}
{{Cl|DIM}} Array(100) AS {{Cl|INTEGER}}
{{CodeEnd}}
An array starts at element 0 unless changed by {{KW|OPTION BASE}} 1 (which can set the start at 1), you can also define the start and end area by [[DIM]]ensioning within a range.
[[DIM]]ensioning with a range is possible also by using TO between the minimum and highest elements. Arrays can start and end at any element(index) value up to 32767. '''QB64''' allows larger array sizes!
''Example 2:'' dimensions an Integer array that can hold 100 values in indices 1 to 100.
{{CodeStart}}
{{Cl|DIM}} Array%(1 TO 100)
{{CodeEnd}}
''Note:'' The array type can also be designated by variable suffixes as % designates Integers above.
{{KW|REDIM}} can be used to redimension a dynamic array. Any information contained in the array before the REDIM will be lost...however. In order to use {{KW|REDIM}}, the variable must have originally been dimensioned using {{KW|REDIM}}, or a {{KW|$DYNAMIC}} metacommand must be placed at the top of the program.
''Example 3:''
{{CodeStart}}
{{Cl|OPTION BASE}} 1 ' placed before any arrays are dimensioned
{{Cl|REDIM}} Array$(1000) ' REDIM creates a dynamic array
{{CodeEnd}}
'''QB64''' has a REDIM {{KW|_PRESERVE}} action which can be used in a REDIM statement in order to preserve the data information in the array.
''Example 4:'' REDIM without the _PRESERVE action erases the array contents
{{CodeStart}}
{{Cl|REM}} {{Cl|$DYNAMIC}}
{{Cl|DIM}} array(20)
array(10) = 24
{{Cl|PRINT}} array(10)
{{Cl|REDIM}} {{Cl|_PRESERVE}} array(30)
{{Cl|PRINT}} array(10)
{{Cl|REDIM}} array(10)
{{Cl|PRINT}} array(10)
{{CodeEnd}}
{{OutputStart}}
24
24
0
{{OutputEnd}}
{{KW|_PRESERVE}} also allows the lowest index to be changed. The old starting index data value will always be in the lowest new index when the index range limits are changed.
''Example 5:'' Changing the starting index number using the {{KW|_PRESERVE}} action moves the data.
{{CodeStart}}
{{Cl|REDIM}} Array$(1 TO 50)
Array$(1) = "I'm number one!"
Array$(50) = "I'm 50..."
{{Cl|REDIM}} {{Cl|_PRESERVE}} Array$(51 TO 100)
PRINT Array$(51) ' display new start index data
PRINT Array$(100) ' display new end data
{{CodeEnd}}
{{OutputStart}}
I'm number one!
I'm 50...
{{OutputEnd}}
''Example 6:'' The memory segment address of the array is defined in {{KW|DEF SEG}}.
{{CodeStart}}
{{Cl|DEF SEG}} = {{Cl|VARSEG}}(array(0))
offset = {{Cl|VARPTR}}(array(0)) 'program designated offset element
{{CodeEnd}}
NOTE: If {{KW|OPTION BASE}} 1 is used change the 0 to 1. The array start index can be changed when some other data is indexed in the array.
<center>[[#toc|Return to Top]]</center>
===Mult-Dimensional Arrays===
Multiple dimensions are possible to create tables of values. QuickBASIC can use up to 60 dimensions. In '''QB64''' the number of dimensions possible depends on your system memory (a lot more than 60 dimensions). Array data can be saved and restored using file data.
<center>'''Otherwise the data is lost when a program closes.'''</center>
{{TextStart}}
''' TWO DIMENSIONAL ARRAY TABLES'''
Setting up a car sales Database: The sales for each month as represented in an array.
DIM Vehicle%(12, 4) ' Vehicle%(month%, type%)
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
''' 1 2 3 4 5 6 7 8 9 10 11 12 ← Month index'''
'''Type index ↓''' -----------------------------------------------
Cars '''1:''' 5 10 15 20 30 19 17 12 24 20 33 30
Trucks '''2:''' 3 8 7 10 15 9 11 8 15 10 16 11
Vans '''3:''' 4 6 8 9 7 10 9 7 9 8 10 7
SUV '''4:''' 10 8 8 5 10 8 6 8 10 11 9 8
To find monthly and yearly totals you could do something like this:
FOR month% = 1 TO 12
FOR type% = 1 TO 4
MonthlySales% = MonthlySales% + Vehicle%(month%, type%)
NEXT
YearlySales% = YearlySales% + MonthlySales%
PRINT "Monthly =", MonthlySales%; " Yearly ="; YearlySales%; " "
INPUT$(1) 'stop to view each month
MonthlySales% = 0 'zero month sales for next months total
NEXT
{{TextEnd}}
''Example 7:'' Creating a two-dimensional array. A comma separates each dimension size.
{{CodeStart}}
{{Cl|DIM}} Array(12, 10) ' 2 dimensions can hold 143 data values
{{CodeEnd}}
One dimension could hold the month number and the other the number of items sold in 10 categories.
''Example 8:'' Dimensioning using index ranges.
{{CodeStart}}
{{Cl|DIM}} Array(1 TO 12, 1 TO 10) ' 2 dimensions can hold 120 data values
{{CodeEnd}}
<center>[[#toc|Return to Top]]</center>
===Working with the Array Elements===
Once an array is created, you have to put something in it. As you may have noticed, each element or index has an integer value associated with it. Array(number%) refers to just one element of the array no matter what type it is. '''Arrays CAN have negative numbered elements!'''
You can place data into an array using several methods. The slowest method is directly placing data from the user. You can even use the array as the [[INPUT]] variable. It is recommended that ANY program user entries be limited to text as INPUT will give Redo from start errors if a user enters a string value when a numerical input was desired. Numerical string data can be converted from strings simply by using [[VAL]]. This creates less user errors! NOTE: '''QB64''' does not return a "Redo from start" error as [[INPUT]] monitors entries.
{{CodeStart}}
DO
{{Cl|INPUT}} "Enter your age: ", howold$
age% = {{cl|VAL}}(howold$)
LOOP UNTIL age% > 0
Playerage%(user%) = age% 'saves the players age to an indexed player number
PRINT Playerage%(user%) 'print array element to screen to verify entry
user% = user% + 1 'increment user number when all data has been entered
{{CodeEnd}}
You could use several arrays to hold the player's name, high scores, etc. Once the data is in the array, it can be used until the program ends. Then the data is lost, but you can store the data to a file before closing the program simply by using a loop. See next section.
'''To pass array data to a [[SUB]] or [[FUNCTION]] parameter, an empty element bracket passes all elements while a number only passes one specified element of the array.'''
===Array Indexing===
Arrays can be set up to hold more than one kind of data, by indexing the two or more kinds of data. To do this, the programmer reserves one set of element or index values for each kind of data. The type of values MUST be the same except when using a [[TYPE]] definition value.
<center>[[#toc|Return to Top]]</center>
===Sorting Array Data===
Arrays can be sorted numerically or alphabetically using various sorting routines. Commonly [[SWAP]] is used to trade element values in descending or ascending order.
<center>[[#toc|Return to Top]]</center>
===Saving Array Data===
Since variables and arrays exist in memory, data is lost when a program closes. To preserve program data you must either create a permanent [[DATA]] field or save the data to files.
The next time a program is used, it can [[OPEN]] that file and quickly restore all of the array data using a loop or '''QB64''' can [[GET]] the entire file's data in one GET. Use [[LINE INPUT (file statement)|LINE INPUT]] # to set the array sizes by counting the number of data rows in a file if you used a [[WRITE]] '''CSV'''(comma separated values) or a [[PRINT (file statement)|PRINT]] # sequencial file. The number of records in a [[TYPE]] or [[FIELD]] defined [[RANDOM]] access file can be found by dividing the record size into the [[LOF]]. You may want to make the array slightly larger for new entries.
<center>[[#toc|Return to Top]]</center>
===Image Arrays===
[[INTEGER]] arrays are used to hold image information when using the following graphic procedures: [[GET (graphics statement)|GET]], [[PUT (graphics statement)| PUT]], [[BSAVE]] and [[BLOAD]].
The [[INTEGER]] array size can be estimated by multiplying the height by the width of the image area. To find the actual size needed you can use the following routine to count backwards until something is found in the array. The example below returns the array size required to create a 20 by 20 image:
{{CodeStart}}
wide& = 20: deep& = 20 'change the sizes for any image area
{{Cl|DIM}} array(wide& * deep&) AS {{Cl|INTEGER}}
{{Cl|LINE}} (0, 0)-(wide& - 1, deep& - 1), 12, B 'the box border is all that you need to color.
{{Cl|GET (graphics statement)|GET}} (0, 0)-(wide& - 1, deep& - 1), array(0)
{{Cl|FOR...NEXT|FOR}} s& = wide& * deep& {{Cl|TO}} 0 {{Cl|STEP}} -1
{{Cl|IF...THEN|IF}} array(s&) {{Cl|THEN}} arraysize& = s&: {{Cl|EXIT}} {{Cl|FOR...NEXT|FOR}}
{{Cl|NEXT}}
{{Cl|PRINT}} arraysize&
{{Cl|END}} '' ''
{{CodeEnd}}
<center>'''Note: QB64 can [[GET (graphics statement)|GET]] the entire SCREEN 12 area into one array!'''</center>
See also: [[Creating Sprite Masks]]
<center>[[#toc|Return to Top]]</center>
===SHARED Arrays===
When array data is used with [[SUB]] or [[FUNCTION]] procedures they can be passed as parameters. When passed as parameters, a specific index or the entire array can be used. To specify an index, the array is passed with the element number. If the entire array is passed, the element brackets should be empty. Example: '''{{text|SUB SubName (ArrayName() AS INTEGER)|green}}'''
Arrays can also be [[SHARED]] by all procedures by using [[DIM]] [[SHARED]] when the array is created. This allows the array data to be used in the main procedure and all sub-procedures.
[[COMMON]] allows Array data to be shared between program modules when used with [[CHAIN]]. The two modules can share any variable values in a list of variables. The lists can use different variable names, but the types of values MUST be listed in the SAME order in both modules.
[[COMMON SHARED]] allows data to be shared between both modules and SUB or FUNCTION procedures.
Arrays can be created inside of [[SUB]] or [[FUNCTION]] procedures by using [[DIM]] or [[REDIM]]. Also [[SHARED]](without DIM) can be used inside of a sub-procedure to share variable data with the Main program module ONLY. Other sub-procedures cannot reference the data. To share array data with other sub-procedures, array FUNCTIONS can be created that use the internal array elements as a parameter. '''QB64 may allow sub-procedures to share values with other procedures soon!'''
Arrays can be set as [[STATIC]] to retain the values when a sub-procedure is exited. The values will be retained until changed inside of the procedure. If the procedure creates it's own array, you can use a STATIC True or False variable to determine when to [[DIM]] or [[REDIM]] a STATIC array so that values are not lost every call. The ''Ready%'' variable below DIMs the array when the function is first used:
{{CodeStart}} '' ''
{{Cl|FUNCTION}} ScanKey% (scancode%)
{{Cl|STATIC}} Ready%, keyflags%()
{{Cl|IF}} {{Cl|NOT}} Ready% {{Cl|THEN}} {{Cl|REDIM}} keyflags%(0 {{Cl|TO}} 127): Ready% = -1
i% = {{Cl|INP}}({{Cl|&H}}60) 'read keyboard states
{{Cl|IF}} (i% {{Cl|AND (boolean)|AND}} 128) {{Cl|THEN}} keyflags%(i% {{Cl|XOR (boolean)|XOR}} 128) = 0
{{Cl|IF}} (i% {{Cl|AND (boolean)|AND}} 128) = 0 {{Cl|THEN}} keyflags%(i%) = -1
K$ = {{Cl|INKEY$}}
ScanKey% = keyflags%(scancode%)
{{Cl|IF}} scancode% = 0 {{Cl|THEN}} Ready% = 0 'allows program to reset all values to 0 with a REDIM
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
:''Explanation:'' The STATIC ''Ready%'' value is always 0 when a procedure is first run. [[NOT]] zero makes the IF statement True so the array is created. The ''Ready%'' value is then changed to anything but zero to make NOT ''Ready%'' False when the procedure is called again. The FUNCTION is referenced just like an array would be. The value it returns is either 0 or -1 to verify that a certain key was released or pressed respectively. The keyboard status is also updated in the array each call. If the ''scancode%'' sent is 0(a key scan code that does not exist), the array is reset(re-dimensioned) on the next call as ''Ready%'' is reset to zero.
<center>[[#toc|Return to Top]]</center>
===Preserving Data===
[[_PRESERVE]] can preserve data when [[REDIM]] or [[$DYNAMIC]] is used to create dynamic arrays. The current array data can be preserved while changing the array element size. Increasing the size will preserve data inside of existing indices in the resized array. If the size is decreased, only the existing indices values will be preserved. '''The array [[TYPE]] and number of array dimensions cannot be changed!'''
<center>'''{{text|REDIM _PRESERVE ArrayName(1 TO 100)|green}}'''</center>
<center>[[#toc|Return to Top]]</center>
===See Also===
{{PageNavigation}}

View file

@ -1,102 +0,0 @@
Bitwise operators are much like the regular mathematics operators (+, * etc.) but are defined in terms of the individual bits of their operands. The full list of bitwise operators, with a brief summary of its operation:
* '''AND''': True if both inputs are true
* '''OR''': True if one or both inputs are true
* '''NOT''': Invert all bits
* '''XOR''': True if exactly one input is true
* '''IMP''': True if both inputs are the same
* '''EQV''': True unless first input is true and second is false
== Syntax ==
With the exception of NOT, all the bitwise operators take two operands:
::: ''result'' = ''value1'' '''AND''' ''value2''
NOT goes before the value it operates on:
::: ''result'' = '''NOT''' ''value1''
If ''value1'' or ''value2'' are non-integer numeric types, they are rounded to the nearest integer.
== Details ==
Bitwise operators work by comparing the corresponding bits in each of the input values to generate a single bit in the output value. The operators differ in how they do the comparison. The table below shows the output bit for each pair of input bits:
{| class="wikitable"
!colspan="2"|'''Operands'''
!colspan="6"|'''Operations'''
|-
!A !! B !! A AND B !! A OR B !! NOT A !! A XOR B !! A IMP B !! A EQV B
|-
|0 || 0 || 0 || 0 || 1 || 0 || 1 || 1
|-
|0 || 1 || 0 || 1 || 1 || 1 || 1 || 0
|-
|1 || 0 || 0 || 1 || 0 || 1 || 0 || 0
|-
|1 || 1 || 1 || 1 || 0 || 0 || 1 || 1
|}
Again, note that the NOT operator only has one operand. It is shown in the same table for convenience.
If one input has more bits than the other (say, an INTEGER vs a LONG) the shorter will be considered to have 0's in the missing bit positions if it is positive, or 1's if it is negative. This scheme comes about because of the [[wikipedia:Two's_complement|Two's Complement]] system for representing negative numbers. As a general rule, there should not be any surprises.
=== Use as logical operators ===
QB64 does not have AND/OR/NOT operators dedicated to operating on the overall truth of values. A numeric value is defined to be ''false'' if it is equal to 0, and ''true'' for any other value, though -1 is the standard ''true'' value, returned by the <, <= etc. operators. One can use the bitwise operators mostly like regular logical operators, but with caution. For instance, 3 is a true value, so as a logical operator NOT 3 would be 0 (false). Because it is in fact a bitwise operator, it evaluates to -4.
== Examples ==
Use '''AND''' to mask certain bits in a value. In this example, the 1's in the mask (y&) specify which bits in (x&) we are interested in, forcing all others to 0.
<source lang="qbasic">
x& = VAL("&B101010") 'Arbitrary collection of bits
y& = VAL("&B001100") 'A bit mask
PRINT "Input 1: "; BIN$(x&, 6) '6 indicates we want 6 bits of output
PRINT "Input 2: "; BIN$(y&, 6)
PRINT "Output: "; BIN$(x& AND y&, 6)
'Converts the number n& to a string of binary digits, digits& long (padding or truncating as necessary).
FUNCTION BIN$ (n&, digits&)
FOR i& = digits& - 1 TO 0 STEP -1
IF (n& AND 2 ^ i&) THEN B$ = B$ + "1" ELSE B$ = B$ + "0"
NEXT
BIN$ = B$
END FUNCTION
</source>
Output:
<pre>Input 1: 101010
Input 2: 001100
Output: 001000</pre>
Use '''OR''' to combine bit flags into a single value. The presence of a flag can then be tested by using the flag as a mask with '''AND''':
<source lang="qbasic">
'The trick here is to give each flag a value corresponding to a different bit being 1
FLAG_A& = VAL("&B0001")
FLAG_B& = VAL("&B0010")
FLAG_C& = VAL("&B0100")
FLAG_D& = VAL("&B1000")
flags& = FLAG_A& OR FLAG_C& 'Set flags A, C
'Use each flag as a bitmask to test for its presence:
IF flags& AND FLAG_A& THEN PRINT "Flag A is set"
IF flags& AND FLAG_B& THEN PRINT "Flag B is set"
IF flags& AND FLAG_C& THEN PRINT "Flag C is set"
IF flags& AND FLAG_D& THEN PRINT "Flag D is set"
</source>
Output:
<pre>Flag A is set
Flag C is set</pre>
Use '''XOR''' to toggle a bit flag (that is, change its state to the opposite of what it was). This example is the same as the '''OR''' example above, but with one extra line added. This time we enable flags A & C, then toggle flags A & B. This will disable flag A and enable B.
<source lang="qbasic">
'The trick here is to give each flag a value corresponding to a different bit being 1
FLAG_A& = VAL("&B0001")
FLAG_B& = VAL("&B0010")
FLAG_C& = VAL("&B0100")
FLAG_D& = VAL("&B1000")
flags& = FLAG_A& OR FLAG_C& 'Set flags A, C
flags& = flags& XOR FLAG_A& XOR FLAG_B& 'Toggle flags A, B
'Use each flag as a bitmask to test for its presence:
IF flags& AND FLAG_A& THEN PRINT "Flag A is set"
IF flags& AND FLAG_B& THEN PRINT "Flag B is set"
IF flags& AND FLAG_C& THEN PRINT "Flag C is set"
IF flags& AND FLAG_D& THEN PRINT "Flag D is set"
</source>
Output:
<pre>Flag B is set
Flag C is set</pre>
{{PageNavigation}}

View file

@ -1,89 +0,0 @@
'''Boolean''' statements are numerical evaluations that return True (-1 or NOT 0) or False (0) values that can be used in other calculations.
:::::::''Basic Returns:''
* True evaluations return -1. [[NOT]] 0 = -1 in Basic. Can be used to increment a value.
* For positive True results, subtract it, multiply it by a negative value or use [[ABS]].
* False evaluations return 0. Watch out for [[ERROR Codes|"Division by 0" errors]]!
{{Template:RelationalTable}}
* When evaluating a True value, an IF value < 0 statement is NOT necessary for return values not 0.
<center>''' Truth table of the BASIC Logical Operators:'''</center>
{{Template:LogicalTruthTable}}
<center>'''Boolean Conditional Operators:'''</center>
* [[AND (boolean)|AND]] can be used to add extra conditions to a boolean statement evaluation. Both must be True.
* [[OR (boolean)|OR]] can be used to add alternate conditions to a boolean statement evaluation. One must be True.
* Parenthesis are allowed inside of boolean statements to clarify an evaluation.
* '''Note that Basic returns -1 for True and 0 for False.'''
''Example 1:'' Using 2 different boolean evaluations to determine a leap year.
{{CodeStart}} '' ''
INPUT "Enter a year greater than 1583: ", annum$
Y = {{Cl|VAL}}(annum$)
leap1 = (Y {{Cl|MOD}} 4 = 0 AND Y {{Cl|MOD}} 100 <> 0) OR (Y {{Cl|MOD}} 400 = 0)
leap2 = (Y {{Cl|MOD}} 4 = 0) - (Y {{Cl|MOD}} 100 = 0) + (Y {{Cl|MOD}} 400 = 0)
PRINT "Year = "; annum$, "Leap1 = "; leap1, "Leap2 = "; leap2 '' ''
{{CodeEnd}}
:''Explanation:'' Both boolean evaluations will return -1 if the year is a leap year. It is not simply every four years as many people think. That is checked by the first evaluation (Y MOD 4 = 0) of each. In new century years like 1900 (which was not a leapyear) there is only one leap year every 400 years. 100 is used with [[MOD]] to see if there is a remainder. When that is true, the boolean return of that part of the first evaluation will be 0. The second returns -1 (which is actually added). In both evaluations the result of (Y MOD 400 = 0) indicates a century leap year.
:Entry year = 2000:
::leap1 = (-1 AND 0) OR -1 = -1 ' the AND evaluation returns False(0) so the OR value is used.
::leap2 = (-1) - (-1) + (-1) = -1 + 1 + -1 = -1
:Entry year = 1900:
:: leap1 = (-1 AND 0) OR 0 = 0 OR 0 = 0
:: leap2 = (-1) - (-1) + (0) = -1 + 1 + 0 = 0
''Example 2:'' Moving an [[ASCII]] character using the arrow keys and boolean statements to determine the new coordinate.
{{CodeStart}} '' ''
{{Cl|SCREEN}} 12
{{Cl|COLOR}} 7
{{Cl|LOCATE}} 11, 20: {{Cl|PRINT}} "Using Screen 12 here to be in 80 X 30 coordinates mode"
{{Cl|LOCATE}} 13, 6: {{Cl|PRINT}} "Simple Example of Alternative programming without IF-{{Cl|THEN}}-{{Cl|ELSE}} Statements"
{{Cl|LOCATE}} 15, 1: {{Cl|PRINT}} "Use the four Cursor keys to move the yellow cursor, text will not be disturbed"
{{Cl|LOCATE}} 17, 12: {{Cl|PRINT}} "When you {{Cl|END}} the program with the ESC key, cursor will disappear"
cordx% = 40
cordy% = 15
{{Cl|DO...LOOP|DO}}
oldcordx% = cordx%
oldcordy% = cordy%
p% = {{Cl|SCREEN (function)|SCREEN}}(cordy%, cordx%) 'get ASCII character code at present position
{{Cl|COLOR}} 14: {{Cl|LOCATE}} cordy%, cordx%: {{Cl|PRINT}} {{Cl|CHR$}}(178); 'print cursor character to position
{{Cl|WHILE}} cordx% = oldcordx% {{Cl|AND (boolean)|AND}} cordy% = oldcordy% {{Cl|AND (boolean)|AND}} k$ <> {{Cl|CHR$}}(27)
k$ = {{Cl|INKEY$}}
cordx% = cordx% + (k$ = ({{Cl|CHR$}}(0) + "K") {{Cl|AND (boolean)|AND}} cordx% > 1) + {{Cl|ABS}}(k$ = ({{Cl|CHR$}}(0) + "M") {{Cl|AND (boolean)|AND}} cordx% < 80)
cordy% = cordy% + (k$ = ({{Cl|CHR$}}(0) + "H") {{Cl|AND (boolean)|AND}} cordy% > 1) + {{Cl|ABS}}(k$ = ({{Cl|CHR$}}(0) + "P") {{Cl|AND (boolean)|AND}} cordy% < 30)
{{Cl|WEND}}
{{Cl|COLOR}} 7: {{Cl|LOCATE}} oldcordy%, oldcordx%: {{Cl|PRINT}} {{Cl|CHR$}}(p%); 'replace overwritten screen characters
{{Cl|LOOP}} {{Cl|UNTIL}} k$ = {{Cl|CHR$}}(27) '' ''
{{CodeEnd}}
{{small|Code by AlgoreIthm}}
''See also:''
* [[IF...THEN]], [[SELECT CASE]]
* [[Binary]], [[ABS]], [[SGN]]
* [[AND]], [[OR]], [[XOR]]
{{PageNavigation}}

View file

@ -1,24 +0,0 @@
'''This page is maintained for historic purposes. The keyword is not supported in QB64.'''
----
[[CALLS]] is a statement that transfers control to a procedure written in a different programming language.
{{PageSyntax}}
:[[CALLS]] {{Parameter|name}} [({{Parameter|argumentList}})]
* [[Keywords currently not supported by QB64|Not supported in QB64.]]
* The arguments are passed by reference as far addresses, unlike [[CALL]] which passes arguments by value as default. You cannot use [[BYVAL]] or [[SEG]] in a [[CALLS]] argumentList.
* [[CALLS]] is the same as using [[CALL]] with a [[SEG]] before each argument.
{{PageSeeAlso}}
*[[DECLARE (non-BASIC statement)]]
*[[CALL]]
{{PageNavigation}}

View file

@ -1,34 +0,0 @@
[[CDBL]] converts a value to the closest [[DOUBLE]]-precision value.
{{PageSyntax}}
: {{Parameter|doubleValue#}} = [[CDBL]]({{Parameter|expression}})
{{PageParameters}}
* {{Parameter|expression}} is any [[TYPE]] of literal or variable numerical value or mathematical calculation.
{{PageDescription}}
* Rounds to the closest [[DOUBLE]] floating decimal point value.
* Also can be used to define a value as [[DOUBLE]]-precision up to 15 decimals.
{{PageExamples}}
''Example:'' Prints a double-precision version of the single-precision value stored in the variable named A.
{{CodeStart}}
A = 454.67
{{Cl|PRINT}} A; {{Cl|CDBL}}(A)
{{CodeEnd}}
{{OutputStart}} 454.67 454.6700134277344
{{OutputEnd}}
: The last 11 numbers in the double-precision number change the value in this example, since A was previously defined to only two-decimal place accuracy.
{{PageSeeAlso}}
* [[CINT]], [[CLNG]]
* [[CSNG]], [[_ROUND]]
{{PageNavigation}}

View file

@ -1,23 +0,0 @@
#REDIRECT [[DECLARE (non-BASIC statement)]]
'''This page is maintained for historic purposes. The keyword is not supported in QB64.'''
----
[[CDECL]] is used to indicate that the external procedure uses the C-language argument order.
{{PageSyntax}}
: [[DECLARE]] {[[SUB]]|[[FUNCTION]]} name ['''CDECL'''] [ [[ALIAS]] "aliasname"] [([parameterlist])]
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* QuickBASIC will pass the arguments in the argument list from right to left instead of left to right which is the BASIC convention.
{{PageSeeAlso}}
*[[CALL]], [[CALLS]]
*[[DECLARE (non-BASIC statement)]]
{{PageNavigation}}

View file

@ -1,15 +0,0 @@
'''Cavemen''' lived thousands of years ago in caves or primitive shelters.
* Using simple technology, such as clubs, they acquired food and women.
* They often used short utterances called grunts and snarls.
* In 7,000 BC they came up with the word [[LET]]. Linguists believe that this word was used in sentences such as "Let GRRRR!" or "Let MEEE!". Since then, the word LET has featured prominently in the design of the BASIC programming language.
* Why are you here? Did you look up '''LET'''? Too bad! Tell your teacher to actually teach you something!
{{PageSeeAlso}}
* [[LET]] there be light!
* [[LET|Allow me to go back]]
{{PageNavigation}}

View file

@ -1,48 +0,0 @@
The '''comma''' is used to [[TAB]] the cursor after a [[PRINT]] statement's text to tab append another printed value.
''Usage:'' INPUT "Name, age and sex(M or F): ", nm$, age%, sex$
* Commas in [[PRINT]] statements [[TAB]] space values up to 15 column places with column 57 being the maximum per row.
* A comma following the prompt text in an [[INPUT]] statement does not display a question mark. A [[Semicolon|semicolon]] or no prompt does.
* Commas are also used between [[INPUT]] statement variables when more than one input is required.
* [[LINE INPUT]] can use a comma or [[semicolon]] after the prompt text. Neither will display a [[question mark]].
* Commas are used as [[argument]] separators in many kinds of QBasic statements and [[SUB]] or [[FUNCTION]] parameter lists.
* [[WRITE]] statements use commas to separate values printed to the screen or sent to a file '''without tab spacing them'''.
* '''Literal numerical values entered into program code, [[DATA]], files or user [[INPUT]] cannot contain comma separators!'''
''Example 1:'' Comparing [[TAB]] to [[comma]] tab spacing.
{{CodeStart}} '' ''
{{Cl|PRINT}} {{Cl|TAB}}(15); "T"
{{Cl|PRINT}} , "T" '' ''
{{CodeEnd}}
''Example 2:'' Comparing PRINT and WRITE statement displays.
{{CodeStart}}
value1 = 23567: value2 = 45678: value3 = 354126
{{Cl|COLOR}} 14: {{Cl|LOCATE}} 2, 1: {{Cl|PRINT}} value1, value2, value3
{{Cl|COLOR}} 12: {{Cl|LOCATE}} 4, 1: {{Cl|WRITE}} value1, value2, value3
'' ''
{{CodeEnd}}
{{OutputStart}}
{{text|23567 45678 354126|yellow}}
{{text|23567,45678,354126|red}}
{{OutputEnd}}
:''Note:'' [[WRITE]] does not space any values. The commas separate the numerical values without the normal PRINT spacing.
''See also:''
* [[Semicolon]], [[Colon]]
* [[TAB]], [[SPC]], [[SPACE$]]
* [[PRINT]], [[PRINT USING]]
* [[WRITE]], [[INPUT]], [[LINE INPUT]]
{{PageNavigation}}

View file

@ -1,37 +0,0 @@
Although you cannot use LPRINT if you are not using Windows, you can still send raw data to a printer by connecting to it using TCP/IP. The code below showcases how to do so.
== Code ==
{{CodeStart}}
'TCP/IP Printing
'********************************
'this explains how to connect to a printer and send raw text to the printer
'this is very useful to linux users who cant use the LPRINT command.
'********************************
{{Cl|DIM}} PrinterConnect {{Cl|AS}} {{Cl|LONG}}
{{Cl|DIM}} CRLF AS {{Cl|STRING}}
{{Cl|DIM}} CRFF AS {{Cl|STRING}}
{{Cl|DIM}} LinePrint {{Cl|AS}} {{Cl|STRING}}
CRLF$ = {{Cl|CHR$}}(13) + {{Cl|CHR$}}(10) ' end current print line and starts new line
FF$ = {{Cl|CHR$}}(12) ' end current print line and finish printing
CLS
PrinterConnect = {{Cl|_OPENCLIENT}}("TCP/IP:9100:***.***.***.***") 'Replace asterisks with your printer's IP address. Opens a connection to your printer
{{Cl|IF}} PrinterConnect {{Cl|THEN}}
{{Cl|PRINT}} "[Connected to " + {{Cl|_CONNECTIONADDRESS}}(PrinterConnect) + "]"
{{Cl|ELSE}} {{Cl|PRINT}} "[Connection Failed!]"
{{Cl|END}} {{Cl|IF}}
printstring1$ = "this is a printed line" + CRLF$
{{Cl|PRINT}}
{{Cl|INPUT}} "please enter the name of the file you want to print>", FileName$
{{Cl|OPEN}} FileName$ {{Cl|FOR}} {{Cl|INPUT}} {{Cl|AS}} #1
{{Cl|DO}}
{{Cl|LINE}} {{Cl|INPUT}} #1, LinePrint$
PrintString$ = LinePrint$ + CRLF$
{{Cl|PUT}} #PrinterConnect, , PrintString$:
LOOP UNTIL EOF(1)
{{Cl|PUT}} #PrinterConnect, , FF$
{{CodeEnd}}
''Thanks to SpriggsySpriggs and Atomic Kevin for the code above''

View file

@ -1,75 +0,0 @@
Although QB64 has [[_BYTE]] and [[_BIT]] variable types, there may be times that you just want to know which bits are on or off in the byte value or convert the value to a [[Binary]] number.
The tutorial below shows you how to do things manually, for instructional purposes. Bear in mind, though, that QB64 has the following suite of commands aimed at working with bits:
:: [[_SETBIT]]
:: [[_READBIT]]
:: [[_TOGGLEBIT]]
:: [[_RESETBIT]]
:: [[_SHR]], [[_SHL]]
== Doing it yourself ==
Bits are numbered from 0 to 7 and normally are read from the most significant bit(MSB = 7) to the least significant bit(LSB = 0).
: The following example shows how to convert an [[_UNSIGNED]] [[_BYTE]] or [[INTEGER]] value(0 to 255) to a [[Binary]] [[STRING]] number in QBasic.
{{CodeStart}} '' ''
{{Cl|DIM}} byte as {{Cl|_UNSIGNED}} {{Cl|_BYTE}}
byte = 222
{{Cl|FOR...NEXT|FOR}} bit = 7 to 0 {{Cl|STEP}} -1
{{Cl|IF...THEN|IF}} byte {{Cl|AND (boolean)|AND}} 2 ^ bit {{Cl|THEN}} {{Cl|PRINT}} "1"; {{Cl|ELSE}} {{Cl|PRINT}} "0";
{{Cl|NEXT}} '' ''
{{CodeEnd}}
: ''Notes:'' The above code can be adapted to place a value into a bit [[Arrays|Array]] for up to 8 flag values in a single Byte.
: How upper and lower [[_BYTE|byte]] bits are read from an [[INTEGER]] value using whole decimal or [[HEX$|hexadecimal]] values.
{{CodeStart}} '' ''
{{Cl|SCREEN}} 12
{{Cl|COLOR}} 11: {{Cl|LOCATE}} 10, 2: {{Cl|PRINT}} " AH (High Register Byte Bits) AL (Low Register Byte Bits)"
{{Cl|COLOR}} 14: {{Cl|LOCATE}} 11, 2: {{Cl|PRINT}} " 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0"
{{Cl|COLOR}} 13: {{Cl|LOCATE}} 14, 2: {{Cl|PRINT}} " {{Cl|&H}}8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 {{Cl|&H}}1"
{{Cl|COLOR}} 11: {{Cl|LOCATE}} 15, 2: {{Cl|PRINT}} "-32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1"
{{Cl|FOR...NEXT|FOR}} i = 1 {{Cl|TO}} 16
{{Cl|CIRCLE}} (640 - (37 * i), 189), 8, 9 'place bit circles
{{Cl|NEXT}}
{{Cl|LINE}} (324, 160)-(326, 207), 11, BF 'line splits bytes
DO
{{Cl|IF...THEN|IF}} Num {{Cl|THEN}}
{{Cl|FOR...NEXT|FOR}} i = 15 {{Cl|TO}} 0 {{Cl|STEP}} -1
{{Cl|IF...THEN|IF}} (Num {{Cl|AND (boolean)|AND}} 2 ^ i) {{Cl|THEN}}
{{Cl|PAINT}} (640 - (37 * (i + 1)), 189), 12, 9
Bin$ = Bin$ + "1"
{{Cl|ELSE}}: {{Cl|PAINT}} (640 - (37 * (i + 1)), 189), 0, 9
Bin$ = Bin$ + "0"
{{Cl|END IF}}
{{Cl|NEXT}}
{{Cl|COLOR}} 10: {{Cl|LOCATE}} 16, 50: {{Cl|PRINT}} "Binary ="; {{Cl|VAL}}(Bin$)
{{Cl|COLOR}} 9: {{Cl|LOCATE}} 16, 10: {{Cl|PRINT}} "Decimal ="; Num;: {{Cl|COLOR}} 13: {{Cl|PRINT}} " Hex = "; Hexa$
Hexa$ = "": Bin$ = ""
{{Cl|END IF}}
{{Cl|COLOR}} 14: {{Cl|LOCATE}} 17, 15: {{Cl|INPUT}} "Enter a decimal or HEX({{Cl|&H}}) value (0 Quits): ", frst$
first = {{Cl|VAL}}(frst$)
{{Cl|LOCATE}} 17, 15: {{Cl|PRINT}} {{Cl|SPACE$}}(55)
{{Cl|IF...THEN|IF}} first {{Cl|THEN}}
{{Cl|COLOR}} 13: {{Cl|LOCATE}} 17, 15: {{Cl|INPUT}} "Enter a second value: ", secnd$
second = {{Cl|VAL}}(secnd$)
{{Cl|LOCATE}} 16, 10: {{Cl|PRINT}} {{Cl|SPACE$}}(69)
{{Cl|END IF}}
Num = first + second
Hexa$ = "{{Cl|&H}}" + {{Cl|HEX$}}(Num)
{{Cl|LOOP}} {{Cl|UNTIL}} first = 0 {{Cl|OR (boolean)|OR}} Num > 32767 {{Cl|OR (boolean)|OR}} Num < -32768 {{Cl|OR (boolean)|OR}} (Num < -1 {{Cl|AND (boolean)|AND}} Num > -32768 '' ''
{{Cl|END}}
{{CodeEnd}}{{small|Code by Ted Weissgerber}}
''See also:''
* [[Binary]]
* [[_BIT]], [[&B]]
* [[_BYTE]]
{{PageNavigation}}

View file

@ -1,475 +0,0 @@
==Icon Viewer and Bitmap Creator==
The following program can be used to view Icon or Cursor images and save them as Bitmaps. When you answer Y the bitmap is saved with a black background so that it can be PUT using [[XOR]] on to the [[AND]] image. The AND image will be black and white if the image is irregularly shaped(not a full box image). It is placed first using [[PUT (graphics statement)|PUT]] with the AND action or can be placed using [[_PUTIMAGE]] with the color white [[_ALPHA]] being set to 0. In that case, try just placing the XOR image with the color black 0 [[_ALPHA|alpha]] with [[_SETALPHA]].
{{small|Code by Ted Weissgerber}}
{{TextStart}}
'' ''
'********************************* IconType.BI INCLUDE FILE ********************************
{{Cb|TYPE}} IconType 'Icon or cursor file header
Reserved {{Cb|AS}} {{Cb|INTEGER}} 'Reserved (always 0)
ID {{Cb|AS}} {{Cb|INTEGER}} 'Resource ID (Icon = 1, Cursor = 2)
Count {{Cb|AS}} {{Cb|INTEGER}} 'Number of icon bitmaps in Directory of icon entries array
{{Cb|END}} {{Cb|TYPE}} '6 bytes
{{Cb|TYPE}} ICONENTRY 'or unanimated Cursor entry (see ANI for animated cursors)
PWidth {{Cb|AS}} {{Cb|_BYTE}} 'Width of icon in pixels (USE THIS)
PDepth {{Cb|AS}} {{Cb|_BYTE}} 'Height of icon in pixels (USE THIS)
NumColors {{Cb|AS}} {{Cb|_BYTE}} 'Maximum number of colors: (2 or 16 colors. 256 or 24/32 bit = 0}
RES2 {{Cb|AS}} {{Cb|_BYTE}} 'Reserved. Not used (always 0)
HotSpotX {{Cb|AS}} {{Cb|INTEGER}} 'Icon: NumberPlanes(normally 0), Cursor: hotspot pixels from left
HotSpotY {{Cb|AS}} {{Cb|INTEGER}} 'Icon: BitsPerPixel(normally 0), Cursor: hotspot pixels from top
DataSize {{Cb|AS}} {{Cb|LONG}} 'Length of icon bitmap in bytes (USE THIS)
DataOffset {{Cb|AS}} {{Cb|LONG}} 'Offset byte position of icon bitmap data header in file(add 1)
{{Cb|END}} {{Cb|TYPE}} '16 bytes
{{Cb|TYPE}} ICONHEADER 'Bitmap type header found using entry DataOffset + 1
IconHSize {{Cb|AS}} {{Cb|LONG}} 'size of ICON header (always 40 bytes)
ICONWidth {{Cb|AS}} {{Cb|LONG}} 'bitmap width in pixels. (width and double height may be missing)
ICONDepth {{Cb|AS}} {{Cb|LONG}} 'Total map height in pixels (TWO TIMES the image height).
NumPlanes {{Cb|AS}} {{Cb|INTEGER}} 'number of color planes. Must be set to 1.
BPP {{Cb|AS}} {{Cb|INTEGER}} 'bits per pixel 1, 4, 8, 16, 24 or 32.(USE THIS for BPP)
Compress {{Cb|AS}} {{Cb|LONG}} 'compression method should always be 0.
RAWSize {{Cb|AS}} {{Cb|LONG}} 'size of the raw ICON image data(may only be {{Cb|XOR}} mask size).
Hres {{Cb|AS}} {{Cb|LONG}} 'horizontal resolution of the image(not normally used)
Vres {{Cb|AS}} {{Cb|LONG}} 'vertical resolution of the image(not normally used)
NumColors {{Cb|AS}} {{Cb|LONG}} 'number of colors in the color palette(not normally used)
SigColors {{Cb|AS}} {{Cb|LONG}} 'number of important colors used(not normally used)
{{Cb|END}} {{Cb|TYPE}} '40 byte
'' ''
{{TextEnd}}
{{CodeStart}}
'' ''
{{Cl|REM}} {{Cl|$INCLUDE}}: 'IconType.BI'
{{Cl|DEFINT}} A-Z
{{Cl|DIM}} Icon {{Cl|AS}} IconType
{{Cl|DIM}} {{Cl|SHARED}} Item, BPP
{{Cl|DIM}} {{Cl|SHARED}} wide&, deep&, bmp&, bmpStretch&
{{Cl|DIM}} Image(26000)
dst& = {{Cl|_NEWIMAGE}}(800, 600, 32)
{{Cl|SCREEN (statement)|SCREEN}} dst&
hdr$ = " & File ID = # ## Image(s) in file #######, bytes "
ico$ = " Size = ## X ## Colors = ## Planes = # BPP = ## "
cur$ = " Size = ## X ## Colors = ## HotSpot X = ## Y = ## "
dat$ = " DATA Size = #####, bytes {{Cl|DATA}} Offset = ######, "
bm1$ = " HeaderSize = ## MaskArea = ## X ## Planes = # BPP = ## "
bm2$ = " Compression = # RAW Data Size = ######, bytes "
{{Cl|LOCATE}} 20, 20: {{Cl|LINE INPUT}} "Enter an ICOn or CURsor file name: ", IconName$
L = {{Cl|LEN}}(IconName$)
{{Cl|IF}} L = 0 {{Cl|THEN}} {{Cl|SOUND}} 400, 4: {{Cl|SYSTEM}}
dot = {{Cl|INSTR}}(IconName$, ".")
{{Cl|IF}} dot = 0 {{Cl|THEN}}
Save$ = IconName$: IconName$ = IconName$ + ".ICO"
{{Cl|ELSE}} Save$ = {{Cl|LEFT$}}(IconName$, dot - 1)
{{Cl|END IF}}
{{Cl|OPEN}} IconName$ {{Cl|FOR (file statement)|FOR}} {{Cl|BINARY}} {{Cl|AS}} #1
length& = {{Cl|LOF}}(1)
{{Cl|PRINT}}
{{Cl|IF}} length& {{Cl|THEN}}
{{Cl|GET}} #1, 1, Icon
{{Cl|SELECT CASE}} Icon.ID
{{Cl|CASE}} 1: IC$ = "Icon": ent$ = ico$
{{Cl|CASE}} 2: IC$ = "Cursor": ent$ = cur$
{{Cl|CASE ELSE}}: IC$ = "Bitmap?"
{{Cl|END SELECT}}
{{Cl|LOCATE}} 22, 20: {{Cl|PRINT USING}} hdr$; IC$; Icon.ID; Icon.Count; length&
{{Cl|IF}} Icon.Count {{Cl|THEN}}
count = Icon.Count
{{Cl|DIM}} {{Cl|SHARED}} Entry(count) {{Cl|AS}} ICONENTRY
{{Cl|DIM}} {{Cl|SHARED}} Header(count) {{Cl|AS}} ICONHEADER
{{Cl|FOR...NEXT|FOR}} Item = 1 {{Cl|TO}} count '16 bytes each entry
{{Cl|GET}} #1, , Entry(Item)
{{Cl|NEXT}}
{{Cl|VIEW PRINT}} 24 {{Cl|TO}} 32
{{Cl|FOR...NEXT|FOR}} Item = 1 {{Cl|TO}} count
{{Cl|GET}} #1, Entry(Item).DataOffset + 1, Header(Item) 'ADD 1 to offsets!
{{Cl|COLOR}} {{Cl|_RGB}}(255, 255, 0): {{Cl|LOCATE}} 24, 30
{{Cl|IF}} count > 1 {{Cl|THEN}} {{Cl|PRINT}} " IMAGE ENTRY #"; Item {{Cl|ELSE}} {{Cl|PRINT}} " IMAGE ENTRY"
{{Cl|COLOR}} {{Cl|_RGB}}(50, 200, 255)
{{Cl|PRINT USING}} ent$; Entry(Item).PWidth; Entry(Item).PDepth; Entry(Item).NumColors; Entry(Item).HotSpotX; Entry(Item).HotSpotY
{{Cl|PRINT USING}} dat$; Entry(Item).DataSize; Entry(Item).DataOffset
{{Cl|PRINT USING}} bm1$; Header(Item).IconHSize; Header(Item).ICONWidth; Header(Item).ICONDepth, Header(Item).NumPlanes; Header(Item).BPP
{{Cl|PRINT USING}} bm2$; Header(Item).Compress; Header(Item).RAWSize
{{Cl|PRINT}}
k$ = {{Cl|INPUT$}}(1) 'Palette(4 or 8BPP) and/or {{Cl|XOR (boolean)|XOR}} mask starts immediately after an ICONHEADER
wide& = Entry(Item).PWidth: deep& = Entry(Item).PDepth: BPP = Header(Item).BPP
{{Cl|IF}} BPP > 8 {{Cl|THEN}} BitColor = 32 {{Cl|ELSE}} BitColor = 256 'assign for proper colors
bmpStretch& = {{Cl|_NEWIMAGE}}(4 * wide&, 4 * deep&, BitColor) 'set either 256 or 32
bmp& = {{Cl|_NEWIMAGE}}(wide&, deep&, BitColor) 'don't bother with {{Cl|_FREEIMAGE}}, reuse them!
{{Cl|SELECT CASE}} BPP
{{Cl|CASE}} 1: OneBit
{{Cl|CASE}} 4: FourBIT
{{Cl|CASE}} 8: EightBIT
{{Cl|CASE}} {{Cl|IS}} > 8: True{{Cl|COLOR}}
{{Cl|END SELECT}}
{{Cl|IF}} BPP < 24 {{Cl|THEN}} {{Cl|_COPYPALETTE}} bmp&, bmpStretch&
{{Cl|_PUTIMAGE}} , bmp&, bmpStretch&
{{Cl|_DEST}} 0: {{Cl|_PUTIMAGE}} (100, 0), bmpStretch&
{{Cl|SOUND}} 600, 3
{{Cl|COLOR}} {{Cl|_RGB}}(255, 0, 255): {{Cl|LOCATE}} {{Cl|CSRLIN}}, 30: {{Cl|PRINT}} "Save as Bitmap? (Y/N)";
k$ = {{Cl|INPUT$}}(1)
k$ = {{Cl|UCASE$}}(k$)
{{Cl|PRINT}} k$ + {{Cl|SPACE$}}(1);
{{Cl|IF}} k$ = "Y" {{Cl|THEN}}
SaveFile$ = Save$ + {{Cl|LTRIM$}}({{Cl|STR$}}(Item)) + ".BMP"
ThirtyTwoBit 0, 0, wide& - 1, deep& - 1, bmp&, SaveFile$
{{Cl|END IF}}
{{Cl|IF}} k$ = "Y" {{Cl|THEN}} {{Cl|PRINT}} "Saved!" {{Cl|ELSE}} {{Cl|PRINT}} "Not saved"
{{Cl|AND (boolean)|AND}}Mask
{{Cl|IF}} BPP < 24 {{Cl|THEN}} {{Cl|_COPYPALETTE}} bmp&, bmpStretch&
{{Cl|_PUTIMAGE}} , bmp&, bmpStretch&
{{Cl|_DEST}} 0: {{Cl|_PUTIMAGE}} (400, 0), bmpStretch&
{{Cl|IF}} k$ = "Y" {{Cl|THEN}}
ANDFile$ = Save$ + {{Cl|LTRIM$}}({{Cl|STR$}}(Item)) + "BG.BMP"
ThirtyTwoBit 0, 0, wide& - 1, deep& - 1, bmp&, ANDFile$
{{Cl|END IF}}
k$ = {{Cl|INPUT$}}(1)
{{Cl|CLS}}
{{Cl|NEXT}}
{{Cl|VIEW PRINT}}
{{Cl|ELSE}} {{Cl|SOUND}} 400, 4: {{Cl|CLOSE}} #1: {{Cl|PRINT}} "No images entries found!": {{Cl|END}}
{{Cl|END IF}}
{{Cl|ELSE}}: {{Cl|CLOSE}} #1: {{Cl|SOUND}} 400, 4: {{Cl|KILL}} IconName$: {{Cl|END}}
{{Cl|END IF}}
{{Cl|CLOSE}} #1
{{Cl|END}}
{{Cl|SUB}} OneBit 'adapted from TheBob's Winbit 'B & W monochrome images ONLY (NO {{Cl|PALETTE}} data)
BitsOver = wide& {{Cl|MOD}} 32
{{Cl|IF}} BitsOver {{Cl|THEN}} ZeroPAD$ = {{Cl|SPACE$}}((32 - BitsOver) \ 8)
{{Cl|_DEST}} bmp&
y = deep& - 1: p$ = " "
{{Cl|DO}}
x = 0
{{Cl|DO}}
{{Cl|GET}} #1, , p$
Byte{{Cl|VAL}} = {{Cl|ASC}}(p$)
{{Cl|FOR...NEXT|FOR}} Bit% = 7 {{Cl|TO}} 0 {{Cl|STEP}} -1 'read bits left to right
{{Cl|IF}} Byte{{Cl|VAL}} {{Cl|AND}} 2 ^ Bit% {{Cl|THEN}} {{Cl|PSET}} (x, y), 15 {{Cl|ELSE}} {{Cl|PSET}} (x, y), 0
x = x + 1
{{Cl|NEXT}} Bit%
{{Cl|LOOP}} {{Cl|WHILE}} x < wide&
{{Cl|GET}} #1, , ZeroPAD$ ' 'prevents odd width image skewing
y = y - 1 '
{{Cl|LOOP}} {{Cl|UNTIL}} y = -1
{{Cl|END SUB}}
{{Cl|SUB}} EightBIT 'adapted from TheBob's Winbit '256 palette data Colors (8 BPP)
{{Cl|IF}} wide& {{Cl|MOD}} 4 {{Cl|THEN}} ZeroPAD$ = {{Cl|SPACE$}}(4 - (wide& {{Cl|MOD}} 4))
{{Cl|_DEST}} bmp&
a$ = " ": u$ = " "
{{Cl|OUT}} {{Cl|&H}}3C8, 0
{{Cl|FOR...NEXT|FOR}} Colr = 0 {{Cl|TO}} 255
{{Cl|GET}} #1, , a$: Blu = {{Cl|ASC}}(a$) \ 4
{{Cl|GET}} #1, , a$: Grn = {{Cl|ASC}}(a$) \ 4
{{Cl|GET}} #1, , a$: Red = {{Cl|ASC}}(a$) \ 4
{{Cl|OUT}} {{Cl|&H}}3C9, Red
{{Cl|OUT}} {{Cl|&H}}3C9, Grn
{{Cl|OUT}} {{Cl|&H}}3C9, Blu
{{Cl|GET}} #1, , u$ '--- unused byte
{{Cl|NEXT}} Colr
y = deep& - 1: p$ = " "
{{Cl|DO}}: x = 0
{{Cl|DO}}
{{Cl|GET}} #1, , p$
{{Cl|PSET}} (x, y), {{Cl|ASC}}(p$)
x = x + 1
{{Cl|LOOP}} {{Cl|WHILE}} x < wide&
{{Cl|GET}} #1, , ZeroPAD$ ' 'prevents odd width image skewing
y = y - 1
{{Cl|LOOP}} {{Cl|UNTIL}} y = -1
{{Cl|END SUB}}
{{Cl|SUB}} FourBIT 'adapted from TheBob's Winbit '16 palette data colors (4 BPP = 8 or 16 color)
{{Cl|_DEST}} bmp&
{{Cl|IF}} wide& {{Cl|MOD}} 8 {{Cl|THEN}} ZeroPAD$ = {{Cl|SPACE$}}((8 - wide& {{Cl|MOD}} 8) \ 2) 'prevents odd width image skewing
a$ = " ": u$ = " "
{{Cl|FOR...NEXT|FOR}} Colr = 0 {{Cl|TO}} 15
{{Cl|OUT}} {{Cl|&H}}3C8, Colr
{{Cl|GET}} #1, , a$: Blu = {{Cl|ASC}}(a$) \ 4
{{Cl|GET}} #1, , a$: Grn = {{Cl|ASC}}(a$) \ 4
{{Cl|GET}} #1, , a$: Red = {{Cl|ASC}}(a$) \ 4
{{Cl|OUT}} {{Cl|&H}}3C9, Red
{{Cl|OUT}} {{Cl|&H}}3C9, Grn
{{Cl|OUT}} {{Cl|&H}}3C9, Blu
{{Cl|GET}} #1, , u$ '--- unused byte
{{Cl|NEXT}} Colr
y = deep& - 1: p$ = " "
{{Cl|DO}}
x = 0
{{Cl|DO}}
{{Cl|GET}} #1, , p$
HiNIBBLE = {{Cl|ASC}}(p$) \ {{Cl|&H}}10
LoNIBBLE = {{Cl|ASC}}(p$) {{Cl|AND (boolean)|AND}} {{Cl|&H}}F
{{Cl|PSET}} (x, y), HiNIBBLE
x = x + 1
{{Cl|PSET}} (x, y), LoNIBBLE
x = x + 1
{{Cl|LOOP}} {{Cl|WHILE}} x < wide&
{{Cl|GET}} #1, , ZeroPAD$ ' 'prevents odd width image skewing
y = y - 1
{{Cl|LOOP}} {{Cl|UNTIL}} y = -1
{{Cl|END SUB}}
{{Cl|SUB}} ANDMask ' '{{Cl|AND (boolean)|AND}} MASK is B & W. Black area holds {{Cl|XOR (boolean)|XOR}} colors, white displays background
BitsOver = wide& {{Cl|MOD}} 32
{{Cl|IF}} BitsOver {{Cl|THEN}} ZeroPAD$ = {{Cl|SPACE$}}((32 - BitsOver) \ 8) 'look for sizes not multiples of 32 bits
{{Cl|_DEST}} bmp&
{{Cl|IF}} BPP < 24 {{Cl|THEN}} {{Cl|PALETTE}} ' 'remove for a PUT using previous {{Cl|XOR (boolean)|XOR}} mask palette data
y = deep& - 1: a$ = " ": p$ = " "
{{Cl|DO}}
x = 0
{{Cl|DO}}
{{Cl|GET}} #1, , a$
Byte{{Cl|VAL}} = {{Cl|ASC}}(a$) 'MSBit is left when calculating 16 X 16 cursor map 2 byte integer
{{Cl|FOR...NEXT|FOR}} Bit% = 7 {{Cl|TO}} 0 {{Cl|STEP}} -1 'values despite M$ documentation that says otherwise!
{{Cl|IF}} Byte{{Cl|VAL}} {{Cl|AND}} 2 ^ Bit% {{Cl|THEN}} '{{Cl|LONG}} values cannot be used in a cursor file!
{{Cl|IF}} BPP > 8 {{Cl|THEN}} {{Cl|PSET}} (x, y), {{Cl|_RGB32}}(255, 255, 255) {{Cl|ELSE}} {{Cl|PSET}} (x, y), 15
{{Cl|ELSE}}: {{Cl|IF}} BPP > 8 {{Cl|THEN}} {{Cl|PSET}} (x, y), {{Cl|_RGB32}}(0, 0, 0) {{Cl|ELSE}} {{Cl|PSET}} (x, y), 0
{{Cl|END IF}}
x = x + 1 '16 X 16 = 32 bytes, 32 X 32 = 128 bytes {{Cl|AND (boolean)|AND}} MASK SIZES
{{Cl|NEXT}} Bit% '48 X 48 = 288 bytes, 64 X 64 = 512 bytes, 128 X 128 = 2048 bytes
{{Cl|LOOP}} {{Cl|WHILE}} x < wide&
{{Cl|GET}} #1, , ZeroPAD$ '16 X 16 and 48 X 48 = 2 byte end padder per row in the {{Cl|AND (boolean)|AND}} MASK
y = y - 1 'adds 32 and 96 bytes respectively to the raw data size!
{{Cl|LOOP}} {{Cl|UNTIL}} y = -1
{{Cl|END SUB}}
{{Cl|SUB}} True{{Cl|COLOR}} ' ' 16 Million colors. NO {{Cl|PALETTE}}! Colored by pixels (24 or 32 BPP)
{{Cl|_DEST}} bmp&
{{Cl|IF}} ((BMP.PWidth * 3) {{Cl|MOD}} 4) <> 0 {{Cl|THEN}} '3 byte pixels
ZeroPAD$ = {{Cl|SPACE$}}((4 - ((BMP.PWidth * 3) {{Cl|MOD}} 4)))
{{Cl|END IF}}
R$ = " ": G$ = " ": B$ = " "
y = deep& - 1
{{Cl|DO}}
x = 0
{{Cl|DO}}
{{Cl|GET}} #1, , B$ '3 bytes set RGB color intensities
{{Cl|GET}} #1, , G$
{{Cl|GET}} #1, , R$
red& = {{Cl|ASC}}(R$)
green& = {{Cl|ASC}}(G$)
blue& = {{Cl|ASC}}(B$)
{{Cl|PSET}} (x, y), {{Cl|_RGB}}(red&, green&, blue&) 'returns closest attribute in 4 or 8 bit
x = x + 1
{{Cl|LOOP}} {{Cl|WHILE}} x < wide&
{{Cl|GET}} #1, , ZeroPAD$ ' 'prevents odd width image skewing
y = y - 1
{{Cl|LOOP}} {{Cl|UNTIL}} y = -1
{{Cl|END SUB}} '' ''
{{Cl|REM}} {{Cl|$INCLUDE}}: '32BitSUB.BM'
{{CodeEnd}}
{{TextStart}}
'*********************************** 32BitSUB.BM INCLUDE FILE *******************************
{{Cb|SUB}} ThirtyTwoBit (x1%, y1%, x2%, y2%, image&, Filename$)
{{Cb|DIM}} Colors8%(255)
{{Cb|IF}} x1% > x2% {{Cb|THEN}} {{Cb|SWAP}} x1%, x2%
{{Cb|IF}} y1% > y2% {{Cb|THEN}} {{Cb|SWAP}} y1%, y2%
{{Cb|_SOURCE}} image&
pixelbytes& = {{Cb|_PIXELSIZE}}(image&)
{{Cb|IF}} pixelbytes& = 0 {{Cb|THEN}} {{Cb|BEEP}}: {{Cb|EXIT SUB}} 'no text screens
FileType$ = "BM"
QB64$ = "QB64" 'free advertiising in reserved bytes
{{Cb|IF}} pixelbytes& = 1 {{Cb|THEN}} OffsetBITS& = 1078 {{Cb|ELSE}} OffsetBITS& = 54 'no palette in 24/32 bit
InfoHEADER& = 40
PictureWidth& = (x2% - x1%) + 1 ' don't exceed maximum screen resolutions!
PictureDepth& = (y2% - y1%) + 1
NumPLANES% = 1
{{Cb|IF}} pixelbytes& = 1 {{Cb|THEN}} BPP% = 8 {{Cb|ELSE}} BPP% = 24
Compression& = 0
WidthPELS& = 3780
DepthPELS& = 3780
{{Cb|IF}} pixelbytes& = 1 {{Cb|THEN}} NumColors& = 256 '24/32 bit say none
{{Cb|IF}} (PictureWidth& {{Cb|AND (boolean)|AND}} 3) {{Cb|THEN}} ZeroPAD$ = {{Cb|SPACE$}}(4 - (PictureWidth& {{Cb|AND (boolean)|AND}} 3))
ImageSize& = (PictureWidth& + {{Cb|LEN}}(ZeroPAD$)) * PictureDepth&
FileSize& = ImageSIZE& + OffsetBITS&
f = {{Cb|FREEFILE}}
{{Cb|OPEN}} Filename$ {{Cb|FOR (file statement)|FOR}} {{Cb|BINARY}} {{Cb|AS}} #f
{{Cb|PUT}} #f, , FileType$
{{Cb|PUT}} #f, , FileSize&
{{Cb|PUT}} #f, , QB64$
{{Cb|PUT}} #f, , OffsetBITS&
{{Cb|PUT}} #f, , InfoHEADER&
{{Cb|PUT}} #f, , PictureWidth&
{{Cb|PUT}} #f, , PictureDepth&
{{Cb|PUT}} #f, , NumPLANES%
{{Cb|PUT}} #f, , BPP%
{{Cb|PUT}} #f, , Compression&
{{Cb|PUT}} #f, , ImageSize&
{{Cb|PUT}} #f, , WidthPELS&
{{Cb|PUT}} #f, , DepthPELS&
{{Cb|PUT}} #f, , NumColors&
{{Cb|PUT}} #f, , SigColors& '51 offset
{{Cb|IF}} pixelbytes& = 1 {{Cb|THEN}} '4 or 8 BPP Palettes set for 256 colors
u$ = {{Cb|CHR$}}(0)
{{Cb|FOR...NEXT|FOR}} c& = 0 {{Cb|TO}} 255 'PUT as BGR order colors
cv& = {{Cb|_PALETTECOLOR (function)|_PALLETTECOLOR}}(c&, image&)
Colr$ = {{Cb|CHR$}}({{Cb|_BLUE32}}(cv&))
{{Cb|PUT}} #f, , Colr$
Colr$ = {{Cb|CHR$}}({{Cb|_GREEN32}}(cv&))
{{Cb|PUT}} #f, , Colr$
Colr$ = {{Cb|CHR$}}({{Cb|_RED32}}(cv&))
{{Cb|PUT}} #f, , Colr$
{{Cb|PUT}} #f, , u$ 'Unused byte
{{Cb|NEXT}}
{{Cb|END IF}}
{{Cb|FOR...NEXT|FOR}} y% = y2% {{Cb|TO}} y1% {{Cb|STEP}} -1 'place bottom up
{{Cb|FOR...NEXT|FOR}} x% = x1% {{Cb|TO}} x2%
c& = {{Cb|POINT}}(x%, y%)
{{Cb|IF}} pixelbytes& = 1 {{Cb|THEN}}
a$ = {{Cb|CHR$}}(c&)
Colors8%({{Cb|ASC}}(a$)) = 1
{{Cb|ELSE}} : a$ = {{Cb|LEFT$}}({{Cb|MKL$}}(c&), 3)
{{Cb|END IF}}
{{Cb|PUT}} #f, , a$
{{Cb|NEXT}}
{{Cb|PUT}} #f, , ZeroPAD$
{{Cb|NEXT}}
{{Cb|FOR...NEXT|FOR}} n = 0 {{Cb|TO}} 255
{{Cb|IF}} Colors8%(n) = 1 {{Cb|THEN}} SigColors& = SigColors& + 1
{{Cb|NEXT}} n
{{Cb|PUT}} #f, 51, SigColors&
{{Cb|CLOSE}} #f
{{Cb|END SUB}} '' ''
'' ''
{{TextEnd}}
{{small|Adapted from code by Bob Seguin}}
<center>'''If full code is not displayed, refresh browser!'''</center>
<center>'''NOTE: Black areas of an image may become "see through" unless another color attribute is used and set to black!'''</center>
: This can be done by changing another color attribute's RGB settings to 0 or almost 0 and creating a mask after using it in solid black areas of a 4 or 8 BPP palette image. This can also be done using [[_PUTIMAGE]] with 32 bit [[_CLEARCOLOR]] settings.
<center>''See the following page:'' [[Creating Sprite Masks]]</center>
==Icon to Bitmap Conversion Function==
The following program uses a conversion function with the [[TYPE]] definitions inside of the function to eliminate an [[$INCLUDE]] library file.
{{CodeStart}}
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 480, 256)
{{Cl|_TITLE}} "Icon Converter"
icon$ = "daphne.ico" '<<<<<<<<< change icon file name
bitmap$ = "tempfile.bmp"
indx% = 5 '1 minimum <<<<<<< higher values than count get highest entry image in icon file
{{Cl|IF...THEN|IF}} Icon2BMP(icon$, bitmap$, indx%) {{Cl|THEN}}
img& = {{Cl|_LOADIMAGE}}(bitmap$)
{{Cl|PRINT}} img&
{{Cl|IF...THEN|IF}} img& < -1 {{Cl|THEN}} ' check that handle value is good before loading
{{Cl|_ICON}} img& ' place image in header
{{Cl|_PUTIMAGE}} (300, 250), img& 'place image on screen
{{Cl|_FREEIMAGE}} img& ' always free unused handles to save memory
'{{Cl|KILL}} bitmap$ ' comment out and/or rename to save the bitmaps
{{Cl|END IF}}
{{Cl|ELSE}} {{Cl|PRINT}} "Could not create bitmap!"
{{Cl|END IF}}
{{Cl|END}}
' ----------------------------------------------------
{{Cl|FUNCTION}} Icon2BMP% (filein {{Cl|AS}} {{Cl|STRING}}, fileout {{Cl|AS}} {{Cl|STRING}}, index {{Cl|AS}} {{Cl|INTEGER}})
{{Cl|TYPE}} ICONTYPE ' Icon or cursor file header
Reserved {{Cl|AS}} {{Cl|INTEGER}} ' Reserved (always 0)
ID {{Cl|AS}} {{Cl|INTEGER}} ' Resource ID (Icon = 1, Cursor = 2)
Count {{Cl|AS}} {{Cl|INTEGER}} ' Number of icon bitmaps in Directory of icon entries array
{{Cl|END}} {{Cl|TYPE}} '6 bytes
{{Cl|TYPE}} ENTRYTYPE ' or unanimated Cursor entry (ANI are animated cursors)
Wide {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_BYTE}} ' Width of icon in pixels (USE THIS) Use {{Cl|_UNSIGNED}} over 127
High {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_BYTE}} ' Height of icon in pixels (USE THIS) Use {{Cl|_UNSIGNED}} over 127
NumColors {{Cl|AS}} {{Cl|_BYTE}} ' Maximum number of colors. (2, 8 or 16 colors. 256 or 24/32 bit = 0)
RES2 {{Cl|AS}} {{Cl|_BYTE}} ' Reserved. Not used (always 0)
HotSpotX {{Cl|AS}} {{Cl|INTEGER}} ' Icon: NumberPlanes(normally 0), Cursor: hotspot pixels from left
HotSpotY {{Cl|AS}} {{Cl|INTEGER}} ' Icon: BitsPerPixel(normally 0), Cursor: hotspot pixels from top
DataSize {{Cl|AS}} {{Cl|LONG}} ' Length of image data in bytes minus Icon and Entry headers (USE THIS)
Offset {{Cl|AS}} {{Cl|LONG}} ' Start Offset byte position of icon bitmap header(add 1 if {{Cl|TYPE}} GET)
{{Cl|END}} {{Cl|TYPE}} '16 bytes
{{Cl|TYPE}} PREHEADER ' Bitmap information not in icon BM header
BM {{Cl|AS}} {{Cl|INTEGER}} ' Integer value changed to "BM" by PUT
Size {{Cl|AS}} {{Cl|LONG}} ' Size of the data file({{Cl|LOF}})
Reser {{Cl|AS}} {{Cl|LONG}}' 2 reserved integers are zero automatically
BOffset {{Cl|AS}} {{Cl|LONG}} ' Start offset of pixel data(next byte)
{{Cl|END}} {{Cl|TYPE}} '14 bytes
{{Cl|TYPE}} BMPHEADER ' Bitmap type header found using entry DataOffset + 1
IconHSize {{Cl|AS}} {{Cl|LONG}} ' size of ICON header (always 40 bytes)
PWidth {{Cl|AS}} {{Cl|LONG}} ' bitmap width in pixels (signed integer).
PDepth {{Cl|AS}} {{Cl|LONG}} ' Total map height in pixels (signed integer is 2 times image height)
NumPlanes {{Cl|AS}} {{Cl|INTEGER}} ' number of color planes. Must be set to 1.
BPP {{Cl|AS}} {{Cl|INTEGER}} ' bits per pixel 1, 4, 8, 16, 24 or 32.(USE THIS)
Compress {{Cl|AS}} {{Cl|LONG}} ' compression method should always be 0.
RAWSize {{Cl|AS}} {{Cl|LONG}} ' size of the raw ICON image data(may only be {{Cl|XOR (boolean)|XOR}} mask size).
Hres {{Cl|AS}} {{Cl|LONG}} ' horizontal resolution of the image(not normally used)
Vres {{Cl|AS}} {{Cl|LONG}} ' vertical resolution of the image(not normally used)
NumColors {{Cl|AS}} {{Cl|LONG}} ' number of colors in the color palette(not normally used)
SigColors {{Cl|AS}} {{Cl|LONG}} ' number of important colors used(not normally used)
{{Cl|END}} {{Cl|TYPE}} '40 bytes palette and image data immediately follow this header!
{{Cl|DIM}} ICON {{Cl|AS}} ICONTYPE, ENT {{Cl|AS}} ENTRYTYPE, PRE {{Cl|AS}} PREHEADER, BMP {{Cl|AS}} BMPHEADER
rf = {{Cl|FREEFILE}}
{{Cl|IF...THEN|IF}} {{Cl|LCASE$}}({{Cl|RIGHT$}}(filein, 4)) = ".ico" {{Cl|THEN}} 'check file extension is ICO only
{{Cl|OPEN}} filein {{Cl|FOR...NEXT|FOR}} {{Cl|BINARY}} {{Cl|ACCESS}} {{Cl|READ}} {{Cl|AS}} rf
{{Cl|ELSE}} {{Cl|EXIT FUNCTION}}
{{Cl|END IF}}
{{Cl|GET}} rf, , ICON 'GET 6 byte icon header
{{Cl|IF...THEN|IF}} ICON.ID <> 1 {{Cl|OR (boolean)|OR}} ICON.Count = 0 {{Cl|THEN}} {{Cl|CLOSE}} rf: {{Cl|EXIT FUNCTION}}
{{Cl|IF...THEN|IF}} index > 0 {{Cl|AND (boolean)|AND}} index <= ICON.Count {{Cl|THEN}} entry = 16 * (index - 1) {{Cl|ELSE}} entry = 16 * (ICON.Count - 1)
{{Cl|PRINT}} ICON.Count, entry
{{Cl|SEEK}} rf, 1 + 6 + entry 'start of indexed Entry header selected
{{Cl|GET}} rf, , ENT 'GET 16 byte Entry Header set by index request or highest available
{{Cl|SEEK}} rf, 1 + ENT.Offset 'go to BMP header offset given in Entry header
{{Cl|GET}} rf, , BMP 'GET 40 byte icon bitmap header information
{{Cl|IF...THEN|IF}} BMP.BPP <= 24 {{Cl|THEN}} pixelbytes = BMP.BPP / 8 {{Cl|ELSE}} pixelbytes = 3
{{Cl|IF...THEN|IF}} BMP.BPP > 1 {{Cl|AND (boolean)|AND}} BMP.BPP <= 8 {{Cl|THEN}} palettebytes = 4 * (2 ^ BMP.BPP) {{Cl|ELSE}} palettebytes = 0
datasize& = (ENT.Wide * ENT.High * pixelbytes) + palettebytes 'no padder should be necessary
filesize& = datasize& + 14 + 40 ' data and palette + header
bmpoffset& = palettebytes + 54 ' data offset from start of bitmap
BMP.PWidth = ENT.Wide
BMP.PDepth = ENT.High
BMP.RAWSize = datasize& - palettebytes
PRE.BM = {{Cl|CVI}}("BM") 'integer value changes to "BM" in file
PRE.Size = filesize&
PRE.BOffset = bmpoffset& 'start of data after header and palette if used
wf = {{Cl|FREEFILE}}
{{Cl|OPEN}} fileout {{Cl|FOR...NEXT|FOR}} {{Cl|BINARY}} {{Cl|AS}} wf
{{Cl|PUT}} wf, , PRE 'PUT 14 byte bitmap information
{{Cl|PUT}} wf, , BMP 'PUT 40 byte bitmap header information
{{Cl|SEEK}} rf, 1 + ENT.Offset + 40
dat$ = {{Cl|STRING$}}(datasize&, 0) 'create string variable the length of remaining image data
{{Cl|GET}} rf, , dat$ 'GET remaining palette and only the XOR image data after the indexed header
{{Cl|PUT}} wf, , dat$ 'PUT remaining data into new bitmap file
{{Cl|CLOSE}} rf, wf
Icon2BMP = ICON.Count 'function returns number of images available in icon file
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
{{small|Code by Ted Weissgerber}}
: ''Note:'' The index selected or the highest numbered icon image less than the index value is the image displayed.
==References==
''See also:''
* [[Creating Icons from Bitmaps]]
* [[Bitmaps]], [[Icons and Cursors]]
* [[_CLEARCOLOR]]
* [[_ALPHA]], [[_ICON]]
* [[SaveIcon32]] {{text|(create icons from any image)}}
{{PageNavigation}}

View file

@ -1,49 +0,0 @@
'''This page is maintained for historic purposes. The keyword is not supported in QB64. Reading the current date is supported with the [[DATE$|DATE$ function]].'''
----
The [[DATE$]] statement sets the current computer date to another [[STRING]] value.
{{PageSyntax}}
: [[DATE$]] = {{Parameter|stringExpression$}}
* {{Parameter|stringExpression$}} can use slash or dash as separators:
::::mm-dd-yyyy
::::mm/dd/yyyy
* String expression or variable must contain the month, day and 4 digit year to be changed (10 valid characters).
* If value is not a valid formatted string, a "Type Mismatch" error results. The previous DATE$ value will be retained.
* The current date (as assigned when the operating system was initialized) can be saved to restore later with the [[DATE$]] function.
*The DATE$ function returns a 10-character string in the form ''mm-dd-yyyy''. ''mm'' is the month (01 to 12), ''dd'' is the day (01 to 31), and ''yyyy'' is the four digit year.
* '''Note: Some systems may not allow the DATE to be reset or require Administrator privileges.''' Try a batch file or [[SHELL]].
{{PageExamples}}
''Example:'' Backdating computer to run old software.
{{CodeStart}}
today$ = {{Cl|DATE$}} ' function saves current computer date value
PRINT today$ ' verify actual date
{{Cl|DATE$ (statement)|DATE$}} = "12-25-2000" ' literal statement changes date
PRINT {{Cl|DATE$}} ' verify new date setting
{{Cl|SHELL}} "CMD /C " + programfile$ 'run old program
K$ = {{Cl|INPUT$}}(1) ' press a key
DATE$ = today$ ' statement resets computer to original date later in program
PRINT {{Cl|DATE$}} ' verify present setting
{{CodeEnd}}
{{OutputStart}}
09-01-2009
12-25-2000
09-01-2009
{{OutputEnd}}
{{PageSeeAlso}}
[[DATE$]], [[TIME$]], [[TIME$ (statement)]]
{{PageNavigation}}

View file

@ -1,31 +0,0 @@
'''This page is maintained for historic purposes. The usage of the DECLARE keyword explained below isn't required/implemented in QB64. QB64 ignores any occurrences of DECLARE SUB/FUNCTION when older code is compiled. For the modern usage of the DECLARE keyword (for external C procedures), see [[DECLARE LIBRARY]].'''
----
The '''DECLARE''' statement is used to tell Qbasic that a [[SUB]] or [[FUNCTION]] is to be used in the program with specific parameter types.
{{PageSyntax}}
:: '''DECLARE''' {SUB|FUNCTION} ProcedureName ([''parameter'' [[AS]] type[, ...]])
* '''QB64 ignores DECLARE SUB or FUNCTION statements, so define the parameter [[TYPE]]s in the SUB procedure!'''
* Parameters MUST be placed in parenthesis separated by commas when necessary.
* Empty parenthesis are required when no parameters are used.
* Declarations should be placed at the top of the main program code after {{KW|Metacommand}} and {{KW|DEFINT|DEF}} statements if used.
* Parameters can be defined in a DECLARE statement [[AS]] [[INTEGER]], [[SINGLE]], [[DOUBLE]], [[LONG]], [[STRING]] or [[ANY]].
* The Qbasic IDE can automatically DECLARE a SUB or FUNCTION once the procedure is called and the module is Saved.
* If a procedure is never called, it will not be automatically be DECLAREd by the Qbasic IDE when the program is saved.
''See also:''
* [[SUB]], [[FUNCTION]]
* [[CALL]], [[BYVAL]]
* [[DECLARE LIBRARY]] (QB64 ONLY)
{{PageNavigation}}

View file

@ -1,28 +0,0 @@
'''This page is maintained for historic purposes. The usage of the DECLARE keyword explained below isn't supported by QB64. QB64 ignores any occurrences of DECLARE SUB/FUNCTION when older code is compiled. For the modern usage of the DECLARE keyword, see [[DECLARE LIBRARY]].'''
----
Declares calling sequences for external procedures written in other languages.
{{PageSyntax}}
: [[DECLARE]] {[[SUB]]|[[FUNCTION]]} name [ [[CDECL]] ] [ [[ALIAS]] "aliasname"] [([parameterlist, ...])]
* [[CDECL]] indicates that the procedure uses the C language argument order.
* [[ALIAS]] indicates the procedure name used in the object or library file.
* The syntax for the parameterlist is as follows: [{ [[BYVAL]] | [[SEG]] }] variable [AS type [,[{ [[BYVAL]] | [[SEG]] }] variable2 [ [[AS]] type]]...
* '''QB64 ignores DECLARE statements, so define the parameter [[TYPE]] values in the SUB!'''
''See also:''
* [[CALL]], [[CALLS]], [[SETMEM]]
* [[DECLARE LIBRARY]] (QB64 Only)
{{PageNavigation}}

View file

@ -1,84 +0,0 @@
'''This page is maintained for historic purposes. The keyword is not supported in QB64. Create functions using [[FUNCTION]]. If older code contains ''DEF FN'' functions, they must be adapted to be compiled with QB64.'''
----
The '''DEF FN''' statement defines a non-recursive function in the main module that can use the module's variable values.
{{PageSyntax}}
:[[DEF FN]]{{Parameter|name}} [({{Parameter|parameterList}})] = {{Parameter|expression}}
::or,
:[[DEF FN]]{{Parameter|name}} [({{Parameter|parameterList}})]
::[{{Parameter|statements}}]
::[[DEF FN|FN]]{{Parameter|name}} = {{Parameter|expression}}
::[{{Parameter|statements}}]
:'''END DEF'''
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* {{Parameter|name}} is the name of the function.
* {{Parameter|parameterList}} is a comma-separated list of one or more parameters, similar to [[SUB]] and [[FUNCTION]] statements.
* {{Parameter|expression}} is any numerical or string value to return from the function.
* Function can be created anywhere in a module. Not in [[SUB]] procedures.
* Function must be defined only once and the definition cannot be in recursive (repeated) parts of a program.
* Function returns should be assigned to a variable when an alteration to the return value is necessary.
* Function references should only be made after the declaration.
* Multi-line function definitions must end with '''END DEF'''.
* To leave a DEF Fn function early use '''EXIT DEF'''.
* This type of function can share values in module level code. To keep values local to the procedure use [[STATIC]].
* Parameters cannot be from arrays, records or fixed length strings.
* ''Fn'' must prefix the function name inside of the procedure and in a call.
==QBasic/QuickBASIC==
* Other variable names or procedures cannot begin with FN or fn in QBasic.
* QBasic Help recommends creating real [[FUNCTION]]s over DEF FN functions because of the above limitations.
{{PageExamples}}
:Function to get the base 10 logarithm of a number value.
{{CodeStart}}{{Cl|DEF FN}}Log10#(x) = {{Cl|LOG}}(x) / {{Cl|LOG}}(10.#)
{{Cl|PRINT}} FNLog10#(10)
{{Cl|PRINT}} FNLog10#(100)
{{Cl|PRINT}} FNLog10#(1000)
{{CodeEnd}}
{{OutputStart}} 1
2
3
{{OutputEnd}}
:Demonstrates the multi-line syntax by drawing a circle:
{{CodeStart}}{{Cl|CONST}} PI# = 3.141592653589793#
{{Cl|DEF FN}}DegreesToRadians# (degrees#)
radians# = degrees# * (PI# / 180#)
FNDegreesToRadians# = radians#
{{Cl|DEF FN|END DEF}}
{{Cl|SCREEN}} 13
{{Cl|WINDOW}} (-1, -1)-(1, 1)
{{Cl|CLS}}
{{Cl|FOR}} degree% = 0 TO 360
x# = {{Cl|COS}}(FNDegreesToRadians#(degree%))
y# = {{Cl|SIN}}(FNDegreesToRadians#(degree%))
{{Cl|PSET}} (x#, y#)
{{Cl|NEXT}} degree%
{{CodeEnd}}
{{PageSeeAlso}}
* [[FUNCTION]], [[SUB]]
* [[DEFSTR]], [[DEFINT]]
* [[DEFSNG]], [[DEFLNG]]
* [[DEFDBL]]
* [[_DEFINE]]
{{PageNavigation}}

View file

@ -1,52 +0,0 @@
{{DISPLAYTITLE:_DIR$}}
The [[_DIR$]] function returns common paths in '''Windows''' only such as My Documents, My Pictures, My Music, Desktop.
{{PageSyntax}}
: {{Parameter|d$}} = [[_DIR$]]("{{Parameter|folderspecification}}")
{{PageParameters}}
* ''folderspecification'' may be "desktop", "download", "documents", "music", "video", "pictures", "appdata", "program data", "local data", "program files", "program files (x86)", "temp".
* Some variation is accepted for the folder specification:
:: MY DOCUMENTS, TEXT, DOCUMENT, DOCUMENTS, DOWNLOAD, DOWNLOADS
:: MY MUSIC, MUSIC, AUDIO, SOUND, SOUNDS
:: MY PICTURES, PICTURE, PICTURES, IMAGE, IMAGES, PHOTO, PHOTOS, DCIM, CAMERA, CAMERA ROLL
:: MY VIDEOS, VIDEO, VIDEOS, MOVIE, MOVIES,
:: DATA, APPDATA, APPLICATION DATA, PROGRAM DATA, LOCAL DATA, LOCALAPPDATA, LOCAL APPLICATION DATA, LOCAL PROGRAM DATA
{{PageDescription}}
* The path returned ends with a backslash (Windows).
* A nonexistent folder specification usually defaults to the Desktop folder path.
* In Linux and macOS the function always returns '''"./"'''
{{PageExamples}}
Example: Displaying default paths in Windows only.
{{CodeStart}}{{Cl|PRINT}} "DESKTOP=" + _DIR$("desktop")
{{Cl|PRINT}} "DOWNLOADS=" + {{Cl|_DIR$}}("download")
{{Cl|PRINT}} "DOCUMENTS=" + {{Cl|_DIR$}}("my documents")
{{Cl|PRINT}} "PICTURES=" + {{Cl|_DIR$}}("pictures")
{{Cl|PRINT}} "MUSIC=" + {{Cl|_DIR$}}("music")
{{Cl|PRINT}} "VIDEO=" + {{Cl|_DIR$}}("video")
{{Cl|PRINT}} "APPLICATION DATA=" + {{Cl|_DIR$}}("data")
{{Cl|PRINT}} "LOCAL APPLICATION DATA=" + {{Cl|_DIR$}}("local application data")
{{CodeEnd}}
{{OutputStart}}DESKTOP=C:\Documents and Settings\Administrator\Desktop\
DOWNLOADS=C:\Documents and Settings\Administrator\Downloads\
DOCUMENTS=C:\Documents and Settings\Administrator\My Documents\
PICTURES=C:\Documents and Settings\Administrator\My Documents\My Pictures\
MUSIC=C:\Documents and Settings\Administrator\My Documents\My Music\
VIDEO=C:\Documents and Settings\Administrator\My Documents\My Videos\
APPLICATION DATA=C:\Documents and Settings\Administrator\Application Data\
LOCAL APPLICATION DATA=C:\Documents and Settings\Administrator\Local Settings\Application Data\
{{OutputEnd}}
{{PageSeeAlso}}
* [[_CWD$]]
* [[_STARTDIR$]]
{{PageNavigation}}

View file

@ -1,157 +0,0 @@
Any [[Expression|expression]], including [[CONST|constants]] and [[Variable|variables]] all have an associated type to describe their value. QB64 has various built-in data types used to represent number and text values. [[#Numeric types|Numeric types]] represent number values, while [[#String types|string types]] represent text values.
==Numeric types==
QB64 supports several numeric types, capable of representing a wide range of numbers. There are two kinds of numeric data type: ''integer types'' and ''floating-point types''.
===Integer types===
Integer types represent integer (whole number) values, such as 1 and 100. They are divided into two flavors: ''signed'' and ''unsigned''.
====Signed Integer types====
Signed integers can represent positive and negative integer (whole number) values, such as 3, 10 and -16. These values are stored as a series of bits in [http://en.wikipedia.org/wiki/Two%27s_complement two's complement form], a common representation that makes them both straightforward and efficient to perform calculations with.
Signed integers are typically used in simple mathematical equations.
The range of values that these types can represent is based on their size, in bits; the greater number of bits, the larger positive and lesser negative value the types can represent.
The signed integer types are: [[_BYTE]], [[INTEGER]], [[LONG]], [[_INTEGER64]] and [[_OFFSET]]
{{CodeStart}}DIM n AS INTEGER
n = -1
PRINT n
{{CodeEnd}}
{{OutputStart}}-1
{{OutputEnd}}
====Unsigned Integer types====
Unsigned integers can represent positive integer values only, such as 3, 10 and 16. These values are also stored as a series of bits, but unlike signed integers, all of the bits contribute to their value. Thus, these types can represent larger positive integer values than their signed counterparts.
Unsigned integers are typically used to represent a simple quantity, like a ''count'' or a ''length''. They are also often used as ''bit masks'', where certain bits that make up the value represent separate information (such as the state of one or more ''flags'').
Types: [[_UNSIGNED]] [[_BYTE]], [[_UNSIGNED]] [[INTEGER]], [[_UNSIGNED]] [[LONG]], [[_UNSIGNED]] [[_INTEGER64]], [[_UNSIGNED]] [[_OFFSET]]
{{CodeStart}}' display the largest value representable by an _UNSIGNED INTEGER:
DIM n AS _UNSIGNED INTEGER
n = -1
PRINT n
{{CodeEnd}}
{{OutputStart}}65535
{{OutputEnd}}
====_OFFSET Integer types====
Offset Integer types can be any byte size integer value that can be used to designate pointer offset positions in memory. DO NOT TRANSFER offset values to other Integer types!
===Floating-point types===
Floating-point types can represent both positive and negative number values, as well as fractional number values, such as 1.2 and -34.56.
Floating-point types are used in mathematical equations where fractional precision is important, such as trigonometry.
The floating-point types are: [[SINGLE]], [[DOUBLE]] and [[_FLOAT]].
{{CodeStart}}f! = 76.0
c! = (5.0 / 9.0) * (f! - 32.0)
PRINT f! ; "degrees Fahrenheit is" ; c! ; "degrees Celcius."
{{CodeEnd}}
{{OutputStart}} 76 degrees Fahrenheit is 24.44444 degrees Celcius.
{{OutputEnd}}
==String types==
QB64 has built-in support for strings, which are contiguous sequences of characters represented as <tt>[[_UNSIGNED]] [[_BYTE]]</tt> values. Strings are usually used to store and manipulate text, but can also be used as a general storage area for arbitrary data (like a binary file).
Strings have a property called ''length'', which is the number of characters currently stored in the string, and QB64 supports two kinds of string types based on this property: ''variable-length strings'' and ''fixed-length strings''.
===Variable-length strings===
Variable length strings are undefined length string variables. Fixed length strings MUST be defined in a program before they are used. Undefined strings can be up to 32767 characters in QBasic.
{{CodeStart}}
message$ = "Hello"
message$ = message$ + " world!" 'add to string variables using string concatenation only!
PRINT message$
{{CodeEnd}}
{{OutputStart}}
Hello world!
{{OutputEnd}}
===Fixed-length strings===
Fixed length strings must be defined in a {{KW|DIM}} statement, {{KW|SUB}} or {{KW|FUNCTION}} parameter or {{KW|TYPE}} definition. The designated multiple is the maximum number of {{KW|STRING}} character bytes that the variable or {{KW|Arrays|array}} can hold. Excess bytes will not be included. No error is created.
{{CodeStart}}
DIM message AS STRING * 5
message$ = "Hello"
message$ = message$ + " world!"
PRINT message$
{{CodeEnd}}
{{OutputStart}}
Hello
{{OutputEnd}}
==Data type limits==
The following table lists the numerical and string data types, their type suffix symbol, and the range of the values they can represent:
'''Numerical types'''
{| class="wikitable"
!  Type Name !! Type suffix symbol !! Minimum value !! Maximum value !! Size in Bytes
|-
| _BIT || ` || -1 || 0 || 1/8
|-
| _BIT|_BIT * n || `n || -128 || 127 || n/8
|-
| _UNSIGNED _BIT || ~` || 0 || 1 || 1/8
|-
| _BYTE || %% || -128 || 127 || 1
|-
| _UNSIGNED _BYTE || ~%% || 0 || 255 || 1
|-
| INTEGER || % || -32,768 || 32,767 || 2
|-
| _UNSIGNED INTEGER || ~% || 0 || 65,535 || 2
|-
| LONG || & || -2,147,483,648 || 2,147,483,647 || 4
|-
| _UNSIGNED LONG || ~& || 0 || 4,294,967,295 || 4
|-
| _INTEGER64 || && || -9,223,372,036,854,775,808 || 9,223,372,036,854,775,807 || 8
|-
| _UNSIGNED _INTEGER64 || ~&& || 0 || 18,446,744,073,709,551,615 || 8
|-
| SINGLE || ! or none || -2.802597E-45 || +3.402823E+38 || 4
|-
| DOUBLE || # || -4.490656458412465E-324 || +1.797693134862310E+308 || 8
|-
| _FLOAT || ## || -1.18E4932 || +1.18E+4932 || 32(10 used)
|-
| _OFFSET || %& || -9,223,372,036,854,775,808 || 9,223,372,036,854,775,807 || Use LEN
|-
| _UNSIGNED _OFFSET || ~%& || 0 || 18,446,744,073,709,551,615 || Use LEN
|-
| _MEM || none || combined memory variable type || N/A || Use LEN
|}
:''Note: For the floating-point numeric types [[SINGLE]] (default when not assigned), [[DOUBLE]] and [[_FLOAT]], the minimum values represent the smallest values closest to zero, while the maximum values represent the largest values closest to ±infinity. OFFSET dot values are used as a part of the [[_MEM]] variable type in QB64 to return or set the position in memory.''
'''String text type'''
{| class="wikitable"
!       Type Name      !! Type suffix symbol !! Minimum length !! Maximum length || Size in Bytes
|-
| STRING || $ ||            0 ||               2,147,483,647 || Use LEN
|-
| STRING|STRING * ''n'' || $''n'' ||         1 ||       2,147,483,647 || n
|}
<center>''Note: For the fixed-length string type [[STRING|STRING * ''n'']], where ''n'' is an integer length value from 1 (one) to 2,147,483,647.</center>
{{PageNavigation}}

View file

@ -1,22 +0,0 @@
'''This page is maintained for historic purposes. The keyword is [[Keywords currently not supported by QB64|not supported in QB64]].'''
----
[[ERDEV$]] is a string function that returns the name of the last device to declare an error.
{{PageSyntax}}
: {{Parameter|device$}} = [[ERDEV$]]
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* It will contain the 8-byte character device name if the error was declared by a character device (such as a printer), while it will contain the 2-byte block name (A:, B:, etc.) if the device was not a character device.
* It is set when [[ERDEV]] is set, meaning that DOS has encountered a error that prevents it from continuing.
{{PageSeeAlso}}
* [[ERDEV]]
* [[ERROR]]
{{PageNavigation}}

View file

@ -1,20 +0,0 @@
'''This page is maintained for historic purposes. The keyword is [[Keywords currently not supported by QB64|not supported in QB64]].'''
----
[[ERDEV]] is an integer function that returns an error code from the last device to create an error.
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* The code is bit-encoded containing DOS error information, the first 8-bit (first byte) contain the DOS error code, while the second bit contains device specific information (bits 15, 14, 13, (12-4 always zero), 3, 2, 1 in that order of the device attribute word).
* [[ERDEV]] is set by the critical error handler (interrupt 24h) when DOS encounters a error that prevents it from continuing.
{{PageSeeAlso}}
[[ERDEV$]], [[ERROR]]
{{PageNavigation}}

View file

@ -1,201 +0,0 @@
This page lists all the error codes defined in QB64 that can occur in a program when running. Unless overridden with an [[ON ERROR]] handler, these result in a dialog box appearing. Due to legacy holdovers from previous BASIC dialects, not all of these errors may actually occur in a program (unless manually triggered with [[ERROR]]).
If you encounter an error while editing in the QB64 IDE or when compiling (especially a "C++ Compilation Failed" message), or believe your program is correct, please report the error at https://github.com/QB64Team/qb64/issues.
It's a good idea to exclude qb64.exe from any real-time anti-virus scanning to prevent generic strange errors when editing or compiling.
== Recoverable errors ==
These errors can be triggered in QB64, and may be caught by an [[ON ERROR]] handler. The default error handler gives the user option to continue program execution.
{| class="wikitable"
|-
! Code !! Description !! Possible Cause
|-
| 2 || Syntax error || [[READ]] attempted to read a number but could not parse the next [[DATA]] item.
|-
| 3 || RETURN without GOSUB || The [[RETURN]] statement was encounted without first executing a corresponding [[GOSUB]].
|-
| 4 || Out of DATA || The [[READ]] statement has read past the end of a [[DATA]] block. Use [[RESTORE]] to change the current data item if necessary.
|-
| 5 || Illegal function call || A function was called with invalid parameters, in the wrong graphics mode or otherwise in an illegal fashion. [[Illegal Function]] gives some suggestions.
|-
| 6 || Overflow || A numeric operation has resulted in a value beyond a variable's allowed range. See [[Variable Types|variable type]].
|-
| 7 || Out of memory || Generic out of memory condition.
|-
| 9 || Subscript out of range || An [[Arrays|array's]] [[UBOUND|upper]] or [[LBOUND|lower]] [[DIM|dimensioned]] boundary has been exceeded.
|-
| 10 || Duplicate definition || An array created with [[DIM]] was redefined with [[DIM]] or [[REDIM]].
|-
| 13 || Type mismatch || A [[PRINT USING]] format string did not match the type of the supplied variables.
|-
| 20 || RESUME without error || The [[RESUME]] statement was encountered outside of an [[ON ERROR]] error handler.
|-
| 50 || FIELD overflow || The [[FIELD]] statement tried to allocate more bytes than were specified for the record length of a random access file.
|-
| 51 || Internal error || Generic error
|-
| 52 || Bad file name or number || A file handle was used that does not correspond to a valid opened file.
|-
| 53 || File not found || File error, see below
|-
| 54 || Bad file mode || A file operation was not compatible with the mode used in the [[OPEN]] statement.
|-
| 55 || File already open || An [[OPEN]] statement attempted to use a file handle that is already in use. Consider using [[FREEFILE]].
|-
| 59 || Bad record length || The record length used for a [[RANDOM]] file was insufficient to perform the operation.
|-
| 62 || Input past end of file || A file was read past its end. Ensure [[EOF]] is being correctly checked.
|-
| 63 || Bad record number || The record (for [[RANDOM]]) or offset (for [[BINARY]]) is outside the allowed range.
|-
| 64 || Bad file name || File error, see below
|-
| 68 || Device unavailable || A serial port (COM device) failed to behave as expected
|-
| 70 || Permission denied || File error, see below
|-
| 75 || Path/File access error || File error, see below
|-
| 76 || Path not found || File error, see below
|-
| 258 || Invalid handle || An handle used for an image, sound, font etc. was invalid. Be sure to check the return values of functions like _LOADFONT and _LOADIMAGE.
|}
Error handling of file operations varies between operating systems and is highly dependent on the exact circumstances. The errors marked "file error" above should all be equally treated as a generic failure to read or write from disk.
== Critical errors ==
These errors can be triggered in QB64 but will not be caught by an [[ON ERROR]] handler. They are always fatal, causing the program to exit.
{| class="wikitable"
|-
! Code !! Description !! Notes
|-
| 11 || Division by zero || Only relevant for integer division, and may not be caught on all operating systems.
|-
| 256 || Out of stack space || Too many nested [[GOSUB]] calls.
|-
| 257 || Out of memory || Generic out of memory condition.
|-
| 259 || Cannot find dynamic library file || A .dll, .so or .dylib file referred to by [[DECLARE LIBRARY]] was not found.
|-
| 260, 261 || Sub/Function does not exist in dynamic library || A function declared with [[DECLARE LIBRARY]] does not exist.
|-
| 270 || _GL command called outside of SUB _GL's scope
|-
| 271 || END/SYSTEM called within SUB _GL's scope
|-
| 300 || Memory region out of range || Triggrered by _MEM commands
|-
| 301 || Invalid size || Triggrered by _MEM commands
|-
| 302 || Source memory region out of range || Triggrered by _MEM commands
|-
| 303 || Destination memory region out of range || Triggrered by _MEM commands
|-
| 304 || Source and destination memory regions out of range || Triggrered by _MEM commands
|-
| 305 || Source memory has been freed || Triggrered by _MEM commands
|-
| 306 || Destination memory has been freed || Triggrered by _MEM commands
|-
| 307 || Memory already freed || Triggrered by _MEM commands
|-
| 308 || Memory has been freed || Triggrered by _MEM commands
|-
| 309 || Memory not initialized || Triggrered by _MEM commands
|-
| 310 || Source memory not initialized || Triggrered by _MEM commands
|-
| 311 || Destination memory not initialized || Triggrered by _MEM commands
|-
| 312 || Source and destination memory not initialized || Triggrered by _MEM commands
|-
| 313 || Source and destination memory have been freed || Triggrered by _MEM commands
|-
| 314 || _ASSERT failed || See [[_ASSERT]].
|-
| 315 || _ASSERT failed (check console for description) || See [[_ASSERT]].
|-
| 502 to 518 || Out of memory || Generic out of memory condition.
|}
== Legacy errors ==
These errors will never be generated by a genuine error condition, and can only be triggered by explicit use of the [[ERROR]] command. They can all be caught by [[ON ERROR]].
{| class="wikitable"
|-
! Code !! Description
|-
| 1 || NEXT without FOR
|-
| 8 || Label not defined
|-
| 12 || Illegal in direct mode
|-
| 14 || Out of string space
|-
| 16 || String formula too complex
|-
| 17 || Cannot continue
|-
| 18 || Function not defined
|-
| 19 || No RESUME
|-
| 24 || Device timeout
|-
| 25 || Device fault
|-
| 26 || FOR without NEXT
|-
| 27 || Out of paper
|-
| 29 || WHILE without WEND
|-
| 30 || WEND without WHILE
|-
| 33 || Duplicate label
|-
| 35 || Subprogram not defined
|-
| 37 || Argument-count mismatch
|-
| 38 || Array not defined
|-
| 40 || Variable required
|-
| 56 || FIELD statement active
|-
| 57 || Device I/O error
|-
| 58 || File already exists
|-
| 61 || Disk full
|-
| 67 || Too many files
|-
| 69 || Communication-buffer overflow
|-
| 71 || Disk not ready
|-
| 72 || Disk-media error
|-
| 73 || Feature unavailable
|-
| 74 || Rename across disks
|}
==Custom errors==
Any code not listed above may be used as a custom error code with [[ERROR]] to signal other errors in your application. To avoid confusion, it is a good idea to start at error code 100 and go up from there.
==Other Errors==
*Syntax errors: QB64 will display most statement syntax and parameter errors in the Status area below the editing area in the IDE. It may also show missing brackets or other syntax punctuation required. Check the keyword's syntax when necessary.
*Memory errors: Loading many resources with a function like [[_LOADIMAGE]] and not freeing (e.g. [[_FREEIMAGE]]) can cause out of memory conditions, especially when executed in a loop.
*CPU consumption: Loops will tend to use 100% of a processor by default. Consider using [[_LIMIT]] to restrict CPU usage.
==See also==
*[[ERROR]] (simulates error), [[ERR]] (error code number), [[ERL]] (closest line number when line numbers are used)
*[[ON ERROR]] (calls error handing routine using [[GOTO]] only), [[_ERRORLINE]] (actual text code line)
*[[_INCLERRORLINE]], [[_INCLERRORFILE$]], [[_ERRORMESSAGE$]]
{{PageNavigation}}

View file

@ -1,37 +0,0 @@
'''This page is maintained for historic purposes. The keyword is [[Keywords currently not supported by QB64|not supported in QB64]].'''
----
The [[FILEATTR]] function returns a file's current file mode or DOS handle.
{{PageSyntax}}
: {{Parameter|result%}} = [[FILEATTR]]({{Parameter|fileNumber%}}, {{Parameter|mode%}})
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* {{Parameter|fileNumber%}} is the number assigned in the file's [[OPEN]] statement.
* {{Parameter|mode%}} specifies the type of information to return, which may have the following values
** {{Parameter|mode%}} = 1: returns the open mode with the following return values:
::{| border="2" cellpadding="1"
! Return || Open Mode
|-
|  1 ||  [[INPUT]]
|-
|  2 ||  [[OUTPUT]]
|-
|  4 ||  [[RANDOM]]
|-
|  8 ||  [[APPEND]]
|-
|  32 ||  [[BINARY]]
|}
** {{Parameter|mode%}} = 2: returns the [[DOS]] handle number of a file.
{{PageSeeAlso}}
* [[OPEN]]
{{PageNavigation}}

View file

@ -1,32 +0,0 @@
'''This page is maintained for historic purposes. The keyword is [[Keywords currently not supported by QB64|not supported in QB64]].'''
----
The [[FRE]] function returns the amount of memory available in bytes to running programs.
{{PageSyntax}}
: {{Parameter|memory}} = [[FRE]]({{Parameter|stringExpression$}})
: {{Parameter|memory}} = [[FRE]]({{Parameter|numericalExpression}})
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* Any {{Parameter|stringExpression$}} returns the size, in bytes, of free string storage space.
** Also compacts the free string storage to a single block of memory.
* {{Parameter|numericalExpression}} can be:
** 0: returns the same value as using a string expression above.
** -1: returns the size of the largest non-string array in bytes that could be dimensioned.
** -2: returns the amount of stack space, in bytes, available to a running program.
** Any other numerical value returns the size of the next block of string memory storage space.
{{PageExamples}}
{{CodeStart}} '' ''
' {{Cl|$DYNAMIC}}
PRINT "Sizes in bytes before dimensioning arrays: "; {{Cl|FRE}}(""), {{Cl|FRE}}(0), {{Cl|FRE}}(-1), {{Cl|FRE}}(-2)
{{Cl|DIM}} Array(100, 100), Text$(5000)
PRINT "Sizes in bytes after dimensioning arrays: "; {{Cl|FRE}}(""), {{Cl|FRE}}(0), {{Cl|FRE}}(-1), {{Cl|FRE}} (-2) '' ''
{{CodeEnd}}
''Notes:'' Sizes returned may vary by computer used. FRE(-2) must be used in a running program.
{{PageNavigation}}

View file

@ -1,66 +0,0 @@
[[LONG]] [[HEX$|Hexadecimal]] values can be used to set a [[_PALETTECOLOR]] instead of using [[_RGB32]] or [[_RGBA32]] values.
* Hexadecimal digits can be represented as any number or letter up to F: '''0 1 2 3 4 5 6 7 8 9 A B C D E F'''
* [[_BYTE|Byte]] values up to 255 can represented by two hexadecimal digits such as 1C, 23, FA, etc.
* The [[HEX$|hex]] value for bright white(attribute 15) is &HFFFFFFFF or:
::: [[_ALPHA|Alpha]] = FF (255), Red = FF (255), Green = FF (255), Blue = FF (255)
* [[_RGB]] will return an alpha value of 255 for fully opaque 32 bit colors only. Values range from &HFF000000 to &HFFFFFFFF.
* [[_RGB32]] will return an alpha value of 255 for fully opaque colors only. Values range from &HFF000000 to &HFFFFFFFF.
* [[_RGBA]] can set the transparency so hexadecimal values range from &H000000 (zero alpha) to &HFFFFFFFF (full alpha).
* [[_RGBA32]] can set the transparency so hexadecimal values range from &H000000 (zero alpha) to &HFFFFFFFF (full alpha).
* So expanding on the principle above allows us to easily make up our own hex color values:
:: _PALETTECOLOR 1, '''&HFFFF0000''' 'COLOR 1 is full red
:: _PALETTECOLOR 2, '''&HFFFF00FF''' 'COLOR 2 is purple
:: _PALETTECOLOR 3, '''&HFFFFFF00''' 'COLOR 3 is brown
:Where '''FF''' is the fully opaque [[_ALPHA]] and the 3 hex color values can range from '''00''' to '''FF''' (0 to 255) each.
''Example:'' Converting the color port RGB intensity palette values 0 to 63 to 32 bit hexadecimal [[STRING|string]] values.
{{CodeStart}}
{{Cl|SCREEN}} 12
{{Cl|DIM}} hex32$(15)
alpha$ = "FF" 'solid alpha colors only
{{Cl|OUT}} {{Cl|&H}}3C8, 0: {{Cl|OUT}} {{Cl|&H}}3C9, 0: {{Cl|OUT}} {{Cl|&H}}3C9, 0: {{Cl|OUT}} {{Cl|&H}}3C9, 20 'set black background to dark blue
{{Cl|FOR...NEXT|FOR}} attribute = 0 {{Cl|TO}} 15
{{Cl|OUT}} {{Cl|&H}}3C7, attribute 'set color attribute to read
red$ = {{Cl|HEX$}}({{Cl|INP}}({{Cl|&H}}3C9) * 4) 'convert port setting to 32 bit values
grn$ = {{Cl|HEX$}}({{Cl|INP}}({{Cl|&H}}3C9) * 4)
blu$ = {{Cl|HEX$}}({{Cl|INP}}({{Cl|&H}}3C9) * 4)
{{Cl|IF...THEN|IF}} {{Cl|LEN}}(red$) = 1 {{Cl|THEN}} red$ = "0" + red$ 'necessary for low or zero color intensities
{{Cl|IF...THEN|IF}} {{Cl|LEN}}(grn$) = 1 {{Cl|THEN}} grn$ = "0" + grn$
{{Cl|IF...THEN|IF}} {{Cl|LEN}}(blu$) = 1 {{Cl|THEN}} blu$ = "0" + blu$
hex32$(attribute) = "{{Cl|&H}}" + alpha$ + red$ + grn$ + blu$
{{Cl|NEXT}}
{{Cl|PRINT}} "COLOR 0 = " + hex32$(0)
{{Cl|FOR...NEXT|FOR}} i = 1 {{Cl|TO}} 15
{{Cl|_PALETTECOLOR}} i, {{Cl|VAL}}(hex32$(i))
{{Cl|COLOR}} i
{{Cl|PRINT}} "COLOR" + {{Cl|STR$}}(i) + " = " + hex32$(i) 'returns closest attribute
{{Cl|NEXT}} '' ''
{{CodeEnd}}{{small|Code by Ted Weissgerber}}
:''Explanation:'' [[VAL]] is used to convert the [[HEX$|hexadecimal]] [[STRING|string]] values to valid 32 bit color values for [[_PALETTECOLOR]].
:: No VAL conversion is necessary if the [[LONG]] [[&H]] hexadecimal values are entered into the program directly by the programmer.
''See also:''
* [[_PALETTECOLOR]]
* [[_RGB32]], [[_RGBA32]]
* [[_RGB]], [[_RGBA]] {{text|(when used in 32 bit only)}}
* [[COLOR]], [[SCREEN]], [[POINT]]
* [http://www.w3schools.com/html/html_colornames.asp HTML Color Table HEX Values and Names]
{{PageNavigation}}

View file

@ -1,68 +0,0 @@
'''INPUT''' reads a formatted message from a TCP/IP connection opened using [[_OPENHOST]], [[_OPENCLIENT]] or [[_OPENCONNECTION]].
{{PageSyntax}}
: '''INPUT''' #{{Parameter|connectionHandle}}, data1[, data2, ...etc]
{{PageDescription}}
* Use '''INPUT #''' to avoid reading fragmented data messages.
* If any part of the '''INPUT #''' process doesn't complete, then [[EOF]]({{Parameter|connectionHandle}}) will return -1.
* INPUT # can read multiple data in one read. '''GET #''' would need a [[TYPE]] variable to read multiple values.
==Availability==
* '''Version 0.954 and older'''.
** For version 1.000 and up use [[GET (TCP/IP statement)]]
==Communicating using QB64's formatted messages==
* Benefit: QB64 handles sending and receiving data in messages. It knows how long each message is and waits for the full message to arrive, avoiding partial messages which have been fragmented from being returned.
* Disadvantage: Really only useful for communicating with other QB64 programs (or other programs aware of QB64's header format).
{{PageExamples}}
'''Note:''' In the following examples 'h' denotes the host's handle, 'c' the client's handle and 'o' as other handle.
''Example 1:'' Host sends 2 messages to client and reads data from others.
{{CodeStart}} '' ''
{{Cl|PRINT (TCP/IP statement)|PRINT}} #c, a$ ' sends the string value a$ (size is calculated by an INPUT)
PRINT #c, x% ' if x was equal to 5, this would send " 5 " (without the quotation marks)
'''INPUT #'''o, a$ ' reads the next available message (if arrived) or sets a$'s length to 0 '' ''
{{CodeEnd}}
:''Explanation:'' INPUT #o,x% 'effectively reads the next message, performs the VAL function upon it and stores the result in x%. If any part of this process doesn't work then EOF(o) will return -1.
* INPUT of multiple QB64 formatted messages in the one statement will only succeed if every variable can be filled with valid data from the input buffer, if not, EOF returns -1 (failed), any read data is reverted to the buffer and the values of every variable become undefined. However, multiple INPUT can be very beneficial in the aid of communicating multiple data items in the one message. For example:
''Example 2:'' Note how variables need not be sent together.
{{CodeStart}} '' ''
{{Cl|PRINT (TCP/IP statement)|PRINT}} #myclient, a%
PRINT #myclient, b#, c$ '' ''
{{CodeEnd}}
''Example 3:'' Using multiple INPUT variables in the same command.
{{CodeStart}} '' ''
t! = TIMER + 3 'wait 3 seconds
DO
'''INPUT #'''myhost, aa%, bb#, cc$ 'when all variables are filled, EOF(myhost) returns 0
IF TIMER > t! THEN EXIT DO ' 3 second timeout
LOOP WHILE {{Cl|EOF}}(myhost) '' ''
{{CodeEnd}}
:''Explanation:'' Note that communications must be set up in advance for the host and user to know that more than one piece of data is available! Data timing also may affect those communications. Data could be missed using [[GET (TCP/IP statement)]] or [[PUT (TCP/IP statement)]]s as data lengths are unknown.
===More examples===
* See the example in [[_OPENCONNECTION]].
{{PageSeeAlso}}
* [[PRINT (TCP/IP statement)]], [[GET (TCP/IP statement)]], [[PUT (TCP/IP statement)]]
* [[_OPENHOST]], [[_OPENCLIENT]], [[_OPENCONNECTION]], [[INPUT (file statement)]]
* [[TCP/IP Message Format]]
{{PageNavigation}}

View file

@ -1,21 +0,0 @@
'''This page is maintained for historic purposes. The keyword is [[Keywords currently not supported by QB64|not supported in QB64]].'''
----
The [[IOCTL$]] function receives messages from an open device, format of the messages received is device dependent (see manual of the device to see if it is [[IOCTL]] compatible). Most devices are '''not''' [[IOCTL]] compatible.
{{PageSyntax}}
:{{Parameter|result$}} = [[IOCTL$]]([#]{{Parameter|fileNumber%}})
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* {{Parameter|fileNumber%}} is the file number for the [[OPEN]]ed device and {{Parameter|result$}} is the message received from the device.
*'''Note:''' The device must first be opened with the [[OPEN]] statement.
{{PageSeeAlso}}
* [[IOCTL]]
* [[OPEN]]
{{PageNavigation}}

View file

@ -1,26 +0,0 @@
'''This page is maintained for historic purposes. The keyword is [[Keywords currently not supported by QB64|not supported in QB64]].'''
----
The [[IOCTL]] statement sends a message to an open IOCTL compatible device.
{{PageSyntax}}
:[[IOCTL]] [#]{{Parameter|fileNumber%}}, {{Parameter|message$}}
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* {{Parameter|fileNumber%}} is the number of an open device
* {{Parameter|message$}} is the message you want to send.
* The device must first be opened with the {{KW|OPEN}} statement.
* Use [[IOCTL]] to receive messages from the device.
* The message sent is device-specific (read manual to see if it is [[IOCTL]] compatible).
* [[IOCTL]] doesn't work with most devices, it doesn't work with BASIC devices (LPTn:, COMn:, SCRN:, CONS:) or DOS block devices (A: to Z:).
{{PageSeeAlso}}
* [[IOCTL$]]
* [[OPEN]]
{{PageNavigation}}

View file

@ -1,267 +0,0 @@
<center>'''Icons''' and '''Cursors''' are image files with ICO or CUR filename extensions.</center>
{| align="right"
| __TOC__
|}
* Both can use 1 BPP(B & W), 4 BPP(16), 8 BPP(256) or 24/32 BPP(16 million) colors.
* They are formatted similar to bitmaps, but each file can hold more than one image.
* Images can be different sizes and use different color palettes. The image width and depth are usually the same and multiples of 16 up to 128. Use [[_UNSIGNED]] [[_BYTE]] values in the Entry header.
* Normal Icon and Cursor sizes are multiples of 16 such as 16 X 16, 32 X 32, 48 X 48 and 64 X 64.
* Each image has an XOR and an AND image mask to allow background transparency in the white pixel areas. Change background areas to white in the [[AND]] mask for irregular shapes.
* The [[XOR]] mask is normally different colors while the [[AND]] mask is 1 BPP where black is translucent(solid) and white transparent.
* The AND image mask is placed on a background using a process like [[PUT (graphics statement)|PUT]] with the AND action by the Operating System.
* Then the [[XOR]] mask is placed on top of the blackened areas to display the image colors.
* The resulting image can allow any background to be seen through the [[AND]] mask parts of the image that are white.
==Icon Headers==
{{TextStart}}
' ******************* ICONCUR.BI
' INCLUDE this BI file at the start of a program
'
{{Cb|TYPE}} ICONTYPE 'Icon or cursor file header
Reserved {{Cb|AS}} {{Cb|INTEGER}} 'Reserved (always 0)
ID {{Cb|AS}} {{Cb|INTEGER}} 'Resource ID (Icon = 1, Cursor = 2)
Count {{Cb|AS}} {{Cb|INTEGER}} 'Number of icon bitmaps in Directory of icon entries array
{{Cb|END}} {{Cb|TYPE}} '6 bytes
{{Cb|TYPE}} ICONENTRY 'or unanimated Cursor entry (ANI are animated cursors)
PWidth {{Cb|AS}} {{Cb|_UNSIGNED}} {{Cb|_BYTE}} 'Width of icon in pixels (USE THIS)
PDepth {{Cb|AS}} {{Cb|_UNSIGNED}} {{Cb|_BYTE}} 'Height of icon in pixels (USE THIS)
NumColors {{Cb|AS}} {{Cb|_BYTE}} 'Maximum number of colors. (2, 8 or 16 colors. 256 or 24/32 bit = 0)
RES2 {{Cb|AS}} {{Cb|_BYTE}} 'Reserved. Not used (always 0)
HotSpotX {{Cb|AS}} {{Cb|INTEGER}} 'Icon: NumberPlanes(normally 0), Cursor: hotspot pixels from left
HotSpotY {{Cb|AS}} {{Cb|INTEGER}} 'Icon: BitsPerPixel(normally 0), Cursor: hotspot pixels from top
DataSize {{Cb|AS}} {{Cb|LONG}} 'Length of image data in bytes minus Icon and Entry headers (USE THIS)
DataOffset {{Cb|AS}} {{Cb|LONG}} 'Start Offset byte position of icon bitmap header(add 1 if [[TYPE]] GET)
{{Cb|END}} {{Cb|TYPE}} '16 bytes ''' 'BMP header and image data follow ALL entry data(after 22, 38, 54, etc.)'''
{{Cb|TYPE}} BMPHEADER 'Bitmap type header found using entry DataOffset + 1
IconHSize {{Cb|AS}} {{Cb|LONG}} 'size of ICON header (always 40 bytes)
ICONWidth {{Cb|AS}} {{Cb|LONG}} 'bitmap width in pixels (signed integer).
ICONDepth {{Cb|AS}} {{Cb|LONG}} 'Total map height in pixels (signed integer is 2 times image height)
NumPlanes {{Cb|AS}} {{Cb|INTEGER}} 'number of color planes. Must be set to 1.
BPP {{Cb|AS}} {{Cb|INTEGER}} 'bits per pixel 1, 4, 8, 16, 24 or 32.(USE THIS)
Compress {{Cb|AS}} {{Cb|LONG}} 'compression method should always be 0.
RAWSize {{Cb|AS}} {{Cb|LONG}} 'size of the raw ICON image data(may only be {{Cb|XOR}} mask size).
Hres {{Cb|AS}} {{Cb|LONG}} 'horizontal resolution of the image(not normally used)
Vres {{Cb|AS}} {{Cb|LONG}} 'vertical resolution of the image(not normally used)
NumColors {{Cb|AS}} {{Cb|LONG}} 'number of colors in the color palette(not normally used)
SigColors {{Cb|AS}} {{Cb|LONG}} 'number of important colors used(not normally used)
{{Cb|END}} {{Cb|TYPE}} '40 bytes ''' 'palette and/or image data immediately follow this header! '''
{{TextEnd}}
{{CodeStart}} '' ''
{{Cl|DIM}} ICO {{Cl|AS}} ICONTYPE
items% = ICO.Count
{{Cl|DIM}} {{Cl|SHARED}} Entry(items%) {{Cl|AS}} ICONENTRY
{{Cl|DIM}} {{Cl|SHARED}} BMP(items%) {{Cl|AS}} BMPHEADER '' ''
{{CodeEnd}}
<center>'''ICON File Header Information'''</center>
::* The Icon header is only six bytes. The first [[INTEGER]] value is reserved and is always 0.
::* The second [[INTEGER]] indicates the type of file:
:::* 1 indicates that the file is an ICO Icon file which may hold more than one image.
:::* 2 indicates that the file is a CUR Cursor file which may hold more than one image.
::* The third [[INTEGER]] value indicates the number of images contained in the file. This will also tell you the number of Icon Entry information headers follow. A [[TYPE]] array can be used to reference the entry and BMP header information later when there is more than one image. The start of all bitmap header and image data information is after 6 + (count * 16) bytes.
<center>'''ICON Entry Information'''</center>
: The Entry header information for all icon images contained in the icon file follow the icon header. No image data will be found until after all of the Entry information. Each entry contains the dimensions, size of data and the location of the start of image data.
::* The image width and height are [[_BYTE]] numerical values or [[ASC]] [[ASCII]] code [[STRING]] values.
::* The number of colors is a [[_BYTE]] value which may be zero. Use the Bitmap header's BPP value instead.
::* The reserved [[_BYTE]] value is always zero.
::* The 2 Hotspot [[INTEGER]] values are always 0 unless the file is a CUR cursor file. Cursor files position the click spot.
::* The [[LONG]] Data Size value should indicate the size of the image data including bitmap header, palette and pixel data.
::* The [[LONG]] Data Offset value will indicate the byte position of the image bitmap header. Add one byte in QB and QB64.
<center>'''Bitmap Header Information'''</center>
: The Bitmap header information is located one byte after the Data Offset position because QBasic sets the first byte of a file as 1 instead of zero. This bitmap image information is identical to a bitmap image header's last 40 bytes, but the height is doubled.
::* The [[LONG]] header size is always 40 bytes. This can be used to verify the start position of the header.
::* The [[LONG]] image width should be the same as the Entry header width.
::* The [[LONG]] image height should be '''2 times''' the actual image height as read in the Entry header.
::* The number of planes [[INTEGER]] value should always be 1.
::* The BPP [[INTEGER]] value is always used to find the number of colors, palette size(if any) and pixel byte size.
:::* 1 indicates a black and white(2 ^ 1) color, one bit(on or off) per pixel image with no palette. Each bit on is white.
:::* 4 indicates a 16(2 ^ 4) color, 4 bits(attributes 0 to 15) per pixel image with a 64 byte palette.
:::* 8 indicates a 256(2 ^ 8) color, one byte(attributes 0 to 255) per pixel image with a 1024 byte palette.
:::* 24 or 32 indicates a 16 million(2 ^ 24) color, 3 bytes(BGR intensities 0 to 255) per pixel image with no palette.
::* The [[LONG]] compression value should always be zero.
::* The [[LONG]] Raw data size should indicate the image data size, but it is unreliable. Calculate it when necessary.
::* The four remaining [[LONG]] bitmap header values can be ignored as they will normally be zero.
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==XOR Image Data==
{{WhiteStart}}
'''Single Image Icon or Cursor'''
┌──────┐ ┌─────┐ ┌──────┐ ┌───────┐ ┌───────┐ ┌───────┐
│ ICON │ │Entry│ │BMP[1]│ │PALETTE│ │ XOR │ │ AND │
│Header├─6─┤ [1] ├─22─┤Header├─62─┤ 4 BPP ├─126─┤ 4 BPP ├─638─┤ 1 BPP │
│ 6B │ │16 B │ │ 40 B │ │½ byte │ │32*32*½│ │32*32\8│
└──────┘ └─────┘ └──────┘ │ 64 B │ │ 512 B │ │ 128 B │
└───────┘ └───────┘ └───────┘
'''Multiple Image (3)'''
┌──────┐ ┌───────┐ ┌───────┐ ┌───────┐
│ ICON │ │ Entry │ │ Entry │ │ Entry │
│Header├─6─┤ [1] ├─22─┤ [2] ├─38─┤ [3] ├─54─┐ Entry precedes all data
│ 6B │ │ 16 B │ │ 16 B │ │ 16 B │ │
└──────┘ └───────┘ └───────┘ └───────┘ │
┌───◄ GET Offset + 1 = 55◄─────────┘
┌───┴───┐ ┌───────┐ ┌───────┐
│ BMP[1]│ │ BMP[2]│ │ BMP[3]│
│Header │ ┌─┤Header │ ┌─┤Header │ Image settings
│ 40 B │ │ │ 40 B │ │ │ 40 B │
└───┬───┘ │ └───┬───┘ │ └───┬───┘
┌───┴───┐ ▲ ┌───┴───┐ ▲ │
│PALETTE│ O │PALETTE│ O │
│ 4 BPP │ f │ 8 BPP │ f 24 BPP RGB color intensities
│½ byte │ f │1 byte │ f 3 byte
│ 64 B │ s │1024 B │ s │
└───┬───┘ e └───┬───┘ e │
┌───┴───┐ t ┌───┴───┐ t ┌───┴───┐
│ XOR │ + │ XOR │ + │ XOR │
│16*16*½│ 1 │32*32*1│ 1 │48*48*3│ Image color data
│ 128 B │ ▲ │1024 B │ ▲ │6912 B │
└───┬───┘ │ └───┬───┘ │ └───┬───┘
┌────┴───┐ │ ┌───┴───┐ │ ┌───┴────┐
│ AND │ │ │ AND │ │ │ AND │
│ 1 BPP ├──┘ │ 1 BPP ├──┘ │ 1 BPP │ B & W mask
│16*(2+2)│ │32*32\8│ │48*(6+2)│
│ 64 B │ │ 128 B │ │ 384 B │
└────────┘ └───────┘ └────────┘
Add one to Offset position when using one TYPE definition GET for the BMP Header data!
BPP = bits per pixel B = bytes +2 = padder bytes
{{WhiteEnd}}
<center>'''Palette Data'''</center>
:The Palette is only used in '''4 BPP''' and '''8 BPP''' Icons or Cursors. It is exactly the same format as a bitmap. The number of available colors determines the size of palette data. The data is read as blue, green, red [[_BYTE|byte]]s with a zero([[CHR$]](0)) spacer so the palette size is 4 times the number of available colors: 4 BPP = 4 * (2 ^ 4) = 64 bytes and 8 BPP = 4 * (2 ^ 8) = 1024 bytes.
: The palette sets the Blue, Green and Red color intensities before each color attribute value is read in the image's pixel data.
<center>'''XOR Mask Image Data'''</center>
:The [[XOR]] mask is found after the Palette in 4 BPP or 8 BPP or immediately after the icon BMP Header if 1 BPP or 24 BPP colors. The XOR data is also read the same as a bitmap. The BPP determines the size of the data as bits per pixel:
:::* 1 BPP is one bit per pixel (on white or off black) or bytes = (width * height) / 8 bits
:::* 4 BPP is four bits per pixel attribute or bytes = (4 * width * height) / 8 bits
:::* 8 BPP is one byte per pixel attribute or bytes = (8 * width * height) /8 bits
:::* 24 BPP is 3 bytes per pixel (blue, green, red) or bytes = (24 * width * height) / 8 bits
: All color settings use 4 byte padding to prevent image skewing although most icons use multiples of 8 pixels and won't need it.
: The color intensity of each 24 bit pixel is read as blue, green and red bytes. See the [[Bitmaps]] page for more information.
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==AND Mask Data==
:The AND mask is read as a '''one BPP''' black and white image with each [[_BIT]] being on(white) or off(black). It is white where the background may show and black where the colors (including black) from the XOR mask will show. It is placed using the AND action by Windows first. Then the XOR mask is placed on top using an XOR action. The following SUB procedure can adapt to 24 bit colors so that colors will not be affected. Make sure that the BPP value is [[SHARED]] or pass it using a parameter!
: A [[CHR$|zero]] byte or [[SPACE$|space]] padder is used in the AND mask for image widths that are not multiples of 4 bytes(32 pixels).
{{CodeStart}} '' ''
{{Cl|SUB}} ANDMask 'MASK is B & W. Black area holds {{Cl|XOR}} colors, white displays background
BitsOver = Entry(i).PWidth& {{Cl|MOD}} 32
{{Cl|IF}} BitsOver {{Cl|THEN}} ZeroPAD$ = {{Cl|SPACE$}}((32 - BitsOver) \ 8) 'look for sizes not multiples of 32 bits
{{Cl|_DEST}} bmp& 'destination handle if used
y = Entry(i).PDepth - 1: a$ = " ": p$ = " "
{{Cl|DO}}
x = 0
{{Cl|DO}}
{{Cl|GET}} #1, , a$ 'position is immediately AFTER XOR mask data
ByteVAL = {{Cl|ASC}}(a$) 'MSBit is left when calculating 16 X 16 cursor map 2 byte integer
{{Cl|FOR...NEXT|FOR}} Bit% = 7 {{Cl|TO}} 0 {{Cl|STEP}} -1 'values despite M$ documentation that says otherwise!
{{Cl|IF}} ByteVAL {{Cl|AND}} 2 ^ Bit% {{Cl|THEN}}
{{Cl|PSET}} (x, y), {{Cl|_RGB}}(255, 255, 255) '_RGB can be used in 1, 4, 8 or 24/32 BPP
{{Cl|ELSE}}: {{Cl|PSET}} (x, y), {{Cl|_RGB}}(0, 0, 0)
{{Cl|END IF}}
x = x + 1 '16 X 16 = 32 bytes, 32 X 32 = 128 bytes AND MASK SIZES
{{Cl|NEXT}} Bit% '48 X 48 = 288 bytes, 64 X 64 = 512 bytes, 128 X 128 = 2048 bytes
{{Cl|LOOP}} {{Cl|WHILE}} x < Entry(i).PWidth
{{Cl|GET}} #1, , ZeroPAD$ '16 X 16 and 48 X 48 = 2 byte end padder per row in the AND MASK
y = y - 1 'adds 32 and 96 bytes respectively to the raw data size!
{{Cl|LOOP}} {{Cl|UNTIL}} y = -1
{{Cl|END}} {{Cl|SUB}} '' ''
{{CodeEnd}}
: ''Note:'' Icon widths that are not multiples of 32, such as 16 or 48, are padded 2 extra zero bytes to bring them to specifications.
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==Calculating Data Size==
: The size of the data is based on the pixel size of the image, any bit padding and the BPP palette intensity data required.
{{CodeStart}} '' ''
Entry(item%).DataSize = DataSize&(item%) 'example function call
{{Cl|FUNCTION}} DataSize&(i AS INTEGER)
PixelBytes! = BMP(i)BPP / 8 '1 BPP = 1/8; 4 BPP = 1/2; 8 BPP = 1; 24 BPP = 3
{{Cl|SELECT CASE}} BPP
{{Cl|CASE}} 1: PaletteBytes% = 0
{{Cl|IF}} Entry(i).PWidth {{Cl|MOD}} 32 {{Cl|THEN}} Pad% = (32 - (Entry(i).PWidth {{Cl|MOD}} 32)) \ 8 {{Cl|ELSE}} Pad% = 0
{{Cl|CASE}} 4: PaletteBytes% = 64
{{Cl|IF}} Entry(i).PWidth {{Cl|MOD}} 8 {{Cl|THEN}} Pad% = (8 - (Entry(i).PWidth {{Cl|MOD}} 8)) \ 2 {{Cl|ELSE}} Pad% = 0
{{Cl|CASE}} 8: PaletteBytes% = 1024
{{Cl|IF}} Entry(i).PWidth {{Cl|MOD}} 4 {{Cl|THEN}} Pad% = 4 - (Entry(i).PWidth {{Cl|MOD}} 4) {{Cl|ELSE}} Pad% = 0
{{Cl|CASE}} {{Cl|IS}} > 8: PaletteBytes% = 0
{{Cl|IF}} ((Picture{{Cl|Entry(i).PWidth * 3) {{Cl|MOD}} 4) {{Cl|THEN}}
Pad% = ((4 - ((Entry(i).PWidth * 3) {{Cl|MOD}} 4)))
{{Cl|ELSE}}: Pad% = 0
{{Cl|END IF}}
{{Cl|END SELECT}}
XORsize& = ((Entry(i).PWidth + Pad%) * Entry(i).PDepth) * PixelBytes!
{{Cl|IF}} Entry(i).PWidth {{Cl|MOD}} 32 {{Cl|THEN}} ANDpad% = (32 - (Entry(i).PWidth {{Cl|MOD}} 32)) {{Cl|ELSE}} ANDpad% = 0
ANDsize& = ((Entry(i).PWidth + ANDpad%) * Entry(i).PDepth) \ 8
DataSize& = XORsize& + ANDsize& + PaletteBytes% + 40 'header is always 40 bytes
{{Cl|END FUNCTION}} '' ''
{{CodeEnd}}
: ''NOTE:'' A 2 byte padder adds 32 bytes to 16 X 16 and 96 bytes to 48 X 48 AND mask data. 32 and 64 wide have no padders.
''Snippet:'' Shows how bit padder is calculated and used to calculate the AND mask data size:
{{TextStart}} '' ''
{{Cb|INPUT}} "Enter an icon width(multiples of 8 or 16 only): ", width
{{Cb|IF...THEN|IF}} (width {{Cb|MOD}} 32) {{Cb|THEN}} bitpad = (32 - (width {{Cb|MOD}} 32))
bytes = (width + bitpad) * width \ 8 'dividing by 8 returns the byte size
{{Cb|PRINT}} "AND mask size:"; bytes; "bytes with a"; bitpad; "bit padder." '' ''
{{TextEnd}}
{{OutputStart}}Enter an icon width(multiples of 8 or 16 only): 16
AND mask size: 64 bytes with a 16 bit padder.
{{OutputEnd}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==References==
''Member Examples:''
* [[Creating Icon Bitmaps]]
* [[Creating Icons from Bitmaps]]
* [[SaveIcon32]] {{text|(create icons from any image)}}
''See Also:''
* [[$EXEICON]]
* [[_ICON]]
* [[Creating Sprite Masks]]
* [[Bitmaps]], [[GIF Images]]
* [[Resource_Table_extraction#Extract_Icon|Icon Extraction]]
{{PageNavigation}}

View file

@ -1,325 +0,0 @@
* '''Keyboards with Alt Gr key:''' [[_KEYHIT]] may return both Alt(100307) and Ctrl(100306) codes when that key is pressed or released.
* '''Linux with foreign keyboards:''' [[SHELL]] [[_HIDE]] "setxkbmap us" will setup a keyboard to read US [[Scancodes]].
==INKEY$ Codes==
* [[INKEY$]] returns a [[STRING]] [[ASCII]] character or a function key two byte string. [[ASC]] converts to code. Use: '''{{text|key$ <nowiki>=</nowiki> INKEY$|green}}'''
* Key presses are read consecutively from the keyboard buffer which will retain a [[SLEEP]] key press.
{{WhiteStart}}' '''ASCII Keyboard Codes'''
'
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Sys ScL Pause'''
' 27 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +133 +134 - - -
'''' `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSp Ins Hme PUp NumL / * -'''
' 126 33 64 35 36 37 94 38 42 40 41 95 43 8 +82 +71 +73 - 47 42 45
''' 96 49 50 51 52 53 54 55 56 57 48 45 61''
'''' Tab Q W E R T Y U I O P [{ ]} \| Del End PDn 7Hme 8/▲ 9PU + '''
' 9 81 87 69 82 84 89 85 73 79 80 123 125 124 +83 +79 +81 +71 +72 +73 43
''' 113 119 101 114 116 121 117 105 111 112 91 93 92 55 56 57 ''
'''' CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-►
' - 65 83 68 70 71 72 74 75 76 58 34 13 +75 +76 +77 '''E'''
''' 97 115 100 102 103 104 106 107 108 59 39 52 53 54 '' '''n'''
'''' Shift Z X C V B N M ,< .> /? Shift ▲ 1End 2/▼ 3PD t'''
' * 90 88 67 86 66 78 77 60 62 63 * +72 +79 +80 +81 '''e'''
''' 122 120 99 118 98 110 109 44 46 47 49 50 51 '' '''r'''
'''' Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0Ins .Del '''
' * - * 32 * - - * +75 +80 +77 +82 +83 13
' '' 48 46''
'
' ''' ''Italics'' = LCase/NumLock On [[INKEY$#Two_Byte_Combinations|* = 2 byte combo only]], + = 2 Byte: CHR$(0) + CHR$(code)'''
'
{{WhiteEnd}}
<center>GO TO: [[Keyboard_scancodes#INP_Scan_Codes|Scan Codes]],
[[Keyboard_scancodes#ON_KEY_Events|ON KEY]], [[Keyboard_scancodes#KEYHIT_and_KEYDOWN_Codes|_KEYHIT]], [[Keyboard_scancodes#DEVICES_Button|_DEVICES]], [[Keyboard_scancodes#Windows_Virtual_Codes|Windows Virtual]]</center>
==INP and _CINP Scan Codes==
* [[_CINP]] can be used in [[$CONSOLE]] Windows to read individual key presses.
* [[INP]]([[&H]]60) returns multiple [[INTEGER]] press and release codes as keys are used. Use: '''{{text|code% <nowiki>=</nowiki> INP(96)|green}}'''
* To clear the keyboard buffer, use the [[INKEY$]] function before or after the [[INP]] read to avoid buffer overflows and beeps.
* Keys are assigned only one code irregardless of case or Lock mode with release codes being the press code + 128.
{{WhiteStart}}' '''Extended Keyboard Press Scancodes'''
'
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause'''
' 1 59 60 61 62 63 64 65 66 67 68 87 88 0 70 29
' '''`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * -'''
' 41 2 3 4 5 6 7 8 9 10 11 12 13 14 82 71 73 69 53 55 74
' '''Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + '''
' 15 16 17 18 19 20 21 22 23 24 25 26 27 43 83 79 81 71 72 73 78
' '''CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-► E'''
' 58 30 31 32 33 34 35 36 37 38 39 40 28 75 76 77 '''n'''
' '''Shift Z X C V B N M ,< .> /? Shift ▲ 1/End 2/▼ 3/PD t'''
' 42 44 45 46 47 48 49 50 51 52 53 54 72 79 80 81 '''e'''
' '''Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r'''
' 29 {{text|91|purple}} 56 57 56 {{text|92 93|purple}} 29 75 80 77 82 83 28
'
' {{text|QB64 codes only!|purple}} '''Release codes = Press code + 128. Pause/Break may lock code returns.'''
'
{{WhiteEnd}}
<center>[http://www.quadibloc.com/comp/scan.htm Keyboard Scan Codes]........... [http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html Other Keyboards]</center>
<center>GO TO:[[Keyboard_scancodes#INKEY.24_Codes|INKEY$]], [[Keyboard_scancodes#ON_KEY_Events|ON KEY]], [[Keyboard_scancodes#KEYHIT_and_KEYDOWN_Codes|_KEYHIT]], [[Keyboard_scancodes#DEVICES_Button|_DEVICES]], [[Keyboard_scancodes#Windows_Virtual_Codes|Windows Virtual]]</center>
==ON KEY Events==
* Assign user defined Soft Key or key combination numbers 15 to 29 with: '''{{text|[[KEY n]]umber, CHR$({{text|keyflag|purple}}) + CHR$(scancode)|green}}'''
* Combo Key flags: {{text|<nowiki>0 = none, LShift = 1, RShift = 2, LCtrl = 4, LAlt = 8, NumLock = 32, CapsLock = 64</nowiki>|purple}}, {{text|Extended keys <nowiki>=</nowiki> 128|blue}}
* {{text|Red|red}} KEY numbers {{text|1 to 14, 30 or 31|red}} assign predefined one key events using: '''[[ON KEY(n)|ON KEY]]({{text|number|red}}) [[GOSUB]] {{text|subname|green}}'''
{{WhiteStart}}' '''Soft Key Scan Code Values'''
'
' {{text|1 2 3 4 5 6 7 8 9 10 30 31 Predefined Keys|red}}
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause'''
' 1 59 60 61 62 63 64 65 66 67 68 87 88 -- 70 29
' '''`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * -'''
' 41 2 3 4 5 6 7 8 9 10 11 12 13 14 {{text|82 71 73|blue}} {{text|32|purple}}/69 {{text|53|blue}} 55 74
' '''Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + '''
' 15 16 17 18 19 20 21 22 23 24 25 26 27 43 {{text|83 79 81|blue}} 71 {{text|11|red}}/72 73 78
' '''CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-► E'''
' {{text|64|purple}}/58 30 31 32 33 34 35 36 37 38 39 40 28 {{text|12|red}}/75 76 {{text|13|red}}/77 '''n'''
' '''Shift Z X C V B N M ,< .> /? Shift ▲ 1/End 2/▼ 3/PD t'''
' {{text|1|purple}}/42 44 45 46 47 48 49 50 51 52 53 {{text|2|purple}}/54 {{text|72|blue}} 79 {{text|14|red}}/80 81 '''e'''
' '''Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r'''
' {{text|4|purple}}/29 {{text|91|orange}} {{text|8|purple}}/56 57 {{text|56|blue}} {{text|92 93|orange}} {{text|29 75 80 77|blue}} 82 83 {{text|28|blue}}
'
' '''Keyflag:''' {{text|Function(0, 1, 2, 4, 8, 32, 64)|purple}}, {{text|Extended(128)|blue}} '''Scan Code: '''1-88, {{text|QB64 only(91-93)|orange}}
'
' Reserved and function key combinations can be made using the scan code instead.
' Add function and/or extended flag values for more key combinations.
{{WhiteEnd}}
<center>GO TO:[[Keyboard_scancodes#INKEY.24_Codes|INKEY$]], [[Keyboard_scancodes#INP_Scan_Codes|Scan Codes]], [[Keyboard_scancodes#KEYHIT_and_KEYDOWN_Codes|_KEYHIT]], [[Keyboard_scancodes#DEVICES_Button|_DEVICES]], [[Keyboard_scancodes#Windows_Virtual_Codes|Windows Virtual]]</center>
==KEYHIT and KEYDOWN Codes==
* [[_KEYHIT]] returns multiple [[LONG]] press and negative release codes as keys are used. Use: '''{{text|code& <nowiki>=</nowiki> _KEYHIT|green}}'''
* [[_KEYDOWN]] returns -1 when a specified key code value is pressed or 0. Use: '''{{text|status% <nowiki>=</nowiki> _KEYDOWN(code&)|green}}'''
* [[_KEYCLEAR]] clears the keyboard buffer memory instantly without a [[LOOP|loop]].
{{WhiteStart}}' '''QB64 _KEYHIT and _KEYDOWN Values'''
'
''''Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Sys ScL Pause'''
' 27 15104 15360 15616 15872 16128 16384 16640 16896 17152 17408 34048 34304 +316 +302 +019
''''`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSp Ins Hme PUp NumL / * -'''
'126 33 64 35 36 37 94 38 42 40 41 95 43 8 20992 18176 18688 +300 47 42 45
''' 96 49 50 51 52 53 54 55 56 57 48 45 61''
''''Tab Q W E R T Y U I O P [{ ]} \| Del End PDn 7Hme 8/▲ 9PU + '''
' 9 81 87 69 82 84 89 85 73 79 80 123 125 124 21248 20224 20736 18176 18432 18688 43
''' 113 119 101 114 116 121 117 105 111 112 91 93 92 55 56 57 ''
''''CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-►
'+301 65 83 68 70 71 72 74 75 76 58 34 13 19200 19456 19712 '''E'''
''' 97 115 100 102 103 104 106 107 108 59 39 52 53 54 '' '''n'''
''''Shift Z X C V B N M ,< .> /? Shift ▲ 1End 2/▼ 3PD t'''
'+304 90 88 67 86 66 78 77 60 62 63 +303 18432 20224 20480 20736 '''e'''
''' 122 120 99 118 98 110 109 44 46 47 49 50 51 '' '''r'''
''''Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0Ins .Del '''
'+306 +311 +308 32 +307 +312 +319 +305 19200 20480 19712 20992 21248 13
' '' 48 46''
' ''' Lower value = LCase/NumLock On __________________ + = add 100000 '''
{{WhiteEnd}}
<center>GO TO: [[Keyboard_scancodes#INKEY.24_Codes|INKEY$]], [[Keyboard_scancodes#INP_Scan_Codes|Scan Codes]], [[Keyboard_scancodes#ON_KEY_Events|ON KEY]], [[Keyboard_scancodes#DEVICES_Button|_DEVICES]], [[Keyboard_scancodes#Windows_Virtual_Codes|Windows Virtual]]</center>
: Most keys use [[ASCII]] key code values. Function key code values can be calculated using the [[INKEY$]], two byte values with [[CVI]].
<center>Example: '''{{text|status <nowiki>=</nowiki> _KEYDOWN(CVI(CHR$(0) + "P"))|green}}'''</center>
<center>[[INKEY$#Two_Byte_Combinations|For Ctrl, Alt, Shift Key Combinations see Two Byte Codes]]</center>
==[[DEVICES]] Button==
* [[_LASTBUTTON]](1) keyboards will normally return 512 buttons. One button is read per loop through all numbers.
* [[_BUTTONCHANGE]](number) returns -1 when pressed, 1 when released and 0 when there is no event since the last read.
* [[_BUTTON]](number) returns -1 when a button is pressed and 0 when released.
{{WhiteStart}}' '''Keyboard Device 1 Button Numbers'''
'
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause'''
' 177 436 433 434 439 440 437 438 395 396 393 394 399 402 392 ---
' '''`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * -'''
' 246 155 156 153 154 159 160 157 158 147 134 135 151 174 447 448 446 386 417 418 423
' '''Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + '''
' 163 219 221 207 220 218 211 223 195 197 198 241 247 242 213 445 435 429 430 419 424
' '''CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-► E'''
' 391 203 217 202 208 205 206 196 193 194 145 141 167 426 431 432 '''n'''
' '''Shift Z X C V B N M ,< .> /? Shift ▲ 1/End 2/▼ 3/PD t'''
' 390 212 222 201 224 204 200 199 130 136 133 389 443 427 428 432 '''e'''
' '''Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r'''
' 412 413 410 182 409 414 405 411 442 444 441 86 420 421
'
' '''Mouse Device 2 buttons: Left = 1, Middle = 2, Right = 3'''
{{WhiteEnd}}
<center>GO TO: [[Keyboard_scancodes#INKEY.24_Codes|INKEY$]], [[Keyboard_scancodes#INP_Scan_Codes|Scan Codes]], [[Keyboard_scancodes#ON_KEY_Events|ON KEY]], [[Keyboard_scancodes#KEYHIT_and_KEYDOWN_Codes|_KEYHIT]],
[[Keyboard_scancodes#Windows_Virtual_Codes|Windows Virtual]]</center>
==Windows Virtual Codes==
* Virtual key code status can be read '''independently of program focus in Windows'''. Not available in Linux or Mac systems.
* Use: '''{{text|status <nowiki>=</nowiki> GetKeyState%(code%)|green}}''' or '''{{text|GetAsyncKeyState%(code&)|green}}''' or with '''{{text|keybd_event|green}}''' in [[Windows_Libraries#Hot_Keys_.28maximize.29|DECLARE LIBRARY]] "User32".
{{WhiteStart}}' '''Virtual KeyState Codes'''
'
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Sys ScL Pause'''
' 27 112 113 114 115 116 117 118 119 120 121 122 123 44 145 19
'''' `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkS Ins Hme PUp NumL / * -'''
' 192 49 50 51 52 53 54 55 56 57 48 189 187 8 45 36 33 144 111 106 109
'''' Tab Q W E R T Y U I O P [{ ]} \| Del End PDn 7Hme 8/▲ 9PU +'''
' 9 81 87 69 82 84 89 85 73 79 80 219 221 120 46 35 34 103 104 105 107
'''' CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-► E'''
' 20 65 83 68 70 71 72 74 75 76 186 222 13 100 101 102 '''n'''
'''' Shift Z X C V B N M ,< .> /? Shift ▲ 1End 2/▼ 3PD t'''
' 16/160 90 88 67 86 66 78 77 188 190 191 16/161 38 97 98 99 '''e'''
'''' Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0Ins .Del r'''
' 17/162 91 18/164 32 18/165 92 93 17/163 37 40 39 96 110 13
'
' Num Lock On values shown. Off values same as functions and arrows, 5 = code 12.
'
' '''Mouse click returns: LB = 1, RB = 2, MB = 4, etc. [http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx Special keys] may also work.'''
{{WhiteEnd}}
<center>GO TO: [[Keyboard_scancodes#INKEY.24_Codes|INKEY$]], [[Keyboard_scancodes#INP_Scan_Codes|Scan Codes]], [[Keyboard_scancodes#ON_KEY_Events|ON KEY]], [[Keyboard_scancodes#KEYHIT_and_KEYDOWN_Codes|_KEYHIT]], [[Keyboard_scancodes#DEVICES_Button|_DEVICES]], </center>
==Example Code==
''Example 1:'' An [[INP]] Function that retrieves multiple scancodes (allows 2 players and diagonal moves). Function includes it's own array.
{{CodeStart}} '' ''
{{Cl|CLS}}
x = 40: px = x
y = 20: py = y
xx = 41: pxx = xx
yy = 21: pyy = yy
{{Cl|DO...LOOP|DO}} ' program or game loop
{{Cl|_LIMIT}} 20 ' Delay .05 'in QBasic
{{Cl|COLOR}} 15
{{Cl|LOCATE}} 8, 14: {{Cl|PRINT}} "W A S D": {{Cl|LOCATE}} 8, 52: {{Cl|PRINT}} "ARROW PAD"
{{Cl|IF...THEN|IF}} ScanKey%(17) {{Cl|THEN}} 'W key
{{Cl|LOCATE}} 2, 15: {{Cl|PRINT}} " UP "
{{Cl|IF...THEN|IF}} y > 1 {{Cl|THEN}} y = y - 1
{{Cl|ELSE}} {{Cl|LOCATE}} 2, 15: {{Cl|PRINT}} "----"
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(31) {{Cl|THEN}} 'S key
{{Cl|LOCATE}} 6, 15: {{Cl|PRINT}} "DOWN"
{{Cl|IF...THEN|IF}} y < 25 {{Cl|THEN}} y = y + 1
{{Cl|ELSE}} {{Cl|LOCATE}} 6, 15: {{Cl|PRINT}} "----"
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(30) {{Cl|THEN}} 'A key
{{Cl|LOCATE}} 4, 12: {{Cl|PRINT}} "LEFT"
{{Cl|IF...THEN|IF}} x > 1 {{Cl|THEN}} x = x - 1
{{Cl|ELSE}} {{Cl|LOCATE}} 4, 12: {{Cl|PRINT}} "----"
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(32) {{Cl|THEN}} 'D key
{{Cl|LOCATE}} 4, 18: {{Cl|PRINT}} "RIGHT"
{{Cl|IF...THEN|IF}} x < 80 {{Cl|THEN}} x = x + 1
{{Cl|ELSE}} {{Cl|LOCATE}} 4, 18: {{Cl|PRINT}} "---- "
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(72) {{Cl|THEN}} 'up arrow
{{Cl|LOCATE}} 2, 55: {{Cl|PRINT}} " UP "
{{Cl|IF...THEN|IF}} yy > 1 {{Cl|THEN}} yy = yy - 1
{{Cl|ELSE}} {{Cl|LOCATE}} 2, 55: {{Cl|PRINT}} "----"
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(80) {{Cl|THEN}} 'down arrow
{{Cl|LOCATE}} 6, 55: {{Cl|PRINT}} "DOWN"
{{Cl|IF...THEN|IF}} yy < 25 {{Cl|THEN}} yy = yy + 1
{{Cl|ELSE}} {{Cl|LOCATE}} 6, 55: {{Cl|PRINT}} "----"
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(75) {{Cl|THEN}} 'left arrow
{{Cl|LOCATE}} 4, 52: {{Cl|PRINT}} "LEFT"
{{Cl|IF...THEN|IF}} xx > 1 {{Cl|THEN}} xx = xx - 1
{{Cl|ELSE}} {{Cl|LOCATE}} 4, 52: {{Cl|PRINT}} "----"
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} ScanKey%(77) {{Cl|THEN}} 'right arrow
{{Cl|LOCATE}} 4, 58: {{Cl|PRINT}} "RIGHT"
{{Cl|IF...THEN|IF}} xx < 80 {{Cl|THEN}} xx = xx + 1
{{Cl|ELSE}} {{Cl|LOCATE}} 4, 58: {{Cl|PRINT}} "---- "
{{Cl|END IF}}
{{Cl|LOCATE}} py, px: {{Cl|PRINT}} {{Cl|SPACE$}}(1); 'erase sprite at previous position
{{Cl|LOCATE}} pyy, pxx: {{Cl|PRINT}} {{Cl|SPACE$}}(1);
{{Cl|COLOR}} 10: {{Cl|LOCATE}} y, x: {{Cl|PRINT}} {{Cl|CHR$}}(1); 'place sprite at new position
{{Cl|COLOR}} 12: {{Cl|LOCATE}} yy, xx: {{Cl|PRINT}} {{Cl|CHR$}}(2);
px = x: py = y: pxx = xx: pyy = yy
{{Cl|LOOP}} {{Cl|UNTIL}} ScanKey%(1)
zerocodes% = ScanKey%(0) 'reset all array values to zero for next part of program
{{Cl|END}}
{{Cl|FUNCTION}} ScanKey% (scancode%)
{{Cl|STATIC}} Ready%, keyflags%() 'retain values on procedure exit
{{Cl|IF...THEN|IF}} {{Cl|NOT}} Ready% {{Cl|THEN}} {{Cl|REDIM}} keyflags%(0 {{Cl|TO}} 127): Ready% = -1 'create array on first use
i% = {{Cl|INP}}({{Cl|&H}}60) 'read keyboard states
{{Cl|IF...THEN|IF}} (i% {{Cl|AND (boolean)|AND}} 128) {{Cl|THEN}} keyflags%(i% {{Cl|XOR (boolean)|XOR}} 128) = 0
{{Cl|IF...THEN|IF}} (i% {{Cl|AND (boolean)|AND}} 128) = 0 {{Cl|THEN}} keyflags%(i%) = -1
K$ = {{Cl|INKEY$}} 'clears the key from buffer to prevent beeps
ScanKey% = keyflags%(scancode%)
{{Cl|IF...THEN|IF}} scancode% = 0 {{Cl|THEN}} Ready% = 0 'a zero scancode value clears all previous key presses with a REDIM
{{Cl|END FUNCTION}}
{{Cl|SUB}} Delay (dlay!) 'optional QBasic delay
start! = {{Cl|TIMER}}
{{Cl|DO...LOOP|DO}} {{Cl|WHILE}} start! + dlay! >= {{Cl|TIMER}}
{{Cl|IF...THEN|IF}} start! > {{Cl|TIMER}} {{Cl|THEN}} start! = start! - 86400
{{Cl|LOOP}}
{{Cl|END SUB}} '' ''
{{CodeEnd}}
{{OutputStart}}
UP UP
---- RIGHT LEFT ----
---- ----
W A S D ARROW PAD
{{text|☺|#00FF00}}
{{text|☻|#FF0000}}
{{OutputEnd}}
{{small|Adapted from Code by Cyperium.}}
:''Explanation:'' Displays multiple arrow key presses to move a game character diagonally or allows 2 players to press keys at once. Each keypress is placed into a [[STATIC]] array inside of the ScanKey function. When a key is pressed, the corresponding code index in the array is changed to -1 or True. When a key is released, the scancode returned is over 128 so AND 128 becomes True and the XOR 128 index value is changed to 0. XOR causes 128 to be subtracted from the release code index value which is then changed to 0 (False) from -1. As the main program loop reads the array each of the IF statements look to see if that code is -1. When a statement is True, it prints the appropriate key(s). The example moves two [[ASCII]] sprites. '''Note:''' [[INKEY$]] can be removed from the function if it is used elsewhere to help clear the key buffer.
<center>'''The Scankey Function array can be cleared by sending 0 as the ''scancode%'' or press the ''Print Scrn/SysReq'' key.'''</center>
''Example 2:'' How to get Control, Alt and shift key entries from a user using [[PEEK]] in QB64 or QBasic:
{{CodeStart}} '' ''
DO
{{Cl|_LIMIT}} 50
{{Cl|DEF SEG}} = {{Cl|&H}}40 'set memory segment to read
ShiftFlag = {{Cl|PEEK}}({{Cl|&H}}17) 'read keyboard function keys
{{Cl|DEF SEG}}
{{Cl|IF...THEN|IF}} ShiftFlag <> x {{Cl|THEN}} 'find key not previously read
x = ShiftFlag 'read a new keypress
{{Cl|IF...THEN|IF}} (ShiftFlag {{Cl|AND (boolean)|AND}} 1) = 1 {{Cl|THEN}} {{Cl|PRINT}} "rightshift"
{{Cl|IF...THEN|IF}} (ShiftFlag {{Cl|AND (boolean)|AND}} 2) = 2 {{Cl|THEN}} {{Cl|PRINT}} "leftshift"
{{Cl|IF...THEN|IF}} (ShiftFlag {{Cl|AND (boolean)|AND}} 4) = 4 {{Cl|THEN}} {{Cl|PRINT}} "ctrl"
{{Cl|IF...THEN|IF}} (ShiftFlag {{Cl|AND (boolean)|AND}} 8) = 8 {{Cl|THEN}} {{Cl|PRINT}} "alt"
{{Cl|END IF}}
x$ = {{Cl|INKEY$}} 'clear keyboard buffer to prevent beeping
{{Cl|IF...THEN|IF}} x$ <> "" {{Cl|THEN}} {{Cl|PRINT}} {{Cl|ASC}}(x$) 'read other keypress {{Cl|ASCII}} codes
{{Cl|LOOP}} {{Cl|UNTIL}} x$ = {{Cl|CHR$}}(27) 'Escape key exit
{{CodeEnd}} {{small|Derived from code by eoredson}}
: Note: Each key must be read individually or sequentially. For combinations use the QB64 [[_KEYDOWN]] function.
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==Reference==
''See also:''
* [[INKEY$]], [[ASCII]], [[ASC]]
* [[_KEYHIT]], [[_KEYDOWN]], [[_KEYCLEAR]]
* [[ON KEY(n)]], [[KEY(n)]], [[KEY]],
* [[INP]], [[Scancodes]] {{text|(examples)}}
* [[Windows_Libraries#Hot_Keys_.28maximize.29|Windows hot keys]]
* [http://www.howtogeek.com/236462/which-key-on-a-mac-keyboard-corresponds-to-the-symbol/ Mac keyboard Symbols]
{{PageNavigation}}

View file

@ -1,5 +1,5 @@
__NOTOC__
<div id="toc"><p style="text-align: center"><br> '''Alphabetical QB64 Keyword Listings''' <br><br>     '''QB64:'''  [[#uA|_A]] [[#uB|_B]] [[#uC|_C]] [[#uD|_D]] [[#uE|_E]] [[#uF|_F]] [[#uG|_G]] [[#uH|_H]] [[#uI|_I]] [[#uK|_K]] [[#uL|_L]] [[#uM|_M]] [[#uN|_N]] [[#uO|_O]] [[#uP|_P]] [[#uR|_R]] [[#uS|_S]] [[#uT|_T]] [[#uU|_U]] [[#uV|_V]] [[#uW|_W]]                <br><br>'''QBasic:'''  [[#A|A]]   [[#B|B]]   [[#C|C]]   [[#D|D]]   [[#E|E]]    [[#F|F]]   [[#G|G]]   [[#H|H]]    [[#I| I]]    [[#K|K]]   [[#L|L]]   [[#M|M]]   [[#N|N]]    [[#O|O]]   [[#P|P]]    [[#R|R]]   [[#S|S]]    [[#T|T]]   [[#U|U]]   [[#V|V]]   [[#W|W]]   [[#X|X]]   <br><br>'''OpenGL:'''   [[#glA|A]]    [[#glB|B]]    [[#glC|C]]    [[#glD|D]]    [[#glE|E]]     [[#glF|F]]    [[#glG|G]]    [[#glH|H]]    [[#glI| I  ]]   [[#glL|L]]    [[#glM|M]]    [[#glN|N]]     [[#glO|O]]    [[#glP|P]]     [[#glR|R]]    [[#glS|S]]     [[#glT|T]]    [[#glV|V]]       <br><br> [[#symbols|Symbols]] '''   -   ''' [[#references|References]]<br><br>{{small|Menu Created by Cyperium}}</p></div>
<div id="toc"><p style="text-align: center"><br> '''Alphabetical QB64 Keyword Listings''' <br><br>     '''QB64:'''  [[#uA|_A]] [[#uB|_B]] [[#uC|_C]] [[#uD|_D]] [[#uE|_E]] [[#uF|_F]] [[#uG|_G]] [[#uH|_H]] [[#uI|_I]] [[#uK|_K]] [[#uL|_L]] [[#uM|_M]] [[#uN|_N]] [[#uO|_O]] [[#uP|_P]] [[#uR|_R]] [[#uS|_S]] [[#uT|_T]] [[#uU|_U]] [[#uV|_V]] [[#uW|_W]]                <br><br>'''QBasic:'''  [[#A|A]]   [[#B|B]]   [[#C|C]]   [[#D|D]]   [[#E|E]]    [[#F|F]]   [[#G|G]]   [[#H|H]]    [[#I| I]]    [[#K|K]]   [[#L|L]]   [[#M|M]]   [[#N|N]]    [[#O|O]]   [[#P|P]]    [[#R|R]]   [[#S|S]]    [[#T|T]]   [[#U|U]]   [[#V|V]]   [[#W|W]]   [[#X|X]]   <br><br> [[#symbols|Symbols]] '''   -   ''' [[#references|References]]<br><br>{{small|Menu Created by Cyperium}}</p></div>
@ -831,429 +831,6 @@ __NOTOC__
<!-- (referenced by QB64 IDE HELP)
-->
<div id = "glA">_glA</div>
==OpenGL specific keywords:==
<center>'''All QB64 OpenGL keywords must use the underscore _gl prefix with the alphabetically listed function names.'''</center>
<center>Use [[$NOPREFIX]] to enable these to be used without the leading underscore.</center>
* Important: See [[SUB _GL]]
----
* [[_glAccum]] (statement) {{text|OpenGL command}}
* [[_glAlphaFunc]] (statement) {{text|OpenGL command}}
* [[_glAreTexturesResident]] (statement) {{text|OpenGL command}}
* [[_glArrayElement]] (statement) {{text|OpenGL command}}
----
<div id = "glB">_glB</div>
* [[_glBegin]] (statement) {{text|OpenGL command}}
* [[_glBindTexture]] (statement) {{text|OpenGL command binds a named texture to a texturing target}}
* [[_glBitmap]] (statement) {{text|OpenGL command}}
* [[_glBlendFunc]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glC">_glC</div>
* [[_glCallList]] (statement) {{text|OpenGL command}}
* [[_glCallLists]] (statement) {{text|OpenGL command}}
* [[_glClear]] (statement) {{text|OpenGL command clears buffers to preset values}}
* [[_glClearAccum]] (statement) {{text|OpenGL command}}
* [[_glClearColor]] (statement) {{text|OpenGL command specifies clear values for the color buffers}}
* [[_glClearDepth]] (statement) {{text|OpenGL command specifies the depth value used when the depth buffer is cleared. Initial value is 1.}}
* [[_glClearIndex]] (statement) {{text|OpenGL command}}
* [[_glClearStencil]] (statement) {{text|OpenGL command specifies the index used when the stencil buffer is cleared. Initial value is 0.}}
* [[_glClipPlane]] (statement) {{text|OpenGL command}}
* [[_glColor3b]] (statement) {{text|OpenGL command}}
* [[_glColor3bv]] (statement) {{text|OpenGL command}}
* [[_glColor3d]] (statement) {{text|OpenGL command}}
* [[_glColor3dv]] (statement) {{text|OpenGL command}}
* [[_glColor3f]] (statement) {{text|OpenGL command}}
* [[_glColor3fv]] (statement) {{text|OpenGL command}}
* [[_glColor3i]] (statement) {{text|OpenGL command}}
* [[_glColor3iv]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
* [[_glColor3s]] (statement) {{text|OpenGL command}}
* [[_glColor3sv]] (statement) {{text|OpenGL command}}
* [[_glColor3ub]] (statement) {{text|OpenGL command}}
* [[_glColor3ubv]] (statement) {{text|OpenGL command}}
* [[_glColor3ui]] (statement) {{text|OpenGL command}}
* [[_glColor3uiv]] (statement) {{text|OpenGL command}}
* [[_glColor3us]] (statement) {{text|OpenGL command}}
* [[_glColor3usv]] (statement) {{text|OpenGL command}}
* [[_glColor4b]] (statement) {{text|OpenGL command}}
* [[_glColor4bv]] (statement) {{text|OpenGL command}}
* [[_glColor4d]] (statement) {{text|OpenGL command}}
* [[_glColor4dv]] (statement) {{text|OpenGL command}}
* [[_glColor4f]] (statement) {{text|OpenGL command}}
* [[_glColor4fv]] (statement) {{text|OpenGL command}}
* [[_glColor4i]] (statement) {{text|OpenGL command}}
* [[_glColor4iv]] (statement) {{text|OpenGL command}}
* [[_glColor4s]] (statement) {{text|OpenGL command}}
* [[_glColor4sv]] (statement) {{text|OpenGL command}}
* [[_glColor4ub]] (statement) {{text|OpenGL command}}
* [[_glColor4ubv]] (statement) {{text|OpenGL command}}
* [[_glColor4ui]] (statement) {{text|OpenGL command}}
* [[_glColor4uiv]] (statement) {{text|OpenGL command}}
* [[_glColor4us]] (statement) {{text|OpenGL command}}
* [[_glColor4usv]] (statement) {{text|OpenGL command}}
* [[_glColorMask]] (statement) {{text|OpenGL command enables and disables writing of frame buffer color components}}
* [[_glColorMaterial]] (statement) {{text|OpenGL command}}
* [[_glColorPointer]] (statement) {{text|OpenGL command}}
* [[_glCopyPixels]] (statement) {{text|OpenGL command}}
* [[_glCopyTexImage1D]] (statement) {{text|OpenGL command copies pixels into a 1D texture image}}
* [[_glCopyTexImage2D]] (statement) {{text|OpenGL command copies pixels into a 2D texture image}}
* [[_glCopyTexSubImage1D]] (statement) {{text|OpenGL command copies a one-dimensional texture subimage}}
* [[_glCopyTexSubImage2D]] (statement) {{text|OpenGL command copiess a two-dimensional texture subimage}}
* [[_glCullFace]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glD">_glD</div>
* [[_glDeleteLists]] (statement) {{text|OpenGL command}}
* [[_glDeleteTextures]] (statement) {{text|OpenGL command deletes named textures}}
* [[_glDepthFunc]] (statement) {{text|OpenGL command specifies the value used for depth buffer comparisons}}
* [[_glDepthMask]] (statement) {{text|OpenGL command enables or disables writing into the depth buffer}}
* [[_glDepthRange]] (statement) {{text|OpenGL command specifies mapping of near clipping plane to window coordinates. Initial value 0.}}
* [[_glDisable]] (statement) {{text|OpenGL command}}
* [[_glDisableClientState]] (statement) {{text|OpenGL command}}
* [[_glDrawArrays]] (statement) {{text|OpenGL command}}
* [[_glDrawBuffer]] (statement) {{text|OpenGL command}}
* [[_glDrawElements]] (statement) {{text|OpenGL command}}
* [[_glDrawPixels]] (statement) {{text|OpenGL command}}
----
<div id = "glE">_glE</div>
* [[_glEdgeFlag]] (statement) {{text|OpenGL command}}
* [[_glEdgeFlagPointer]] (statement) {{text|OpenGL command}}
* [[_glEdgeFlagv]] (statement) {{text|OpenGL command}}
* [[_glEnable]] (statement) {{text|OpenGL command}}
* [[_glEnableClientState]] (statement) {{text|OpenGL command}}
* [[_glEnd]] (statement) {{text|OpenGL command}}
* [[_glEndList]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord1d]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord1dv]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord1f]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord1fv]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord2d]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord2dv]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord2f]] (statement) {{text|OpenGL command}}
* [[_glEvalCoord2fv]] (statement) {{text|OpenGL command}}
* [[_glEvalMesh1]] (statement) {{text|OpenGL command}}
* [[_glEvalMesh2]] (statement) {{text|OpenGL command}}
* [[_glEvalPoint1]] (statement) {{text|OpenGL command}}
* [[_glEvalPoint2]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glF">_glF</div>
* [[_glFeedbackBuffer]] (statement) {{text|OpenGL command}}
* [[_glFinish]] (statement) {{text|OpenGL command}}
* [[_glFlush]] (statement) {{text|OpenGL command}}
* [[_glFogf]] (statement) {{text|OpenGL command}}
* [[_glFogfv]] (statement) {{text|OpenGL command}}
* [[_glFogi]] (statement) {{text|OpenGL command}}
* [[_glFogiv]] (statement) {{text|OpenGL command}}
* [[_glFrontFace]] (statement) {{text|OpenGL command}}
* [[_glFrustum]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glG">_glG</div>
* [[_glGenLists]] (statement) {{text|OpenGL command}}
* [[_glGenTextures]] (statement) {{text|OpenGL command}}
* [[_glGetBooleanv]] (statement) {{text|OpenGL command}}
* [[_glGetClipPlane]] (statement) {{text|OpenGL command}}
* [[_glGetDoublev]] (statement) {{text|OpenGL command}}
* [[_glGetError]] (statement) {{text|OpenGL command}}
* [[_glGetFloatv]] (statement) {{text|OpenGL command}}
* [[_glGetIntegerv]] (statement) {{text|OpenGL command}}
* [[_glGetLightfv]] (statement) {{text|OpenGL command}}
* [[_glGetLightiv]] (statement) {{text|OpenGL command}}
* [[_glGetMapdv]] (statement) {{text|OpenGL command}}
* [[_glGetMapfv]] (statement) {{text|OpenGL command}}
* [[_glGetMapiv]] (statement) {{text|OpenGL command}}
* [[_glGetMaterialfv]] (statement) {{text|OpenGL command}}
* [[_glGetMaterialiv]] (statement) {{text|OpenGL command}}
* [[_glGetPixelMapfv]] (statement) {{text|OpenGL command}}
* [[_glGetPixelMapuiv]] (statement) {{text|OpenGL command}}
* [[_glGetPixelMapusv]] (statement) {{text|OpenGL command}}
* [[_glGetPointerv]] (statement) {{text|OpenGL command}}
* [[_glGetPolygonStipple]] (statement) {{text|OpenGL command}}
* [[_glGetString]] (statement) {{text|OpenGL command}}
* [[_glGetTexEnvfv]] (statement) {{text|OpenGL command}}
* [[_glGetTexEnviv]] (statement) {{text|OpenGL command}}
* [[_glGetTexGendv]] (statement) {{text|OpenGL command}}
* [[_glGetTexGenfv]] (statement) {{text|OpenGL command}}
* [[_glGetTexGeniv]] (statement) {{text|OpenGL command}}
* [[_glGetTexImage]] (statement) {{text|OpenGL command}}
* [[_glGetTexLevelParameterfv]] (statement) {{text|OpenGL command}}
* [[_glGetTexLevelParameteriv]] (statement) {{text|OpenGL command}}
* [[_glGetTexParameterfv]] (statement) {{text|OpenGL command}}
* [[_glGetTexParameteriv]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glH">_glH</div>
* [[_glHint]] (statement) {{text|OpenGL command}}
----
<div id = "glI">_glI</div>
* [[_glIndexMask]] (statement) {{text|OpenGL command}}
* [[_glIndexPointer]] (statement) {{text|OpenGL command}}
* [[_glIndexd]] (statement) {{text|OpenGL command}}
* [[_glIndexdv]] (statement) {{text|OpenGL command}}
* [[_glIndexf]] (statement) {{text|OpenGL command}}
* [[_glIndexfv]] (statement) {{text|OpenGL command}}
* [[_glIndexi]] (statement) {{text|OpenGL command}}
* [[_glIndexiv]] (statement) {{text|OpenGL command}}
* [[_glIndexs]] (statement) {{text|OpenGL command}}
* [[_glIndexsv]] (statement) {{text|OpenGL command}}
* [[_glIndexub]] (statement) {{text|OpenGL command}}
* [[_glIndexubv]] (statement) {{text|OpenGL command}}
* [[_glInitNames]] (statement) {{text|OpenGL command}}
* [[_glInterleavedArrays]] (statement) {{text|OpenGL command}}
* [[_glIsEnabled]] (statement) {{text|OpenGL command}}
* [[_glIsList]] (statement) {{text|OpenGL command}}
* [[_glIsTexture]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glL">_glL</div>
* [[_glLightModelf]] (statement) {{text|OpenGL command}}
* [[_glLightModelfv]] (statement) {{text|OpenGL command}}
* [[_glLightModeli]] (statement) {{text|OpenGL command}}
* [[_glLightModeliv]] (statement) {{text|OpenGL command}}
* [[_glLightf]] (statement) {{text|OpenGL command}}
* [[_glLightfv]] (statement) {{text|OpenGL command}}
* [[_glLighti]] (statement) {{text|OpenGL command}}
* [[_glLightiv]] (statement) {{text|OpenGL command}}
* [[_glLineStipple]] (statement) {{text|OpenGL command}}
* [[_glLineWidth]] (statement) {{text|OpenGL command}}
* [[_glListBase]] (statement) {{text|OpenGL command}}
* [[_glLoadIdentity]] (statement) {{text|OpenGL command}}
* [[_glLoadMatrixd]] (statement) {{text|OpenGL command}}
* [[_glLoadMatrixf]] (statement) {{text|OpenGL command}}
* [[_glLoadName]] (statement) {{text|OpenGL command}}
* [[_glLogicOp]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glM">_glM</div>
* [[_glMap1d]] (statement) {{text|OpenGL command}}
* [[_glMap1f]] (statement) {{text|OpenGL command}}
* [[_glMap2d]] (statement) {{text|OpenGL command}}
* [[_glMap2f]] (statement) {{text|OpenGL command}}
* [[_glMapGrid1d]] (statement) {{text|OpenGL command}}
* [[_glMapGrid1f]] (statement) {{text|OpenGL command}}
* [[_glMapGrid2d]] (statement) {{text|OpenGL command}}
* [[_glMapGrid2f]] (statement) {{text|OpenGL command}}
* [[_glMaterialf]] (statement) {{text|OpenGL command}}
* [[_glMaterialfv]] (statement) {{text|OpenGL command}}
* [[_glMateriali]] (statement) {{text|OpenGL command}}
* [[_glMaterialiv]] (statement) {{text|OpenGL command}}
* [[_glMatrixMode]] (statement) {{text|OpenGL command}}
* [[_glMultMatrixd]] (statement) {{text|OpenGL command}}
* [[_glMultMatrixf]] (statement) {{text|OpenGL command}}
----
<div id = "glN">_glN</div>
* [[_glNewList]] (statement) {{text|OpenGL command}}
* [[_glNormal3b]] (statement) {{text|OpenGL command}}
* [[_glNormal3bv]] (statement) {{text|OpenGL command}}
* [[_glNormal3d]] (statement) {{text|OpenGL command}}
* [[_glNormal3dv]] (statement) {{text|OpenGL command}}
* [[_glNormal3f]] (statement) {{text|OpenGL command}}
* [[_glNormal3fv]] (statement) {{text|OpenGL command}}
* [[_glNormal3i]] (statement) {{text|OpenGL command}}
* [[_glNormal3iv]] (statement) {{text|OpenGL command}}
* [[_glNormal3s]] (statement) {{text|OpenGL command}}
* [[_glNormal3sv]] (statement) {{text|OpenGL command}}
* [[_glNormalPointer]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glO">_glO</div>
* [[_glOrtho]] (statement) {{text|OpenGL command}}
----
<div id = "glP">_glP</div>
* [[_glPassThrough]] (statement) {{text|OpenGL command}}
* [[_glPixelMapfv]] (statement) {{text|OpenGL command}}
* [[_glPixelMapuiv]] (statement) {{text|OpenGL command}}
* [[_glPixelMapusv]] (statement) {{text|OpenGL command}}
* [[_glPixelStoref]] (statement) {{text|OpenGL command}}
* [[_glPixelStorei]] (statement) {{text|OpenGL command}}
* [[_glPixelTransferf]] (statement) {{text|OpenGL command}}
* [[_glPixelTransferi]] (statement) {{text|OpenGL command}}
* [[_glPixelZoom]] (statement) {{text|OpenGL command}}
* [[_glPointSize]] (statement) {{text|OpenGL command}}
* [[_glPolygonMode]] (statement) {{text|OpenGL command}}
* [[_glPolygonOffset]] (statement) {{text|OpenGL command}}
* [[_glPolygonStipple]] (statement) {{text|OpenGL command}}
* [[_glPopAttrib]] (statement) {{text|OpenGL command}}
* [[_glPopClientAttrib]] (statement) {{text|OpenGL command}}
* [[_glPopMatrix]] (statement) {{text|OpenGL command}}
* [[_glPopName]] (statement) {{text|OpenGL command}}
* [[_glPrioritizeTextures]] (statement) {{text|OpenGL command}}
* [[_glPushAttrib]] (statement) {{text|OpenGL command}}
* [[_glPushClientAttrib]] (statement) {{text|OpenGL command}}
* [[_glPushMatrix]] (statement) {{text|OpenGL command}}
* [[_glPushName]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glR">_glR</div>
* [[_glRasterPos2d]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2dv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2f]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2fv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2i]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2iv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2s]] (statement) {{text|OpenGL command}}
* [[_glRasterPos2sv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3d]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3dv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3f]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3fv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3i]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3iv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3s]] (statement) {{text|OpenGL command}}
* [[_glRasterPos3sv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4d]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4dv]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
* [[_glRasterPos4f]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4fv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4i]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4iv]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4s]] (statement) {{text|OpenGL command}}
* [[_glRasterPos4sv]] (statement) {{text|OpenGL command}}
* [[_glReadBuffer]] (statement) {{text|OpenGL command}}
* [[_glReadPixels]] (statement) {{text|OpenGL command}}
* [[_glRectd]] (statement) {{text|OpenGL command}}
* [[_glRectdv]] (statement) {{text|OpenGL command}}
* [[_glRectf]] (statement) {{text|OpenGL command}}
* [[_glRectfv]] (statement) {{text|OpenGL command}}
* [[_glRecti]] (statement) {{text|OpenGL command}}
* [[_glRectiv]] (statement) {{text|OpenGL command}}
* [[_glRects]] (statement) {{text|OpenGL command}}
* [[_glRectsv]] (statement) {{text|OpenGL command}}
* [[_GLRENDER]] (statement) {{text|sets whether context is displayed, on top of or behind the software rendering.}}
* [[_glRenderMode]] (statement) {{text|OpenGL command}}
* [[_glRotated]] (statement) {{text|OpenGL command}}
* [[_glRotatef]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glS">_glS</div>
* [[_glScaled]] (statement) {{text|OpenGL command}}
* [[_glScalef]] (statement) {{text|OpenGL command}}
* [[_glScissor]] (statement) {{text|OpenGL command}}
* [[_glSelectBuffer]] (statement) {{text|OpenGL command}}
* [[_glShadeModel]] (statement) {{text|OpenGL command}}
* [[_glStencilFunc]] (statement) {{text|OpenGL command}}
* [[_glStencilMask]] (statement) {{text|OpenGL command}}
* [[_glStencilOp]] (statement) {{text|OpenGL command}}
----
<div id = "glT">_glT</div>
* [[_glTexCoord1d]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1dv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1f]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1fv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1i]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1iv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1s]] (statement) {{text|OpenGL command}}
* [[_glTexCoord1sv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2d]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2dv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2f]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2fv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2i]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2iv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2s]] (statement) {{text|OpenGL command}}
* [[_glTexCoord2sv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3d]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3dv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3f]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3fv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3i]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
* [[_glTexCoord3iv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3s]] (statement) {{text|OpenGL command}}
* [[_glTexCoord3sv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4d]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4dv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4f]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4fv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4i]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4iv]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4s]] (statement) {{text|OpenGL command}}
* [[_glTexCoord4sv]] (statement) {{text|OpenGL command}}
* [[_glTexCoordPointer]] (statement) {{text|OpenGL command}}
* [[_glTexEnvf]] (statement) {{text|OpenGL command}}
* [[_glTexEnvfv]] (statement) {{text|OpenGL command}}
* [[_glTexEnvi]] (statement) {{text|OpenGL command}}
* [[_glTexEnviv]] (statement) {{text|OpenGL command}}
* [[_glTexGend]] (statement) {{text|OpenGL command}}
* [[_glTexGendv]] (statement) {{text|OpenGL command}}
* [[_glTexGenf]] (statement) {{text|OpenGL command}}
* [[_glTexGenfv]] (statement) {{text|OpenGL command}}
* [[_glTexGeni]] (statement) {{text|OpenGL command}}
* [[_glTexGeniv]] (statement) {{text|OpenGL command}}
* [[_glTexImage1D]] (statement) {{text|OpenGL command}}
* [[_glTexImage2D]] (statement) {{text|OpenGL command}}
* [[_glTexParameterf]] (statement) {{text|OpenGL command}}
* [[_glTexParameterfv]] (statement) {{text|OpenGL command}}
* [[_glTexParameteri]] (statement) {{text|OpenGL command}}
* [[_glTexParameteriv]] (statement) {{text|OpenGL command}}
* [[_glTexSubImage1D]] (statement) {{text|OpenGL command}}
* [[_glTexSubImage2D]] (statement) {{text|OpenGL command}}
* [[_glTranslated]] (statement) {{text|OpenGL command}}
* [[_glTranslatef]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
----
<div id = "glV">_glV</div>
* [[_glVertex2d]] (statement) {{text|OpenGL command}}
* [[_glVertex2dv]] (statement) {{text|OpenGL command}}
* [[_glVertex2f]] (statement) {{text|OpenGL command}}
* [[_glVertex2fv]] (statement) {{text|OpenGL command}}
* [[_glVertex2i]] (statement) {{text|OpenGL command}}
* [[_glVertex2iv]] (statement) {{text|OpenGL command}}
* [[_glVertex2s]] (statement) {{text|OpenGL command}}
* [[_glVertex2sv]] (statement) {{text|OpenGL command}}
* [[_glVertex3d]] (statement) {{text|OpenGL command}}
* [[_glVertex3dv]] (statement) {{text|OpenGL command}}
* [[_glVertex3f]] (statement) {{text|OpenGL command}}
* [[_glVertex3fv]] (statement) {{text|OpenGL command}}
* [[_glVertex3i]] (statement) {{text|OpenGL command}}
* [[_glVertex3iv]] (statement) {{text|OpenGL command}}
* [[_glVertex3s]] (statement) {{text|OpenGL command}}
* [[_glVertex3sv]] (statement) {{text|OpenGL command}}
* [[_glVertex4d]] (statement) {{text|OpenGL command}}
* [[_glVertex4dv]] (statement) {{text|OpenGL command}}
* [[_glVertex4f]] (statement) {{text|OpenGL command}}
* [[_glVertex4fv]] (statement) {{text|OpenGL command}}
* [[_glVertex4i]] (statement) {{text|OpenGL command}}
* [[_glVertex4iv]] (statement) {{text|OpenGL command}}
* [[_glVertex4s]] (statement) {{text|OpenGL command}}
* [[_glVertex4sv]] (statement) {{text|OpenGL command}}
* [[_glVertexPointer]] (statement) {{text|OpenGL command}}
* [[_glViewport]] (statement) {{text|OpenGL command}}
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
<div id = "symbols"></div>

View file

@ -1,73 +0,0 @@
The keywords listed here are not supported in QB64. QB64 is meant to be compatible with '''QB 4.5 or lower''' versions. '''PDS (7.1) is not supported'''. Older code that uses these keywords won't generate errors, as these are ignored by the compiler.
{| align="right"
| __TOC__
|}
* [[ALIAS]] (supported in [[DECLARE LIBRARY]] only)
* ANY
* [[BYVAL]] (supported in [[DECLARE LIBRARY]] only)
* CALLS
* CDECL
* DATE$ (statement) (reading the current [[DATE$]] is supported)
* DECLARE (non-BASIC statement)
* DEF FN, EXIT DEF, END DEF
* ERDEV, ERDEV$
* FILEATTR
* FRE
* IOCTL, IOCTL$
* [[OPEN]] with devices like '''LPT, CON, KBRD''', and other devices is not supported. [[LPRINT]] and [[OPEN COM]] are supported.
* ON PEN, PEN (statement), PEN (function)
* ON PLAY(n), PLAY(n) ON/OFF/STOP. ([[PLAY]] music is supported.)
* ON UEVENT, UEVENT (statement)
* SETMEM
* SIGNAL
* TIME$ (statement) (reading the current [[TIME$]] is supported)
* TRON, TROFF
* [[WIDTH]] [[LPRINT]] combined statement is not supported.
==Keywords Not Supported in Linux or macOS versions==
The commands listed here contain platform-specific calls and may be implemented in the future in Linux and macOS. These commands currently result in stub calls which do nothing.
NOTE: The IDE does not support the opening or retrieval of more than one program at a time, but multiple instances of the IDE can be used simultaneously.
Some OS Specific window/desktop calls:
* [[_ACCEPTFILEDROP]], [[_TOTALDROPPEDFILES]], [[_DROPPEDFILE]], [[_FINISHDROP]]
* [[_SCREENPRINT]]
* [[_SCREENCLICK]]
* [[_SCREENMOVE]] (available in macOS, not available in Linux)
* [[_CLIPBOARDIMAGE]], [[_CLIPBOARDIMAGE (function)]]
* [[_WINDOWHASFOCUS]] (available in Linux, not available in macOS)
* [[_WINDOWHANDLE]]
* [[_CAPSLOCK]], [[_NUMLOCK]], [[_SCROLLLOCK]] (statements and functions)
Modular: QB64 has no limit on file size so BAS file modules can be combined.
* [[CHAIN]]
* [[RUN]]
Mouse related:
* [[_MOUSEWHEEL]] (available in Linux, not available in macOS)
Printing:
* [[LPRINT]]
* [[_PRINTIMAGE]]
Port access:
* [[OPEN COM]]
File locking:
* [[LOCK]]
* [[UNLOCK]]
<p style="text-align: center">([[#toc|Return to Table of Contents]])</p>
==Reference==
* [[QB64 FAQ|Frequently Asked Questions about QB64]]
{{PageNavigation}}

View file

@ -1,145 +0,0 @@
{{DISPLAYTITLE:_MEM}}
The [[_MEM]] variable type can be used when working with memory blocks. It has no variable [[Variable Types|type]] suffix.
{{PageSyntax}}
: [[DIM]] m [[AS]] [[_MEM]]
{{PageDescription}}
''Variable TYPE:''
* Memory DOT values are actually part of the built in memory variable [[Variable Types|type]] in QB64. The following [[TYPE]] is built in:
{{WhiteStart}}TYPE memory_type
OFFSET AS _OFFSET 'start location of block(changes with byte position)
SIZE AS _OFFSET 'size of block remaining at offset(changes with position)
TYPE AS _OFFSET 'type description of variable used(never changes)
ELEMENTSIZE AS _OFFSET 'byte size of values inside the block(never changes)
IMAGE AS LONG 'the image handle used when _MEMIMAGE(handle) is used
SOUND AS LONG 'the sound handle used when _MEMSOUND(handle) is used
END TYPE
{{text|The above [[TYPE]] is for clarification purposes only. It '''doesn't need''' to be pasted in a program to use _MEM.|red}}
{{WhiteEnd}}
===Usage===
* The _MEM type contains the following '''read-only''' elements where ''name'' is the _MEM variable name:
:: ''name'''''.OFFSET''' is the current start position in the memory block AS [[_OFFSET]]. Add bytes to change position.
:: ''name'''''.SIZE''' is the remaining size of the block at current position in bytes AS [[_OFFSET]]
:: ''name'''''.TYPE''' is the type (represented as bits combined to form a value) AS [[_OFFSET]]:
==.TYPE values ==
:::* [bit 0] 1* byte types (_BYTE)
:::* [bit 1] 2* byte types (INTEGER)
:::* [bit 2] 4* byte types (LONG or SINGLE)
:::* [bit 3] 8* byte types (DOUBLE or _INTEGER64)
:::* [bit 4] 16* byte types (reserved for future use)
:::* [bit 5] 32* byte types (_FLOAT)
:::* [bit 6] 64* byte types (reserved for future use)
:::* [bit 7] 128 = integer types (_BYTE, INTEGER, LONG, _INTEGER64) (added to *)
:::* [bit 8] 256 = floating point types (SINGLE, DOUBLE, _FLOAT) (added to *)
:::* [bit 9] 512 = STRING types (fixed length or variable length)
:::* [bit 10] 1024 = _UNSIGNED types (added to *+128)
:::* [bit 11] 2048 = pixel data usually from _MEMIMAGE (added to 1+128+1024 for 256 color screens, or 2+128+1024 for text screens, or 4+128+1024 for 32-bit color screens)
:::* [bit 12] 4096 = _MEM TYPE structure (NOT added to 32768)
:::* [bit 13] 8192 = _OFFSET type (added to 4+128+[1024] or 8+128+[1024] or future_size+128+[1024])
:::* [bit 14] 16384 = data created/defined by _MEMNEW(size) or _MEMNEW(offset,size)
:::* [bit 15] 32768 = a custom, user defined type (ie. created with TYPE name ... END TYPE)
:::* [bit 16] 65536 = an array of data (added to other type values defining the array's data type)
''Note: If a future integer, float or other type doesn't have a size that is 1,2,4,8,16,32,64,128 or 256 it won't have a size-bit set.''
* '''Note: [[_OFFSET]] values cannot be cast to other variable [[Variable Types|type]]s reliably. _MEM is a reserved custom variable [[Variable Types|type]].'''
* '''[[_MEM (function)|_MEM]] cannot reference variable length [[STRING]] variable values. String values must be designated as a fixed-[[LEN|length]] string.'''
{{PageExamples}}
''Example 1:'' Demonstration of .IMAGE to determine an image's dimensions, .TYPE to verify the type and [[_MEMEXISTS]] to check image has not been freed
{{CodeStart}}
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(500, 500, 32)
i = {{Cl|_LOADIMAGE}}("qb64_trans.png", 32)
{{Cl|_PUTIMAGE}} (0, 0), i
{{Cl|DIM}} m {{Cl|AS}} {{Cl|_MEM}}
m = {{Cl|_MEMIMAGE}}(i)
'try uncommenting the following line and see what happens
'{{Cl|_MEMFREE}} m
t = m.{{Cl|TYPE}}
{{Cl|IF...THEN|IF}} t {{Cl|AND (boolean)|AND}} 2048 {{Cl|THEN}}
{{Cl|PRINT}} "this is/was an image"
{{Cl|IF...THEN|IF}} {{Cl|_MEMEXISTS}}(m) {{Cl|THEN}} 'check if memory m is still available
{{Cl|PRINT}} t {{Cl|AND (boolean)|AND}} 7; "bytes per pixel"
{{Cl|PRINT}} "image handle "; m.IMAGE
{{Cl|PRINT}} "image width"; {{Cl|_WIDTH (function)|_WIDTH}}(m.IMAGE)
{{Cl|PRINT}} "image height"; {{Cl|_HEIGHT}}(m.IMAGE)
{{Cl|ELSE}} {{Cl|PRINT}} "Memory already freed!"
{{Cl|END IF}}
{{Cl|END IF}} '' ''
{{CodeEnd}}
''Example 2:'' Converts the current [[_DEST|destination]] [[SCREEN]] 13 image memory altered by [[PSET]] to a [[STRING]] value. SCREEN 13 only.
{{CodeStart}} '' ''
{{Cl|SCREEN}} 13
{{Cl|PSET}} (0, 0), {{Cl|ASC}}("H") 'top left corner of screen
{{Cl|PSET}} (1, 0), {{Cl|ASC}}("E")
{{Cl|PSET}} (2, 0), {{Cl|ASC}}("L")
{{Cl|PSET}} (3, 0), {{Cl|ASC}}("L")
{{Cl|PSET}} (4, 0), {{Cl|ASC}}("O")
{{Cl|DIM}} m {{Cl|AS}} {{Cl|_MEM}}
m = {{Cl|_MEMIMAGE}}(0) 'copy the screen memory to m
x1$ = {{Cl|_MEMGET (function)|_MEMGET}}(m, m.OFFSET, {{Cl|STRING}} * 5) 'get at block start position
{{Cl|LOCATE}} 2, 1:{{Cl|PRINT}} {{Cl|LEN}}(x1$) 'prints 5 bytes as size is STRING * 5
{{Cl|PRINT}} x1$ 'prints HELLO as ASCII character values
{{Cl|PRINT}} m.OFFSET; m.SIZE; m.ELEMENTSIZE
{{Cl|_MEMFREE}} m '' ''
{{CodeEnd}}
{{OutputStart}}
5
HELLO
5448320 6400 1
{{OutputEnd}}
: ''Explanation:'' When a numerical [[_BYTE]] value is converted to a [[STRING]], each byte is converted to an [[ASCII]] character. The QB64 IDE will capitalize _MEM dot values.
{{WhiteStart}} m.SIZE = 320 * 200 = 6400 bytes
m.ELEMENTSIZE = 1 byte
{{WhiteEnd}}
''Example 3:'' Using _MEM to convert _OFFSET to _INTEGER64.
{{CodeStart}} '' ''
DIM x AS INTEGER
DIM m AS _MEM
m = _MEM(x)
PRINT m.OFFSET
PRINT ConvertOffset(m.OFFSET)
FUNCTION ConvertOffset&& (value AS _OFFSET)
$CHECKING:OFF
DIM m AS _MEM 'Define a memblock
m = _MEM(value) 'Point it to use value
$IF 64BIT THEN
'On 64 bit OSes, an OFFSET is 8 bytes in size. We can put it directly into an Integer64
_MEMGET m, m.OFFSET, ConvertOffset&& 'Get the contents of the memblock and put the values there directly into ConvertOffset&&
$ELSE
'However, on 32 bit OSes, an OFFSET is only 4 bytes. We need to put it into a LONG variable first
_MEMGET m, m.OFFSET, temp& 'Like this
ConvertOffset&& = temp& 'And then assign that long value to ConvertOffset&&
$END IF
_MEMFREE m 'Free the memblock
$CHECKING:ON
END FUNCTION
{{CodeEnd}}
''Explanation:'' The above will print two numbers which should match. These numbers will vary, as they're representations of where X is stored in memory, and that position is going to vary every time the program is run. What it should illustrate, however, is a way to convert _OFFSET to _INTEGER64 values, which can sometimes be useful when trying to run calculations involving mem.SIZE, mem.TYPE, or mem.ELEMENTSIZE.
{{PageSeeAlso}}
* [[_MEM (function)]]
* [[_MEMELEMENT]], [[_MEMCOPY]]
* [[_MEMIMAGE]], [[_MEMNEW]]
* [[_MEMSOUND]]
* [[_MEMGET]], [[_MEMPUT]]
* [[_MEMFILL]], [[_MEMFREE]]
{{PageNavigation}}

View file

@ -1,52 +0,0 @@
{{DISPLAYTITLE:_MEMGET}}
The [[_MEMGET]] statement reads a portion of a memory block at an OFFSET position into a variable, array or user defined type.
{{PageSyntax}}
: [[_MEMGET]] {{Parameter|memoryBlock}}, {{Parameter|bytePosition}}, {{Parameter|destinationVariable}}
* {{Parameter|memoryBlock}} is a [[_MEM]] variable type memory block name created by [[_MEMNEW]] or the [[_MEM (function)|_MEM]] function.
* {{Parameter|bytePosition}} is the {{Parameter|memoryBlock}}.[[OFFSET]] memory start position plus any bytes to move into the block.
* {{Parameter|destinationVariable}} is the variable assigned to hold the data. The number of bytes read is determined by the variable [[Variable Types|type]] used.
{{PageDescription}}
* The [[_MEMGET]] statement is similar to the [[GET]] statement used in files, but the position is required.
* The memory block name.[[OFFSET]] returns the starting byte position of the block. Add bytes to move into the block.
* The variable type held in the memory block can determine the next {{Parameter|bytePosition}} to read.
* [[LEN]] can be used to determine the byte size of numerical or user defined variable [[Variable Types|type]]s regardless of the value held.
* [[STRING]] values should be of a defined length. Variable length strings can actually move around in memory and not be found.
{{PageExamples}}
''Example:'' Shows how to read the PSET color values from a program's [[SCREEN]] memory to an array.
{{CodeStart}} '' ''
{{Cl|SCREEN}} 13
{{Cl|PSET}} (0, 0), 123
{{Cl|PSET}} (1, 0), 222 'create screen image
'here is an array
{{Cl|DIM}} screen_array(319, 199) {{Cl|AS}} {{Cl|_UNSIGNED}} {{Cl|_BYTE}} 'use screen dimensions from 0
'here's how we can copy the screen to our array
{{Cl|DIM}} m {{Cl|AS}} {{Cl|_MEM}}
m = {{Cl|_MEMIMAGE}} '0 or no handle necessary when accessing the current program screen
{{Cl|_MEMGET}} m, m.OFFSET, screen_array()
'here's the proof
{{Cl|PRINT}} screen_array(0, 0) 'print 123
{{Cl|PRINT}} screen_array(1, 0) 'print 222
{{Cl|END}} '' ''
{{CodeEnd}}
{{PageSeeAlso}}
* [[_MEMGET (function)]]
* [[_MEMPUT]]
* [[_MEM]]
* [[_MEMIMAGE]]
* [[_MEMFREE]]
{{PageNavigation}}

View file

@ -1,85 +0,0 @@
'''Metacommands''' are program wide commands that start with $.
==Legacy metacommands (QBasic/QuickBASIC)==
===Syntax===
:REM [[$INCLUDE]]: '[[QB.BI]]' 'loads a reference file or library
:REM [[$DYNAMIC]] 'enables resizing of array dimensions with REDIM
:REM [[$STATIC]] 'arrays cannot be resized once dimensioned
===Description===
* QBasic metacommands are normally used at the program start and are in effect throughout the program.
* QBasic metacommands are always prefixed with <code>$</code> and MUST be commented with [[apostrophe|']] or [[REM]].
* [[$INCLUDE]] is always followed by a colon and the full filename must be included in single quotes.
* [[$DYNAMIC]] allows larger arrays that are changeable in size at runtime.
* [[$STATIC]] makes all arrays unchangeable in size.
* '''QBasic metacommands should have their own program line because they are commented.'''
==QB64 metacommands==
===Syntax===
:[[$ASSERTS]][:CONSOLE] 'enables assertions
:[[$CHECKING]]:{ON|OFF} 'disables QB64 C++ event and error checking (no spaces)
:[[$COLOR]]:{0|32} 'adds named color constants to the program
:[[$CONSOLE]][:ONLY] 'creates a QB64 console window throughout the program
:[[$DEBUG]] 'enables debugging features
:[[$ERROR]] message 'triggers a compilation error, useful inside $IF blocks
:[[$EXEICON]]:'iconfile.ico' 'embeds an .ICO file into the final executable (Windows only)
:[[$IF]]...[[$END IF]] 'precompiler conditional directive
:[[$LET]] variable = expression 'defines precompiler flags
:[[$NOPREFIX]] 'allows QB64 keywords without the leading <code>_</code>
:[[$RESIZE]]:{ON|OFF|STRETCH|SMOOTH} 'determines if re-sizing of the program screen by the user is allowed
:[[$SCREENHIDE]] 'hides the QB64 program window throughout the program
:[[$SCREENSHOW]] 'displays the main QB64 program window
:[[$VERSIONINFO]]:key=value[, ...] 'embeds version info metadata into the final executable (Windows only)
:[[$VIRTUALKEYBOARD]]:{ON|OFF} 'enables the virtual keyboard (Deprecated)
===Description===
* [[$INCLUDE]] can be used at the beginning or at the end of program SUB procedures.
* [[$ASSERTS]] enables the [[_ASSERT]] macro.
* [[$CHECKING]] '''OFF''' should only be used with '''errorless''' code where every CPU cycle counts! Use '''ON''' to re-enable event checking. Event checking can be turned OFF or ON throughout a program.
* [[$COLOR]] includes named color constants in a program.
* [[$CONSOLE]] creates a console window which can be turned off later with [[_CONSOLE]] OFF.
* [[$DEBUG]] enables debugging features allowing you to step through your code running line by line and to inspect variables and change their values in real time.
* [[$EXEICON]] embeds a designated icon file into the compiled EXE file. (Windows ONLY)
* [[$ERROR]] MESSAGE causes a compilation error whenever QB64 attempts to compile it, displaying MESSAGE to the user. This is useful if inside a $IF block, as the error can be conditional.
* [[$IF]]...[[$END IF]] allows selective inclusion of code in the final program.
* [[$LET]] used to set a flag variable for the precompiler.
* [[$NOPREFIX]] allows all QB64 functions and statements to be used without the leading underscore (_).
* [[$RESIZE]] allows a user to resize the program window. OFF is default.
* [[$SCREENHIDE]] hides the QB64 program window throughout the program until [[$SCREENSHOW]] is used.
* [[$VERSIONINFO]] adds metadata to Windows only binaries for identification purposes across the OS.
* [[$VIRTUALKEYBOARD]] turns the virtual keyboard ON or OFF for use in touch-enabled devices. (DEPRECATED)
* '''Do not comment out with [[apostrophe|']] or [[REM]] QB64-specific metacommands.'''
{{PageSeeAlso}}
* [[OPTION_BASE|OPTION BASE]], [[OPTION_EXPLICIT|OPTION _EXPLICIT]], [[OPTION_EXPLICITARRAY|OPTION _EXPLICITARRAY]]
* [[Statement]], [[Function (explanatory)]]
* [[REM]]
* [[DIM]], [[REDIM]]
* [[ON TIMER(n)]]
{{PageNavigation}}

View file

@ -1,43 +0,0 @@
{{DISPLAYTITLE:_OFFSET (function)}}
The [[_OFFSET]] function returns the memory offset of/within a given variable.
{{PageSyntax}}
: {{Parameter|offset%&}} = [[_OFFSET]]({{Parameter|variable}})
{{PageDescription}}
* The {{Parameter|variable}} parameter can be any type of numerical or [[STRING|string]] variable name.
* API [[DECLARE LIBRARY|LIBRARY]] parameter or [[TYPE|type]] names may include '''lp, ptr''' or '''p''' which designates them as a pointer type.
* _OFFSET function return values should be stored in [[_OFFSET]] type variables. As no other variable type is 'elastic' like [[_OFFSET]], there can be no guarantee that any other variable type can hold the value of an _OFFSET.
* Returns the memory offset of variables, user-defined-types & elements, arrays & indices and the base offset of [[STRING]]s.
* Offset values are currently only useful when used in conjunction with [[_MEM]] or [[DECLARE LIBRARY]] procedures.
* OFFSET values are used as a part of the [[_MEM]] variable [[Variable Types|type]] in QB64; {{Parameter|variable}}.OFFSET returns or sets the current position in memory.
* '''Warning:''' QB64 variable length strings can move about in memory at any time. If you get the _OFFSET of a variable length sting on one line and use it on the next it may not be there anymore.''' To be safe, move variable length strings into fixed length strings first.'''
{{PageExamples}}
''Example:'' Using memcpy with the _OFFSET function values as parameters.
{{CodeStart}} '' ''
{{Cl|DECLARE DYNAMIC LIBRARY|DECLARE CUSTOMTYPE LIBRARY}}
{{Cl|SUB}} memcpy ({{Cl|BYVAL}} dest {{Cl|AS}} {{Cl|_OFFSET}}, {{Cl|BYVAL}} source {{Cl|AS}} {{Cl|_OFFSET}}, {{Cl|BYVAL}} bytes {{Cl|AS}} {{Cl|LONG}})
{{Cl|DECLARE LIBRARY|END DECLARE}}
a$ = "1234567890"
b$ = "ABCDEFGHIJ"
memcpy {{Cl|_OFFSET (function)|_OFFSET}}(a$) + 5, {{Cl|_OFFSET (function)|_OFFSET}}(b$) + 5, 5
{{Cl|PRINT}} a$ '' ''
{{CodeEnd}}
{{OutputStart}}12345FGHIJ
{{OutputEnd}}
{{PageSeeAlso}}
* [[_OFFSET]] {{text|(variable type)}}
* [[DECLARE LIBRARY]]
* [[DECLARE DYNAMIC LIBRARY]]
* [[Using _OFFSET]]
{{PageNavigation}}

View file

@ -1,22 +0,0 @@
ON creates event procedure calls or enables event trapping.
* Set the sub-procedure call for [[KEY(n)]], [[STRIG(n)]], [[TIMER]]
* To turn on event trapping for [[ON KEY (n)]], [[ON STRIG (n)]] and [[ON TIMER (n)]].
* In the case of [[ON ERROR]] the trap is also enabled until a subsequent ON ERROR statement.
* ON procedures should be used only in the main program module and not inside of SUB procedures!
* If you have used the [[$CHECKING]]:[[OFF]] metacommand, [[$CHECKING]]:'''ON''' will turn on c++ error checking again.
''See also:''
[[ON...GOSUB]], [[ON...GOTO]]
[[OFF]], [[STOP]], [[KEY]]
[[$CHECKING]]
{{PageNavigation}}

View file

@ -1,28 +0,0 @@
'''This page is maintained for historic purposes. The keyword is not supported in QB64.'''
----
[[ON COM(n)]] branches to a line number or label when there is a value in the serial port specified.
{{PageSyntax|}}
:[[ON COM(n)]] [[GOSUB]] {''linenumber''|''label''}
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not implemented in QB64]]'''
* ''n'' can be 1 or 2 (the number of the serial port that is tested).
* If a value exists in the port then the program branches to the ''linenumber'' or ''label'' specified.
* The event handler must first be activated with [[COM|COM(n) ON]]
{{PageSeeAlso}}
* [[COM(n)]]
* [[OPEN COM]]
* [[Port Access Libraries]] {{text|(COM or LPT registers)}}
* [[Windows_Libraries#Windows_Ports|Enumerating Windows Ports]]
{{PageNavigation}}

View file

@ -1,24 +0,0 @@
'''This page is maintained for historic purposes. The keyword is not supported in QB64.'''
----
[[ON PEN]] enables event handling for the ''light pen''.
{{PageSyntax}}
: [[ON PEN]] [[GOSUB]] {{Parameter|lineLabel}} | {{Parameter|lineNumber}}
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* Any activity on the lightpen will cause the program to branch to the specified {{Parameter|lineLabel}} or {{Parameter|lineNumber}}.
* [[PEN (statement)|PEN]] [[ON]] enables or resumes event trapping.
* [[PEN (statement)|PEN]] [[OFF]] disables event trapping and event logging.
* [[PEN (statement)|PEN]] [[STOP]] temporarily suspends event trapping. When resumed again by [[PEN (statement)|PEN]] [[ON]]), may report events while suspended.
{{PageSeeAlso}}
* [[PEN]] (function), [[PEN (statement)]]
{{PageNavigation}}

View file

@ -1,21 +0,0 @@
'''This page is maintained for historic purposes. The keyword is not supported in QB64.'''
----
[[ON PLAY(n)]] is an event-trapping statement that specifies the line-number or label to branch to when the background music queue has too few notes.
{{PageSyntax}}
: '''ON PLAY''' ({{Parameter|queueLimit}}) [[GOSUB]] {{{Parameter|lineLabel}} | {{Parameter|lineNumber}}}
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* You can use PLAY ON, PLAY OFF and PLAY STOP to resume event-trapping, disable it, or stop it (resumes with PLAY ON).
{{PageSeeAlso}}
* [[PLAY]], [[PLAY(n)]], [[ON...GOSUB]]
* [[_SNDRAW]], [[_SNDRAWLEN]]
{{PageNavigation}}

View file

@ -1,69 +0,0 @@
#REDIRECT [[Keywords currently not supported by QB64]]
'''This page is maintained for historic purposes. The keyword is not supported in QB64.'''
----
The [[ON UEVENT]] statement allows a program to use a user defined event procedure.
{{PageSyntax}}
: [[ON UEVENT]] [[GOSUB]] {{{Parameter|lineNumber}} | {{Parameter|lineLabel}}}
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* UEVENT procedures were only available in QuickBASIC or PDS.
* Any language(including assembly) compiler that can create interrupt service routines and uses code that can be linked with QuickBASIC may be used.
* {{Parameter|lineNumber}} or {{Parameter|lineLabel}} is the line number or label of a [[GOSUB]] routine.
* Allows your program to go to an event-handling routine when a user-defined event (often a hardware interrupt) occurs.
* Once events have been defined with an ON event statement, they act like interrupts.
* When [[UEVENT]] ON has been executed, the user-defined event can send the program to a GOSUB routine.
* At least two or three code procedures are needed to set up the user-defined event.
:# The first is the interrupt service routine using '''SetUEvent'''.
:# The second is a routine to insert the address of the service routine into the interrupt vector table.(optional)
:# The third is the GOSUB routine your program calls to retrieve the data or do another procedure.
* If the initialization routine "steals" an interrupt used by another service routine, the original address MUST be restored before the program terminates.
* Steps in creating a user-defined event:
:# Write an event-handling routine using [[CALL]] '''SetUEvent''' and add it to your program.
:# Use the ON UEVENT GOSUB statement to specify the user-defined event procedure.
:# Use the UEVENT ON statement to enable event trapping.
:# Call the interrupt-initialization routine to insert the address of the service routine into the interrupt vector table.
* When the specified interrupt occurs, the execution is transferred to the interrupt service routine. The service routine collects and stores the data the user wants. It then calls '''SetUEvent'''. SetUEvent sets a flag checked by QuickBasic before going to the next code statement(or label if using BC.EXE compiler option /W instead of /V ). When the flag is set, control transfers to the event-handling routine in ON EVENT GOSUB.
* The '''SetUEvent''' procedure is a part of QuickBasic, and is included in compiled programs or when the QuickBASIC IDE is run with the /L command-line option. Your interrupt service routine must [[CALL]] SetUEvent.
* If you want to return a value, you must write a procedure for your program to call. (It would usually be called by your event-handling routine.) The function must be [[DECLARE]]d.
* Although ON UEVENT GOSUB ties an event-handling routine to a user-defined event, it does not enable the event trap. The [[UEVENT]] statement is used to enable, disable, and suspend user-defined event trapping.
<center>(C) Microsoft Corporation 1988</center>
''Example:'' A simple user defined event.
{{CodeStart}} '' ''
{{Cl|ON UEVENT}} {{Cl|GOSUB}} Twenty ' set the procedure to enable
{{Cl|UEVENT}} ON ' turn on event handling
{{Cl|INPUT}} "Enter a number: ", entry
{{Cl|IF...THEN|IF}} entry = 20 {{Cl|THEN}} {{Cl|CALL}} SetUEvent ' trigger the event
{{Cl|END}}
Twenty:
{{Cl|PRINT}} "The user entered twenty!"
{{Cl|RETURN}} ' once an event is handled, return to last program procedure '' ''
{{CodeEnd}}
{{PageSeeAlso}}
* [[UEVENT]]
* [[ON TIMER(n)]]
* [[ON KEY(n)]]
{{PageNavigation}}

View file

@ -1,49 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
The '''PEN''' function returns requested information about the lightpen device used.
{{PageSyntax}}
:: PEN(n)
''Description:''
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* The lightpen was a device that detected the current position when the screen was drawn. It sends a signal when it is detected, from that the x and y coordinates of the pen relative to the screen is known. '''Seldom used today!''' (mainly because of the pain in the arm because of the constant lift of the pen to the screen and I suspect it left the screen rather dirty)
* n is a numerical expression that can have one of these request numbers:
::0 = Whether the pen was drawn since the last function call (-1 yes, 0 no).
::1 = x-coordinate of the last pen press.
::2 = y-coordinate of the last pen press.
::3 = current pen switch status (-1 down, 0 up).
::4 = last known valid x-coordinate.
::5 = last known valid y-coordinate.
::6 = character row of last pen press.
::7 = character column of last pen press.
::8 = character row of last pen position.
::9 = character column of last pen position.
''See also:''
* [[PEN (statement)]], [[ON PEN]]
{{PageNavigation}}

View file

@ -1,25 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
The '''PEN''' statement enables/disables or suspends event trapping of the lightpen device which is seldom used today.
{{PageSyntax}}
:: PEN {ON|STOP|OFF}
''Description:''
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* PEN [[ON]] - enables event trapping (automatically enabled with [[ON PEN]] though)
* PEN [[OFF]] - disables event trapping.
* PEN [[STOP]] - suspends event trapping (use PEN ON to enable it again).
''See also:''
* [[ON PEN]], [[PEN]] (function)
{{PageNavigation}}

View file

@ -1,25 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
'''PLAY(n)''' is a event-trapping function that returns the number of notes currently in the background music queue.
{{PageSyntax}}
:: PLAY(n)
''Description:''
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* n can be any number and is only a dummy.
* If the music is playing in foreground the function will return 0.
''See also:''
* [[ON PLAY(n)]], [[PLAY]]
{{PageNavigation}}

View file

@ -1,83 +0,0 @@
The '''PRINT #''' statement sends QB64 formatted data to an open connection handle.
{{PageSyntax}}
:: PRINT #connection_handle, value
* A handle is opened using the [[_OPENHOST]], [[_OPENCLIENT]] or [[_OPENCONNECTION]] '''QB64''' function returns.
* There is no way to verify that the information has been sent.
* Always check connections to handles before sending data.
==Availability==
* '''Version 0.954 and older'''.
** For version 1.000 and up use [[PUT (TCP/IP statement)]]
:::::'''Communicating using QB64 Formatted messages:'''
* Benefit: QB64 handles sending and receiving data in messages. It knows how long each message is and waits for the full message to arrive, avoiding partial messages which have been fragmented from being returned.
* Disadvantage: Really only useful for communicating with other QB64 programs (or programs aware of QB64's [[TCP/IP Message Format]]).
::::'''See''' [[TCP/IP Message Format]] '''for the QB64 header information'''
:'''NOTE:''' In the following examples 'h' denotes the host's handle, 'c' the client's handle and 'o' as other handles.
''Example 1:'' Host sends one variable value at a time while reading other messages.
{{CodeStart}}
'''PRINT #'''c, a$ ' sends the string a$ (size is known to INPUT #)
'''PRINT #'''c, x% ' if x was equal to 5, this would send ' 5 ' (without the quotes)
{{Cl|INPUT (TCP/IP statement)|INPUT}} #o, a$ ' reads the next available message (if arrived) or sets a$ = ""
{{CodeEnd}}
''Explanation:'' INPUT #o, x% effectively reads the next message, performs the VAL function upon it and stores the result in x% (if any part of this process isn't complete then [[EOF]](o) will return -1.
''Example 2:'' Host sends multiple values using PRINT #.
{{CodeStart}}
'''PRINT #'''c, 3; "Hello "; "World"; ' client sends data
'''PRINT #'''c, "!"
{{CodeEnd}}
''Example 3:'' Client reads host's Example 2 data as one value using [[LEN]].
{{CodeStart}}
t! = {{Cl|TIMER}} + 3
DO
{{Cl|_LIMIT}} 1000 'limits CPU usage
{{Cl|INPUT (TCP/IP statement)|INPUT}} #h, a$
LOOP UNTIL {{Cl|LEN}}(a$) OR TIMER > t!
{{CodeEnd}}
''Explanation:'' The loop runs 3 seconds or until the full data arrives. The value of a$ is " 3 Hello World!" or "" if all 4 messages haven't arrived yet.
''Example 4:'' Client reads host's Example 2 data as one value using [[EOF]].
{{CodeStart}}
t! = {{Cl|TIMER}} + 3
DO
{{Cl|_LIMIT}} 1000 'limits CPU usage
{{Cl|INPUT (TCP/IP statement)|INPUT}} #h, a%,b$,c$,d$ ' reads data from host until EOF(h) = 0
IF TIMER > t! THEN {{Cl|EXIT DO}} ' timeout read if over 3 seconds
LOOP WHILE {{Cl|EOF}}(h)
{{CodeEnd}}
''Explanation:'' EOF returns -1 until all variables have been filled with their appropriate data. The 3 second TIMER loop allows other code execution.
::::::::''See the example in [[_OPENHOST]].''
{{PageSeeAlso}}
* [[INPUT (TCP/IP statement)]], [[PUT (TCP/IP statement)]], [[GET (TCP/IP statement)]]
* [[_OPENHOST]], [[_OPENCLIENT]], [[_OPENCONNECTION]], [[PRINT (file statement)]]
* [[TCP/IP Message Format]]
{{PageNavigation}}

View file

@ -1,75 +0,0 @@
__NOTOC__
QB64 supports several relational operations, which are binary operations that test numeric or string values and return an [[INTEGER]] value representing a boolean ''true'' (<tt>-1</tt>) or ''false'' (<tt>0</tt>) result. These operations are primarily used in expressions where a condition is required, such as the [[IF...THEN]] statement.
==List of relational operations==
The following table describes the relational operations, where <tt>A</tt> is the left-hand side operand, and <tt>B</tt> is the right-hand side operand:
{{RelationalOperationsTable}}
<center>True statements return -1 in [[Boolean]] evaluations. False returns zero.
</center>
==Comparing numerical values and variables==
For numeric operands, such as [[INTEGER]] or [[DOUBLE]] values, the relational operations behave as one would expect. For example, the expression (-3.4 [[Less_Than|<]] 1.2) evaluates to ''true'', and the expression (50 [[Equal|=]] 100) evaluates to ''false''.
''Example:'' When a user enters a value greater than or equal to 5, the boolean statement returns -1 . Zero is printed otherwise.
{{CodeStart}} '' ''
{{Cl|INPUT}} "Enter a value from 1 to 10: ", number
{{Cl|PRINT}} number >= 5 '' ''
{{CodeEnd}}
==Comparing string values and variables==
For string operands, the [[Equal|=]] and [[Not_Equal|<>]] operators test, respectively, if the operands are of the same or differing length, and that each of the corresponding characters match or don't match. For example, the three expressions ("abc" [[Equal|=]] "abc"), ("abc" [[Not_Equal|<>]] "abd") and ("abc" [[Not_Equal|<>]] "abcdef") all evaluate to ''true''.
When two strings are compared, the left string sets the number of characters to evaluate when not checking for equality. The [[Less_Than|<]] and [[Greater_Than|>]] operators find the first set of non-matching characters and test if the [[ASCII]] code values of those characters are less than or greater than each other, respectively. '''Equal strings MUST be of the same length with identical [[UCASE$|cased]] letters or [[ASCII]] characters!'''
If one string is identical to part of the other, [[Less_Than|<]] returns ''false'' if the left-hand side string is shorter than the right-hand side string, while [[Greater_Than|>]] returns ''true'' if the left-hand side string is longer than the right-hand side string. For example, the expressions ("abc" [[Less_Than|<]] "abd") and ("abcdef" [[Greater_Than|>]] "abc") both evaluate to ''true''. Even [[SPACE$|space]] [[ASCII]] character values are evaluated!
''Example:'' Shows that the left hand string sets the number of characters to evaluate when using > or < and are not equal when longer.
{{CodeStart}} '' ''
PRINT "abc" < "abcd"
PRINT "abc" = "abc"
PRINT "abc" = "abcd"
PRINT "abcd" > "abc" '' ''
{{CodeEnd}}
{{OutputStart}} 0
-1
0
-1
{{OutputEnd}}
==Comparing user-defined type variables==
Variables of a [[TYPE|user-defined type]] (UDT) cannot be used as operands to the relational operators, but numeric or string type fields can be used as described above. For example:
:: TYPE T
::: a AS INTEGER
:: END TYPE
:: TYPE U
::: b AS INTEGER
:: END TYPE
:: DIM x AS T : x.a = 10
:: DIM y AS U : y.b = 20
:: PRINT x < y ' <- error: type mismatch
:: PRINT x.a < y.b ' <- outputs "-1"
==Boolean values==
The [[INTEGER]] values for ''true'' and ''false'' are such that the bitwise Logical Operators, such as [[NOT]], [[AND]] and [[OR]] can be used to invert and combine test results. For example, the expression ([[NOT]] (10 [[Greater_Than_Or_Equal|>=]] 20)) evaluates to ''true'', while the expression ((2 [[Less_Than|<]] 1) [[AND]] ("three" [[Equal|=]] "four")) evaluates to ''false''.
{{Template:LogicalTruthTable}}
==See also==
* [[IF...THEN]]
* [[DO...LOOP]], [[WHILE...WEND]]
* [[IS|CASE IS]], [[NOT]]
* [[AND]], [[OR]], [[XOR]], [[EQV]], [[IMP]]
{{PageNavigation}}

File diff suppressed because it is too large Load diff

View file

@ -1,34 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
The '''SETMEM''' function is used to increase, decrease or return the current "far heap" byte size.
{{PageSyntax}}
:: SETMEM(byte_size)
''Description:''
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* SETMEM(0) returns the total number of bytes currently in the far heap memory area.
* The byte size indicates the number of bytes to increase or decrease the far heap.
:* If the byte size is negative, SETMEM decreases the far heap by the indicated number of bytes.
:* If the byte size is positive, SETMEM '''attempts''' to increase the far heap space by the number of bytes.
* If SETMEM cannot change the far heap by the requested number of bytes, it reallocates as many bytes as possible.
* SETMEM can be used in mixed-language programming to decrease the far heap space so procedures in other languages can dynamically allocate far memory.
:'''Note: A first call to SETMEM trying to increase the far heap has no effect because Basic'''
::'''allocates as much memory as possible to the far heap when a program starts.'''
''See also:''
* [[DECLARE (non-BASIC statement)]]
{{PageNavigation}}

View file

@ -1,58 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
The SIGNAL keyword was reserved for OS/2 systems (protected mode). See the example for more information about how and why it is used.
{{PageSyntax}}
:: [[ON]] SIGNAL(number) [[GOSUB]] line
:: SIGNAL(number) [[ON]]
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* It will only work with compiler 6.00 and 6.00b and Basic PDS 7.00 when compiling in protected mode under OS/2. In all other situations, a SIGNAL statement results in an "Advanced feature unavailable" error message.
''Example:''
{{CodeStart}}
'' ''
{{Cl|PRINT}} "This program traps CTRL+BREAK in OS/2. Try it."
{{Cl|ON}} SIGNAL(4) {{Cl|GOSUB}} trap
{{Cl|SIGNAL}}(4) {{Cl|ON}}
10 a$ = {{Cl|INKEY$}}
{{Cl|IF...THEN|IF}} a$ = "" {{Cl|THEN}} {{Cl|GOTO}} 10
{{Cl|END}}
trap:
{{Cl|PRINT}} "CTRL+BREAK trapped. Press any key to quit"
{{Cl|RETURN}} '' ''
{{CodeEnd}}
''Output:'' It returns the following when Ctrl-Break is pressed
{{OutputStart}}
This program traps CTRL+BREAK in OS/2. Try it.
CTRL+BREAK trapped. Press any key to quit
{{OutputEnd}}
''Error message in QB4.5 if not using OS 2:''
{{OutputStart}}
Advanced feature unavailable
{{OutputEnd}}
''Source:'' Microsoft KB41389 [[http://support.microsoft.com/kb/41389]]
''See also:''
* [[ON KEY (n)]]
{{PageNavigation}}

View file

@ -1,114 +0,0 @@
The following Icon creation procedure was adapted from Galleon's [[SAVEIMAGE]] sup-procedure that creates 8 BPP or 32 bit bitmaps:
'''NOTE: QB64 can use .ico files natively for Windows executables with [[$EXEICON]].'''
{{CodeStart}} '' ''
DO
{{Cl|LINE INPUT}} "Use 8 bit(256 colors) or 32 bit image? ", bit$
clrmode% = {{Cl|VAL}}(bit$)
{{Cl|LOOP}} {{Cl|UNTIL}} clrmode% = 8 {{Cl|OR (boolean)|OR}} clrmode% = 32
{{Cl|IF...THEN|IF}} clrmode% = 8 {{Cl|THEN}} clrmode% = 256
{{Cl|LOCATE}} 10, 10: {{Cl|PRINT}} "Do you wish to make black transparent? (Y/N) ";
K$ = {{Cl|INPUT$}}(1): {{Cl|PRINT}} K$
{{Cl|IF...THEN|IF}} {{Cl|UCASE$}}(K$) = "Y" {{Cl|THEN}} mode% = 1
{{Cl|_DELAY}} 1
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 480, clrmode%)
DO
{{Cl|LOCATE}} 10, 10: {{Cl|LINE INPUT}} "Enter the icon size to use(multiple of 16): ", sz$
size& = {{Cl|VAL}}(sz$)
{{Cl|LOOP}} {{Cl|UNTIL}} size& {{Cl|MOD}} 16 = 0 AND size& >= 16 AND size& <= 128
DO
{{Cl|LOCATE}} 10, 10: {{Cl|LINE INPUT}} "Enter the image file name to convert to an icon: ", BMP$
{{Cl|CLS}}
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|_FILEEXISTS}}(BMP$)
img& = {{Cl|_LOADIMAGE}}(BMP$)
{{Cl|IF...THEN|IF}} img& = -1 {{Cl|OR (boolean)|OR}} img& = 0 {{Cl|THEN}} {{Cl|LOCATE}} 15, 25: {{Cl|PRINT}} "Image failed to load!": {{Cl|END}}
{{Cl|IF...THEN|IF}} mode% = 0 THEN {{Cl|CLS}} , {{Cl|_RGB}}(255, 255, 255)
{{Cl|IF...THEN|IF}} clrmode% = 256 {{Cl|THEN}} {{Cl|_COPYPALETTE}} (img&)
{{Cl|_PUTIMAGE}} (0, 0)-(size& - 1, size& - 1), img&, 0 '(31, 31), img&, 0 '<<<<<<<<<<<
{{Cl|LOCATE}} 20, 10: {{Cl|PRINT}} "Do you want to make an icon out of the image? (Y/N) ";
K$ = {{Cl|INPUT$}}(1): {{Cl|PRINT}} K$
{{Cl|IF...THEN|IF}} {{Cl|UCASE$}}(K$) <> "Y" {{Cl|THEN}} {{Cl|END}}
SaveFile$ = {{Cl|LEFT$}}(BMP$, {{Cl|INSTR}}(BMP$, ".")) + "ico"
SaveIcon32 img&, size&, mode%, SaveFile$
{{Cl|END}}
' ---------------------------------------------------------
{{Cl|SUB}} SaveIcon32 (image {{Cl|AS}} {{Cl|LONG}}, size {{Cl|AS}} {{Cl|LONG}}, mode AS {{Cl|INTEGER}}, filename {{Cl|AS}} {{Cl|STRING}})
bytesperpixel& = {{Cl|_PIXELSIZE}}(image&)
{{Cl|IF...THEN|IF}} bytesperpixel& = 0 {{Cl|THEN}} {{Cl|PRINT}} "Text modes unsupported!": {{Cl|END}}
{{Cl|IF...THEN|IF}} bytesperpixel& = 1 {{Cl|THEN}} bpp& = 8 {{Cl|ELSE}} bpp& = 24 '256 or 32 bit color
{{Cl|IF...THEN|IF}} size& {{Cl|MOD}} 16 {{Cl|OR}} size& < 16 {{Cl|OR}} size& > 128 THEN {{Cl|PRINT}} "Size not supported!": {{Cl|END}}
x& = size& 'supports sizes from 16 to 128 only!
y& = size&
'Headers: icon count width depth colors cursor hotspots size - offset
b$= {{Cl|MKI$}}(0)+{{Cl|MKI$}}(1)+{{Cl|MKI$}}(1)+{{Cl|CHR$}}(x&)+{{Cl|CHR$}}(y&)+{{Cl|CHR$}}(0)+{{Cl|CHR$}}(0)+{{Cl|MKI$}}(0)+{{Cl|MKI$}}(0)+"????"+{{Cl|MKL$}}(22) _
+{{Cl|MKL$}}(40)+{{Cl|MKL$}}(x&)+{{Cl|MKL$}}(2 * y&)+{{Cl|MKI$}}(1)+{{Cl|MKI$}}(bpp&)+{{Cl|MKL$}}(0)+"????" + {{Cl|STRING$}}(16, 0)
'BMP size width double height plane BPP raw size
{{Cl|IF...THEN|IF}} bytesperpixel& = 1 {{Cl|THEN}}
{{Cl|FOR...NEXT|FOR}} c& = 0 {{Cl|TO}} 255 ' read BGR color settings from image + 1 byte spacer({{Cl|CHR$}}(0))
cv& = {{Cl|_PALETTECOLOR (function)|_PALETTECOLOR}}(c&, image&) ' color attribute to read.
b$ = b$ + {{Cl|CHR$}}({{Cl|_BLUE32}}(cv&)) + {{Cl|CHR$}}({{Cl|_GREEN32}}(cv&)) + {{Cl|CHR$}}({{Cl|_RED32}}(cv&)) + {{Cl|CHR$}}(0) 'spacer
{{Cl|NEXT}}
{{Cl|END IF}}
lastsource& = {{Cl|_SOURCE}}
{{Cl|_SOURCE}} 0 'set source as program screen. Do NOT use loaded image handle as size has changed!
{{Cl|IF...THEN|IF}} ((x& * 3) {{Cl|MOD}} 4) {{Cl|THEN}} padder$ = {{Cl|STRING$}}(4 - ((x& * 3) {{Cl|MOD}} 4), 0)
{{Cl|FOR...NEXT|FOR}} py& = y& - 1 {{Cl|TO}} 0 {{Cl|STEP}} -1 ' read target image pixel color data
r$ = ""
{{Cl|FOR...NEXT|FOR}} px& = 0 {{Cl|TO}} x& - 1
c& = {{Cl|POINT}}(px&, py&)
{{Cl|IF...THEN|IF}} bytesperpixel& = 1 {{Cl|THEN}} r$ = r$ + {{Cl|CHR$}}(c&) {{Cl|ELSE}} r$ = r$ + {{Cl|LEFT$}}({{Cl|MKL$}}(c&), 3)
{{Cl|NEXT}} px&
d$ = d$ + r$ + padder$
{{Cl|NEXT}} py&
{{Cl|IF...THEN|IF}} (x& {{Cl|MOD}} 32) {{Cl|THEN}} bitpad& = 32 - (x& {{Cl|MOD}} 32) 'padder bits when not multiples of 32
{{Cl|IF...THEN|IF}} mode% {{Cl|THEN}} 'make black pixels white in AND mask so they become transparent
{{Cl|FOR...NEXT|FOR}} py& = y& - 1 {{Cl|TO}} 0 {{Cl|STEP}} -1 'read image to find black pixels
px& = 0
{{Cl|DO...LOOP|DO}}: byte% = 0
{{Cl|FOR...NEXT|FOR}} bit% = 7 {{Cl|TO}} 0 {{Cl|STEP}} -1 'change transparent color to suit your needs
byte% = 2 * byte% - ({{Cl|POINT}}(px&, py&) = {{Cl|_RGB}}(0, 0, 0)) 'bitpacking adds 1 when true
px& = px& + 1
{{Cl|NEXT}}
a$ = a$ + {{Cl|CHR$}}(byte%)
{{Cl|LOOP}} {{Cl|WHILE}} px& < x& - 1
{{Cl|IF...THEN|IF}} bitpad& {{Cl|THEN}} a$ = a$ + {{Cl|STRING$}}((bitpad& + 7) \ 8, 0) 'add padder at end of row when necessary
{{Cl|NEXT}}
{{Cl|ELSE}} a$ = {{Cl|STRING$}}(y& * ((x& + bitpad& + 7) \ 8), 0) 'totally black {{Cl|AND (boolean)|AND}} mask
{{Cl|END IF}}
d$ = d$ + a$
{{Cl|_SOURCE}} lastsource&
{{Cl|MID$}}(b$, 43, 4) = {{Cl|MKL$}}({{Cl|LEN}}(d$)) 'raw image size with {{Cl|AND}} mask
b$ = b$ + d$ ' total file data bytes to create file
{{Cl|MID$}}(b$, 15, 4) = {{Cl|MKL$}}({{Cl|LEN}}(b$) - 22) ' size of data file minus Entry header offset
{{Cl|IF...THEN|IF}} {{Cl|LCASE$}}({{Cl|RIGHT$}}(filename$, 4)) <> ".ico" {{Cl|THEN}} ext$ = ".ico"
f& = {{Cl|FREEFILE}}
{{Cl|OPEN}} filename$ + ext$ {{Cl|FOR...NEXT|FOR}} {{Cl|OUTPUT}} {{Cl|AS}} #f&: {{Cl|CLOSE}} #f& ' erases an existing file
{{Cl|OPEN}} filename$ + ext$ {{Cl|FOR...NEXT|FOR}} {{Cl|BINARY}} {{Cl|AS}} #f&
{{Cl|PUT}} #f&, , b$
{{Cl|CLOSE}} #f&
{{Cl|END SUB}} '' ''
{{CodeEnd}}
{{small|Code by Ted Weissgerber}}
:''Explanation:'' The icons created can have a full black [[AND]] mask for a solid square image when mode% is zero. If mode% is a value other than 0, the AND mask routine looks for black pixels and sets the background pixel on for transparency. Icons with dimensions that are not a multiple of 32 would require padding. In the header, ???? is later replaced with size data. If the image is 24/32 BPP, the size of the [[XOR]] image data will triple because each pixel uses 3 bytes for red, green and blue values up to 255.
:{{text|To create '''.CUR''' cursor files change the second value from 1 to 2 and set the 2 cursor click hotspot offset [[INTEGER]] values.|purple}}
:Icons that are 16 X 16 or 48 X 48 require 2 padder bytes to be added at the end of each row increasing data size by 32 and 96.
''See also:''
*[[_ICON]], [[$EXEICON]]
*[[SAVEIMAGE]]
*[[Icons and Cursors]]
*[[Resource Table extraction|Resource Extraction]]
*[[Bitmaps]]
*[[GIF Images]]
{{PageNavigation}}

View file

@ -1,19 +0,0 @@
The '''TIME$''' statement changes the computer clock time to another [[STRING]] value .
{{PageSyntax}}
:: TIME$ = "12:23:33"
* The string value or variable must have the value formatted correctly.
* The seconds value can be omitted and one colon can be used.
* The [[TIME$]] function can preserve the original time to reset later.
* [[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Keyword Not Supported in Linux or MAC versions]]
''See also:''
* [[TIME$]], [[DATE$]]
{{PageNavigation}}

View file

@ -1,40 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
The {{KW|TROFF}} statement turns off line number tracing.
{{PageSyntax}}
:<code>{{KW|TROFF}}</code>
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* When line number tracing is on, the line numbers of statements are output immediately before they are executed.
* Use {{KW|TRON}} to turn on line number tracing.
* Line number tracing only has an effect when programs are compiled with debugging code (BC.EXE /D).
{{PageExamples}}
:Demonstrates simple line number tracing:
{{CodeStart}}1 {{Cl|TRON}}
2 {{Cl|FOR...NEXT|FOR}} n% = 1 {{Cl|TO}} 3
3 {{Cl|PRINT}} "inside loop"
4 {{Cl|FOR...NEXT|NEXT}} n%
5 {{Cl|TROFF}}
{{CodeEnd}}
{{OutputStart}}[2][3]inside loop
[4][3]inside loop
[4][3]inside loop
[4][5]
{{OutputEnd}}
{{PageSeeAlso}}
* {{KW|TRON}}
{{PageNavigation}}

View file

@ -1,40 +0,0 @@
''This page is maintained for historic purposes. The keyword is not supported in QB64.''
----
The {{KW|TRON}} statement turns on line number tracing.
{{PageSyntax}}
:<code>{{KW|TRON}}</code>
{{PageDescription}}
*'''[[Keywords currently not supported by QB64|Not supported in QB64.]]'''
* When line number tracing is on, the line numbers of statements are output immediately before they are executed.
* Use {{KW|TROFF}} to turn off line number tracing.
* Line number tracing only has an effect when programs are compiled with debugging code (<tt>BC.EXE /D</tt>).
{{PageExamples}}
:Demonstrates simple line number tracing:
{{CodeStart}}1 {{Cl|TRON}}
2 {{Cl|FOR...NEXT|FOR}} n% = 1 {{Cl|TO}} 3
3 {{Cl|PRINT}} "inside loop"
4 {{Cl|FOR...NEXT|NEXT}} n%
5 {{Cl|TROFF}}
{{CodeEnd}}
{{OutputStart}}[2][3]inside loop
[4][3]inside loop
[4][3]inside loop
[4][5]
{{OutputEnd}}
{{PageSeeAlso}}
* {{KW|TROFF}}
{{PageNavigation}}

View file

@ -1,20 +0,0 @@
The '''UEVENT''' Statement uses ON, OFF or STOP to enable, turn off or suspend user event trapping.
{{PageSyntax}}
:::UEVENT {ON|STOP|OFF}
*'''[[Keywords currently not supported by QB64|Currently NOT supported in QB64!]]'''
* UEVENT ON enables user defined event-trapping as defined by the [[ON UEVENT]] statement.
* UEVENT OFF disables the event-trapping routine. All events are ignored and are not remembered.
* UEVENT STOP suspends the event-trapping routine. An event is remembered, and the event-trapping routine will be performed as soon as a UEVENT ON statement re-enables the trapping.
''See also:''
* [[ON UEVENT]]
{{PageNavigation}}

View file

@ -1,77 +0,0 @@
A '''variable''' is a named "container" that can hold a numerical or string value and which can be referenced or changed by the program (as opposed to [[CONST]]ant values which never change).
<center>'''Variable names'''</center>
Variables in QB64 can be any name except the names of QB64 or QBasic keywords and may not contain spaces or non-alphabetical/non-numerical characters (except "." and "_"). Numerical characters cannot be used as the first character of a variable or array name. QB64 reserves the use of a single leading underscore for QB64 procedural or variable type names.
Variable values can be passed to sub-procedures by using the name as a [[SUB]] or [[FUNCTION]] parameter in a [[CALL]]. Variable names in the main program module can be passed to sub-procedures by using [[DIM]] [[SHARED]] without using them as [[CALL]] parameters.
Variable names dimensioned in [[SUB]] or [[FUNCTION]] procedures can be the same as names used in the main procedure and can hold different values. [[SHARED]] sub-procedure variables can only be shared with the main program module!
Dot variable names are normally used with [[TYPE]] variable definitions. The first name before the dot is the name of the variable [[DIM|dimensioned]] [[AS]] the type. The name after the dot is the name of the variable assigned inside of the [[TYPE]].
<center>'''Variable types'''</center>
Variables can be defined as a specific type using a variable type suffix or by using a [[DIM]] or [[REDIM]](for dynamic arrays only) statement [[AS]] a variable type of [[_BIT]], [[_BYTE]], [[INTEGER]], [[LONG]], [[SINGLE]], [[DOUBLE]], [[_INTEGER64]], [[_FLOAT]] or [[STRING]] in QB64.
Groups of variable names can be type defined by the first letter or list of letters of the names using [[DEFINT]], [[DEFLNG]], [[DEFSNG]], [[DEFDBL]], [[DEFSTR]] or [[_DEFINE]] [[AS]] in QB64.
[[$DYNAMIC]] arrays can be resized and can retain their remaining element values when used with [[REDIM]] [[_PRESERVE]] in QB64. [[ERASE]] or [[CLEAR]] removes the array entirely from memory!
[[$STATIC]] arrays cannot be resized, but cannot be removed either. [[ERASE]] or [[CLEAR]] will clear the array element values only!
<center>'''Variable values'''</center>
Variables are initialized to empty values (0 for numerical values, and "" for strings) at the start of a program, or when first referenced inside of a [[SUB]] or [[FUNCTION]] call.
[[STATIC]] variables are also initialized to empty values, however, STATIC variables will retain their values in between SUB or FUNCTION calls, and exist for the life of the program.
[[Arrays]] variable names can hold many values in one variable name by specifying a reference index enclosed in parentheses.
Variables are used to hold program data information that is attained through the program flow, either by user input, calculations or by other ways of communicaton (as with I/O, memory, TCP/IP or files).
Assignment of variable values can be done using the = assignment symbol (variable1.number = 500, for example).
To pass variable values to a sub-procedure without altering or affecting the variable name's value, parenthesis can be used around the variable name in the [[CALL]].
{{PageExamples}}
''Example of different usages of variables:''
{{CodeStart}}
max = 1000
{{Cl|DIM}} d(max)
{{Cl|FOR...NEXT|FOR}} c = 1 {{Cl|TO}} max
d(c) = c + d(c - 1)
{{Cl|NEXT}}
{{Cl|PRINT}} "Show the result of the addition from 1 to n (1+2+3...+n)"
{{Cl|PRINT}} "n = (0-" + {{Cl|LTRIM$}}({{Cl|STR$}}(max)) + "): ";
{{Cl|INPUT}} "", n
{{Cl|IF...THEN|IF}} n <= max {{Cl|AND (boolean)|AND}} n >= 0 {{Cl|THEN}} {{Cl|PRINT}} d(n) {{Cl|ELSE}} {{Cl|PRINT}} "Invalid value (only 0 to" + {{Cl|STR$}}(max) + " is permitted)."
{{CodeEnd}}
{{OutputStart}}
Show the result of the addition from 1 to n (1+2+3...+n)
n = (1-1000): 10
55
{{OutputEnd}}
{{PageSeeAlso}}
* [[Argument]], [[Expression]], [[Arrays]]
{{PageNavigation}}

View file

@ -1,39 +0,0 @@
'''QB64 uses more variable types than QBasic ever did. The variable type determines the size of values that numerical variables can hold.'''
{{DataTypeTable}}
If no suffix is used and no DEFxxx or _DEFINE command has been used and the variable hasn't been [[DIM]]med the '''default variable type is [[SINGLE]]'''. '''[[_MEM]] and [[_OFFSET]] variable types cannot be cast to other variable types!'''
All types dealing with number values are signed as a default. The symbol to define unsigned variables is ~ and is used just before the type suffix (~` is [[_UNSIGNED]] _BIT, ~%% is [[_UNSIGNED]] _BYTE, etc.).
<center>'''[[SINGLE]], [[DOUBLE]] and [[_FLOAT]] floating decimal point values cannot be [[_UNSIGNED]]!'''</center>
'''Defining variable types:'''
: [[DIM]] ''variable'' [[AS]] ''type''
: [[_DEFINE]] ''range1-range2'' [[AS]] ''value_type''
: [[DEFINT]] ''range1-range2''
: [[DEFLNG]] ''range1-range2''
: [[DEFSNG]] ''range1-range2''
: [[DEFDBL]] ''range1-range2''
Where ''range1'' and ''range2'' are the range of first letters to be defined as the default ''type'' when the variable is having no suffix and are not otherwise defined, the starting letter of the variable then defines the ''type'' as specified by the DEFxxx and _DEFINE statements. The QB64 types can only be defaulted using [[_DEFINE]].
''type'' can be any of the types listed at the top and can also be preceeded with [[_UNSIGNED]] for the unsigned version of the type.
''variable'' is the name of the variable to be defined in the DIM statement.
'''More information:'''
More information on this page: [[Data types]]
{{PageNavigation}}

View file

@ -1,45 +0,0 @@
{{DISPLAYTITLE:_CONNECTIONADDRESS}}
The [[_CONNECTIONADDRESS]] function returns a connected user's [[STRING]] IP address value.
{{PageSyntax}}
:{{Parameter|result$}} = [[_CONNECTIONADDRESS|_CONNECTIONADDRESS[$]]]({{Parameter|connectionHandle&}})
{{PageDescription}}
* The handle can come from the [[_OPENHOST]], [[OPENCLIENT]] or [[_OPENCONNECTION]] QB64 TCP/IP functions.
* For '''[[_OPENHOST|HOST]]s''': It may return "TCP/IP:8080:213.23.32.5" where 8080 is the port it is listening on and 213.23.32.5 is the global IP address which any computer connected to the internet could use to locate your computer. If a connection to the internet is unavailable or your firewall blocks it, it returns your 'local IP' address (127.0.0.1). You might like to store this address somewhere where other computers can find it and connect to your host. Dynamic IPs which can change will need to be updated.
* For '''[[_OPENCLIENT|CLIENT]]s''': It may return "TCP/IP:8080:213.23.32.5" where 8080 is the port it used to connect to the listening host and 213.23.32.5 is the IP address of the host name it resolved.
* For '''[[_OPENCONNECTION|CONNECTION]]s''' (from clients): It may return "TCP/IP:8080:34.232.321.25" where 8080 was the host listening port it connected to and 34.232.321.25 is the IP address of the client that connected. This is very useful because the host can log the IP address of clients for future reference (or banning, for example).
* The $ sygil is optional for compatibility with older versions.
{{PageExamples}}
''Example:'' A Host logging new chat clients in a Chat program. See the [[_OPENHOST]] example for the rest of the code used.
{{CodeStart}} '' ''
f = {{Cl|FREEFILE}}
{{Cl|OPEN}} "ChatLog.dat" {{Cl|FOR}} {{Cl|APPEND}} {{Cl|AS}} #f ' code at start of host section before DO loop.
newclient = {{Cl|_OPENCONNECTION}}(host) ' receive any new client connection handles
{{Cl|IF...THEN|IF}} newclient {{Cl|THEN}}
numclients = numclients + 1 ' increment index
Users(numclients) = newclient ' place handle into array
IP$ = {{Cl|_CONNECTIONADDRESS}}(newclient)
{{Cl|PRINT}} IP$ + " has joined." ' displayed to Host only
{{Cl|PRINT (file statement)|PRINT #f}}, IP$, numclients ' print info to a log file
{{Cl|PRINT (file statement)|PRINT #}}Users(numclients),"Welcome!" ' from Host to new clients only
{{Cl|END IF}} '' ''
{{CodeEnd}}
: ''Explanation:'' The function returns the new client's IP address to the IP$ variable. Prints the IP and the original login position to a log file. The information can later be used by the host for referance if necessary. The host could set up a ban list too.
{{PageSeeAlso}}
* [[_OPENCONNECTION]]
* [[_OPENHOST]]
* [[_OPENCLIENT]]
* [[_CONNECTED]]
{{PageNavigation}}

View file

@ -1,48 +0,0 @@
{{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 '''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.
==Example==
{{CodeStart}} '' ''
{{Cl|DIM}} allowGL {{Cl|AS}} {{Cl|_BYTE}}
'perform startup routines like loading assets
allowGL = -1 'sets allowGL to true so SUB _GL can run
{{Cl|DO}}
{{Cl|_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.
{{Cl|LOOP}}
{{Cl|SUB}} {{Cl|_GL}}
{{Cl|IF}} NOT allowGL {{Cl|THEN}} {{Cl|EXIT}} {{Cl|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
{{Cl|END}} {{Cl|SUB}} '' ''
{{CodeEnd}}
{{PageSeeAlso}}
* [[http://www.qb64.org/wiki/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.''
* [[SUB]]
{{PageNavigation}}

View file

@ -1,19 +0,0 @@
{{DISPLAYTITLE:_GLRENDER}}
{{PageSyntax}}
:'''_GLRENDER '''''mode''
{{PageParameters}}
Mode can be:
* _BEHIND - renders OpenGL context behind the software rendering
* _ONTOP - renders OpenGL context on the top of the software rendering [default]
* _ONLY - renders OpenGL context only
''See also:''
* [[Hardware images]]
{{PageNavigation}}

View file

@ -1,102 +0,0 @@
{{DISPLAYTITLE: _MOUSEPIPEOPEN}}
The [[_MOUSEPIPEOPEN]] function creates a pipe handle value for a mouse when using a virtual keyboard.
{{PageSyntax}}
: vkMousePipe = [[_MOUSEPIPEOPEN]]
{{PageDescription}}
* The pipe handle value can be used optionally with [[_MOUSEINPUT]], [[_MOUSEX]], [[_MOUSEY]], and [[_MOUSEBUTTON]] when required.
{{PageExamples}}
''Snippet:'' The following snippet isn't runnable/compilable, but it showcases the use of the [[_MOUSEPIPEOPEN]] function.
{{CodeStart}}
mDown = 0
mUp = 0
mEvent = 0
{{Cl|IF...THEN|IF}} VkMousePipe = 0 {{Cl|THEN}}
VkMousePipe = {{Cl|_MOUSEPIPEOPEN}} 'create new pipe
{{Cl|END IF}}
{{Cl|DO...LOOP|DO}} {{Cl|WHILE}} {{Cl|_MOUSEINPUT}}(VkMousePipe)
mb = {{Cl|_MOUSEBUTTON}}(1, VkMousePipe)
mx = {{Cl|_MOUSEX}}(VkMousePipe)
my = {{Cl|_MOUSEY}}(VkMousePipe)
{{Cl|IF...THEN|IF}} {{Cl|_PIXELSIZE}} = 0 {{Cl|THEN}} 'screen 0 adjustment
mx = mx * 8 - 4
my = my * 16 - 8
{{Cl|END IF}}
{{Cl|IF...THEN|IF}} mb = -1 {{Cl|AND (boolean)|AND}} omb = 0 {{Cl|THEN}} mDown = -1: mEvent = 1: {{Cl|EXIT DO}}
if VkMousePipeCapture=0 then
{{Cl|_MOUSEINPUTPIPE}} VkMousePipe
end if
{{Cl|IF...THEN|IF}} mb = 0 {{Cl|AND (boolean)|AND}} omb = -1 {{Cl|THEN}}
VkMousePipeCapture=0
mUp = -1
mEvent = 1
{{Cl|EXIT DO}}
end if
{{Cl|LOOP}}
omb = mb
rootId = VkByRole("ROOT")
editMode = VK(rootId).locked
{{Cl|IF...THEN|IF}} mDown {{Cl|THEN}}
mDownX = mx
mDownY = my
i2 = 0
{{Cl|FOR...NEXT|FOR}} internal = 1 {{Cl|TO}} 0 {{Cl|STEP}} -1
{{Cl|FOR...NEXT|FOR}} i = VkLast {{Cl|TO}} 1 {{Cl|STEP}} -1
{{Cl|IF...THEN|IF}} VK(i).active {{Cl|THEN}}
{{Cl|IF...THEN|IF}} VK(i).internal = internal {{Cl|THEN}}
x = VK(i).x * VkUnitSize
y = VK(i).y * VkUnitSize
w = VK(i).w
h = VK(i).h
x1 = {{Cl|INT}}(x)
x2 = {{Cl|INT}}(x + VkUnitSize * w) - 1
y1 = sy - 1 - {{Cl|INT}}(y)
y2 = sy - 1 - {{Cl|INT}}(y + VkUnitSize * h) + 1
{{Cl|IF...THEN|IF}} mx >= x1 {{Cl|AND (boolean)|AND}} mx <= x2 {{Cl|AND (boolean)|AND}} my >= y2 {{Cl|AND (boolean)|AND}} my <= y1 {{Cl|THEN}}
i2 = i
{{Cl|EXIT}} {{Cl|FOR...NEXT|FOR}}
{{Cl|END IF}}
{{Cl|END IF}}
{{Cl|END IF}}
{{Cl|NEXT}}
{{Cl|IF...THEN|IF}} i2 {{Cl|THEN}} {{Cl|EXIT}} {{Cl|FOR...NEXT|FOR}}
{{Cl|NEXT}}
{{Cl|IF...THEN|IF}} i2 {{Cl|THEN}}
VkI = i2
VKoldX = VK(i2).x
VKoldY = VK(i2).y
VKdragging = 0
VKstart = {{Cl|TIMER (statement)|TIMER}}(0.001)
'VK(i2).held = -1
VkKeyDown i2
VkMousePipeCapture=1
{{Cl|END IF}}
IF VkMousePipeCapture = 0 THEN {{Cl|_MOUSEINPUTPIPE}} VkMousePipe
{{Cl|END}} I
{{TextEnd}}
: When using the [[$VIRTUALKEYBOARD|virtual keyboard]], the keyboard captures mouse input appropriately whilst selectively letting presses originating on non-key areas of the screen filter through to the default mouse queue.
{{PageSeeAlso}}
* [[$VIRTUALKEYBOARD]]
{{PageNavigation}}

View file

@ -1,57 +0,0 @@
'''_glBindTexture:''' bind a named texture to a texturing target
{{PageSyntax}}
:: SUB '''_glBindTexture''' (BYVAL target AS _UNSIGNED LONG, BYVAL texture AS _UNSIGNED LONG)
:: void '''_glBindTexture'''(GLenum {{Parameter|target}}, GLuint {{Parameter|texture}});
; target
: Specifies the target to which the texture is bound. Must be either {{KW|_GL_TEXTURE_1D}}, {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_3D}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_2D_ARRAY}}, {{KW|_GL_TEXTURE_RECTANGLE}}, {{KW|_GL_TEXTURE_CUBE_MAP}}, {{KW|_GL_TEXTURE_2D_MULTISAMPLE}}, {{KW|_GL_TEXTURE_2D_MULTISAMPLE_ARRAY}}, {{KW|_GL_TEXTURE_BUFFER}}, or {{KW|_GL_TEXTURE_CUBE_MAP_ARRAY}}.
; texture
: Specifies the name of a texture.
{{PageDescription}}
'''_glBindTexture''' lets you create or use a named texture. Calling '''_glBindTexture''' with {{Parameter|target}} set to {{KW|_GL_TEXTURE_1D}}, {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_3D}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_2D_ARRAY}}, {{KW|_GL_TEXTURE_RECTANGLE}}, {{KW|_GL_TEXTURE_CUBE_MAP}}, {{KW|_GL_TEXTURE_2D_MULTISAMPLE}} or {{KW|_GL_TEXTURE_2D_MULTISAMPLE_ARRAY}} and {{Parameter|texture}} set to the name of the new texture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.
Texture names are unsigned integers. The value zero is reserved to represent the default texture for each texture target. Texture names and the corresponding texture contents are local to the shared object space of the current GL rendering context; two rendering contexts share texture names only if they explicitly enable sharing between contexts through the appropriate GL windows interfaces functions.
You must use {{KW|_glGenTextures}} to generate a set of new texture names.
When a texture is first bound, it assumes the specified target: A texture first bound to {{KW|_GL_TEXTURE_1D}} becomes one-dimensional texture, a texture first bound to {{KW|_GL_TEXTURE_2D}} becomes two-dimensional texture, a texture first bound to {{KW|_GL_TEXTURE_3D}} becomes three-dimensional texture, a texture first bound to {{KW|_GL_TEXTURE_1D_ARRAY}} becomes one-dimensional array texture, a texture first bound to {{KW|_GL_TEXTURE_2D_ARRAY}} becomes two-dimensional arary texture, a texture first bound to {{KW|_GL_TEXTURE_RECTANGLE}} becomes rectangle texture, a, texture first bound to {{KW|_GL_TEXTURE_CUBE_MAP}} becomes a cube-mapped texture, a texture first bound to {{KW|_GL_TEXTURE_2D_MULTISAMPLE}} becomes a two-dimensional multisampled texture, and a texture first bound to {{KW|_GL_TEXTURE_2D_MULTISAMPLE_ARRAY}} becomes a two-dimensional multisampled array texture. The state of a one-dimensional texture immediately after it is first bound is equivalent to the state of the default {{KW|_GL_TEXTURE_1D}} at GL initialization, and similarly for the other texture types.
While a texture is bound, GL operations on the target to which it is bound affect the bound texture, and queries of the target to which it is bound return state from the bound texture. In effect, the texture targets become aliases for the textures currently bound to them, and the texture name zero refers to the default textures that were bound to them at initialization.
A texture binding created with '''_glBindTexture''' remains active until a different texture is bound to the same target, or until the bound texture is deleted with {{KW|_glDeleteTextures}}.
Once created, a named texture may be re-bound to its same original target as often as needed. It is usually much faster to use '''_glBindTexture''' to bind an existing named texture to one of the texture targets than it is to reload the texture image using {{KW|_glTexImage1D}}, {{KW|_glTexImage2D}}, {{KW|_glTexImage3D}} or another similar function.
{{PageNotes}}
The {{KW|_GL_TEXTURE_2D_MULTISAMPLE}} and {{KW|_GL_TEXTURE_2D_MULTISAMPLE_ARRAY}} targets are available only if the GL version is 3.2 or higher.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}} is not one of the allowable values.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|target}} is not a name returned from a previous call to {{KW|_glGenTextures}}.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|texture}} was previously created with a target that doesn't match that of {{Parameter|target}}.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_TEXTURE_BINDING_1D}}, {{KW|_GL_TEXTURE_BINDING_2D}}, {{KW|_GL_TEXTURE_BINDING_3D}}, {{KW|_GL_TEXTURE_BINDING_1D_ARRAY}}, {{KW|_GL_TEXTURE_BINDING_2D_ARRAY}}, {{KW|_GL_TEXTURE_BINDING_RECTANGLE}}, {{KW|_GL_TEXTURE_BINDING_2D_MULTISAMPLE}}, or {{KW|_GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY}}.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glDeleteTextures}}, {{KW|_glGenTextures}}, {{KW|_glGetTexParameter}}, {{KW|_glIsTexture}}, {{KW|_glTexParameter}}
{{PageCopyright}}

View file

@ -1,56 +0,0 @@
'''_glClear:''' clear buffers to preset values
{{PageSyntax}}
:: [[SUB]] _glClear ([[BYVAL]] mask AS [[_UNSIGNED]] [[LONG]])
:: void '''_glClear'''(GLbitfield {{Parameter|mask}});
{{PageParameters}}
* ''mask'' that indicate the buffer [[OR]] buffers to be cleared. The three masks are [[_GL_COLOR_BUFFER_BIT]], [[_GL_DEPTH_BUFFER_BIT]], and [[_GL_STENCIL_BUFFER_BIT]].
{{PageDescription}}
* [[_glClear]] sets the bitplane area of the window to values previously selected by [[_glClearColor]], [[glClearDepth]], and [[_glClearStencil]].
* Multiple color buffers can be cleared simultaneously by selecting more than one buffer at a time using [[_glDrawBuffer]].
* The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of [[_glClear]]. The scissor box bounds the cleared region. Alpha function, blend function, logical operation, stenciling, texture mapping, and depth-buffering are ignored by [[_glClear]].
* [[_glClear]] takes a single argument that is the bitwise OR of several values indicating which buffer is to be cleared. The values are as follows:
::: [[_GL_COLOR_BUFFER_BIT]]: Indicates the buffers currently enabled for color writing.
::: [[_GL_DEPTH_BUFFER_BIT]]: Indicates the depth buffer.
::: [[_GL_STENCIL_BUFFER_BIT]]: Indicates the stencil buffer.
* The value to which each buffer is cleared depends on the setting of the clear value for that buffer.
{{PageNotes}}
If a buffer is not present, then a '''_glClear''' directed at that buffer has no effect.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if any bit other than the three defined bits is set in {{Parameter|mask}}.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_DEPTH_CLEAR_VALUE}}
{{KW|_glGet}} with argument {{KW|_GL_COLOR_CLEAR_VALUE}}
{{KW|_glGet}} with argument {{KW|_GL_STENCIL_CLEAR_VALUE}}
{{PageSeeAlso}}
* [[_GL]]
* [[_glClearBuffer]], [[_glClearColor]], [[_glClearDepth]], [[_glClearStencil]]
* [[_glColorMask]], [[_glDepthMask]], [[_glStencilMask]]
* [[_glDrawBuffer]], [[_glDrawBuffers]]
* [[_glScissor]]
{{PageCopyright}}

View file

@ -1,34 +0,0 @@
'''_glClearColor:''' specify clear values for the color buffers
{{PageSyntax}}
:: SUB '''_glClearColor''' (BYVAL red AS SINGLE, BYVAL green AS SINGLE, BYVAL blue AS SINGLE, BYVAL alpha AS SINGLE)
:: void '''_glClearColor'''(GLfloat {{Parameter|red}}, GLfloat {{Parameter|green}}, GLfloat {{Parameter|blue}}, GLfloat {{Parameter|alpha}});
; red, green, blue, alpha
: Specify the red, green, blue, and alpha values used when the color buffers are cleared. The initial values are all 0.
{{PageDescription}}
'''_glClearColor''' specifies the red, green, blue, and alpha values used by {{KW|_glClear}} to clear the color buffers.
{{PageNotes}}
The type of the {{Parameter|red}}, {{Parameter|green}}, {{Parameter|blue}}, and {{Parameter|alpha}} parameters was changed from GLclampf to GLfloat. This change is transparent to user code.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_COLOR_CLEAR_VALUE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glClear}}
{{PageCopyright}}

View file

@ -1,34 +0,0 @@
'''_glClearDepth:''' specify the clear value for the depth buffer
{{PageSyntax}}
:: SUB _glClearDepth (BYVAL depth AS DOUBLE)
:: void '''_glClearDepth'''(GLdouble {{Parameter|depth}});
:: void '''_glClearDepthf'''(GLfloat {{Parameter|depth}});
; depth
: Specifies the depth value used when the depth buffer is cleared. The initial value is 1.
{{PageDescription}}
'''_glClearDepth''' specifies the depth value used by {{KW|_glClear}} to clear the depth buffer. Values specified by '''_glClearDepth''' are clamped to the range [0, 1].
{{PageNotes}}
The type of the {{Parameter|depth}} parameter was changed from GLclampf to GLfloat for '''_glClearDepthf''' and from GLclampd to GLdouble for '''_glClearDepth'''. This change is transparent to user code.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_DEPTH_CLEAR_VALUE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glClear}}
{{PageCopyright}}

View file

@ -1,32 +0,0 @@
'''_glClearStencil:''' specify the clear value for the stencil buffer
{{PageSyntax}}
:: SUB _glClearStencil (BYVAL s AS LONG)
:: void '''_glClearStencil'''(GLint {{Parameter|s}});
; s
: Specifies the index used when the stencil buffer is cleared. The initial value is 0.
{{PageDescription}}
'''_glClearStencil''' specifies the index used by {{KW|_glClear}} to clear the stencil buffer. {{Parameter|s}} is masked with 2<sup>m</sup> - 1, where m is the number of bits in the stencil buffer.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_STENCIL_CLEAR_VALUE}}
{{KW|_glGet}} with argument {{KW|_GL_STENCIL_BITS}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glClear}}
{{PageCopyright}}

View file

@ -1,40 +0,0 @@
'''_glColorMask, glColorMaski:''' enable and disable writing of frame buffer color components
{{PageSyntax}}
:: SUB _glColorMask (BYVAL red AS _UNSIGNED _BYTE, BYVAL green AS _UNSIGNED _BYTE, BYVAL blue AS _UNSIGNED _BYTE, BYVAL alpha AS _UNSIGNED _BYTE)
:: void '''_glColorMask'''(GLboolean {{Parameter|red}}, GLboolean {{Parameter|green}}, GLboolean {{Parameter|blue}}, GLboolean {{Parameter|alpha}});
:: void '''_glColorMaski'''(GLuint {{Parameter|buf}}, GLboolean {{Parameter|red}}, GLboolean {{Parameter|green}}, GLboolean {{Parameter|blue}}, GLboolean {{Parameter|alpha}});
; buf
: For '''_glColorMaski''', specifies the index of the draw buffer whose color mask to set.
; red, green, blue, alpha
: Specify whether red, green, blue, and alpha are to be written into the frame buffer. The initial values are all {{KW|_GL_TRUE}}, indicating that the color components are written.
{{PageDescription}}
'''_glColorMask''' and '''_glColorMaski''' specify whether the individual color components in the frame buffer can or cannot be written. '''_glColorMaski''' sets the mask for a specific draw buffer, whereas '''_glColorMask''' sets the mask for all draw buffers. If {{Parameter|red}} is {{KW|_GL_FALSE}}, for example, no change is made to the red component of any pixel in any of the color buffers, regardless of the drawing operation attempted.
Changes to individual bits of components cannot be controlled. Rather, changes are either enabled or disabled for entire color components.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|buf}} is greater than {{KW|_GL_MAX_DRAW_BUFFERS}} minus 1.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_COLOR_WRITEMASK}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glClear}}, {{KW|_glClearBuffer}}, {{KW|_glDepthMask}}, {{KW|_glStencilMask}}
{{PageCopyright}}

View file

@ -1,77 +0,0 @@
'''_glCopyTexImage1D:''' copy pixels into a 1D texture image
{{PageSyntax}}
: SUB _glCopyTexImage1D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL internalFormat AS _UNSIGNED LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL border AS LONG)
: void '''_glCopyTexImage1D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLenum {{Parameter|internalformat}}, GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLint {{Parameter|border}});
; target
: Specifies the target texture. Must be {{KW|_GL_TEXTURE_1D}}.
; level
: Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
; internalformat
: Specifies the internal format of the texture. Must be one of the following symbolic constants: {{KW|_GL_COMPRESSED_RED}}, {{KW|_GL_COMPRESSED_RG}}, {{KW|_GL_COMPRESSED_RGB}}, {{KW|_GL_COMPRESSED_RGBA}}. {{KW|_GL_COMPRESSED_SRGB}}, {{KW|_GL_COMPRESSED_SRGB_ALPHA}}. {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_DEPTH_COMPONENT16}}, {{KW|_GL_DEPTH_COMPONENT24}}, {{KW|_GL_DEPTH_COMPONENT32}}, {{KW|_GL_RED}}, {{KW|_GL_RG}}, {{KW|_GL_RGB}}, {{KW|_GL_R3_G3_B2}}, {{KW|_GL_RGB4}}, {{KW|_GL_RGB5}}, {{KW|_GL_RGB8}}, {{KW|_GL_RGB10}}, {{KW|_GL_RGB12}}, {{KW|_GL_RGB16}}, {{KW|_GL_RGBA}}, {{KW|_GL_RGBA2}}, {{KW|_GL_RGBA4}}, {{KW|_GL_RGB5_A1}}, {{KW|_GL_RGBA8}}, {{KW|_GL_RGB10_A2}}, {{KW|_GL_RGBA12}}, {{KW|_GL_RGBA16}}, {{KW|_GL_SRGB}}, {{KW|_GL_SRGB8}}, {{KW|_GL_SRGB_ALPHA}}, or {{KW|_GL_SRGB8_ALPHA8}}.
; x, y
: Specify the window coordinates of the left corner of the row of pixels to be copied.
; width
: Specifies the width of the texture image. The height of the texture image is 1.
; border
: This value must be 0.
{{PageDescription}}
'''_glCopyTexImage1D''' defines a one-dimensional texture image with pixels from the current {{KW|_GL_READ_BUFFER}}.
The screen-aligned pixel row with left corner at (''x'', ''y'') and with a length of {{Parameter|width}} defines the texture array at the mipmap level specified by {{Parameter|level}}. {{Parameter|internalformat}} specifies the internal format of the texture array.
The pixels in the row are processed exactly as if {{KW|_glReadPixels}} had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0, 1] and then converted to the texture's internal format for storage in the texel array.
Pixel ordering is such that lower ''x'' screen coordinates correspond to lower texture coordinates.
If any of the pixels within the specified row of the current {{KW|_GL_READ_BUFFER}} are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.
'''_glCopyTexImage1D''' defines a one-dimensional texture image with pixels from the current {{KW|_GL_READ_BUFFER}}.
When {{Parameter|internalformat}} is one of the sRGB types, the GL does not automatically convert the source pixels to the sRGB color space. In this case, the '''_glPixelMap''' function can be used to accomplish the conversion.
{{PageNotes}}
1, 2, 3, and 4 are not accepted values for {{Parameter|internalformat}}.
An image with 0 width indicates a NULL texture.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}} is not one of the allowable values.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
{{KW|_GL_INVALID_VALUE}} may be generated if {{Parameter|level}} is greater than log<sub>2</sub>(max), where max is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|internalformat}} is not an allowable value.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|width}} is less than 0 or greater than {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|border}} is not 0.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|internalformat}} is {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_DEPTH_COMPONENT16}}, {{KW|_GL_DEPTH_COMPONENT24}}, or {{KW|_GL_DEPTH_COMPONENT32}} and there is no depth buffer.
{{PageUseWith}}
{{KW|_glGetTexImage}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glBindFramebuffer}}, {{KW|_glCopyTexImage2D}}, {{KW|_glCopyImageSubData}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage2D}}, {{KW|_glReadBuffer}}
{{PageCopyright}}

View file

@ -1,76 +0,0 @@
'''_glCopyTexImage2D:''' copy pixels into a 2D texture image
{{PageSyntax}}
: SUB _glCopyTexImage2D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL internalFormat AS _UNSIGNED LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL height AS LONG, BYVAL border AS LONG)
: void '''_glCopyTexImage2D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLenum {{Parameter|internalformat}}, GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}}, GLint {{Parameter|border}});
; target
: Specifies the target texture. Must be {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, or {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}.
; level
: Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
; internalformat
: Specifies the internal format of the texture. Must be one of the following symbolic constants: {{KW|_GL_COMPRESSED_RED}}, {{KW|_GL_COMPRESSED_RG}}, {{KW|_GL_COMPRESSED_RGB}}, {{KW|_GL_COMPRESSED_RGBA}}. {{KW|_GL_COMPRESSED_SRGB}}, {{KW|_GL_COMPRESSED_SRGB_ALPHA}}. {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_DEPTH_COMPONENT16}}, {{KW|_GL_DEPTH_COMPONENT24}}, {{KW|_GL_DEPTH_COMPONENT32}}, {{KW|_GL_RED}}, {{KW|_GL_RG}}, {{KW|_GL_RGB}}, {{KW|_GL_R3_G3_B2}}, {{KW|_GL_RGB4}}, {{KW|_GL_RGB5}}, {{KW|_GL_RGB8}}, {{KW|_GL_RGB10}}, {{KW|_GL_RGB12}}, {{KW|_GL_RGB16}}, {{KW|_GL_RGBA}}, {{KW|_GL_RGBA2}}, {{KW|_GL_RGBA4}}, {{KW|_GL_RGB5_A1}}, {{KW|_GL_RGBA8}}, {{KW|_GL_RGB10_A2}}, {{KW|_GL_RGBA12}}, {{KW|_GL_RGBA16}}, {{KW|_GL_SRGB}}, {{KW|_GL_SRGB8}}, {{KW|_GL_SRGB_ALPHA}}, or {{KW|_GL_SRGB8_ALPHA8}}.
; x, y
: Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.
; width
: Specifies the width of the texture image.
; height
: Specifies the height of the texture image.
; border
: This value must be 0.
{{PageDescription}}
'''_glCopyTexImage2D''' defines a two-dimensional texture image, or cube-map texture image with pixels from the current {{KW|_GL_READ_BUFFER}}.
The screen-aligned pixel rectangle with lower left corner at ({{Parameter|x}}, {{Parameter|y}}) and with a width of {{Parameter|width}} and a height of {{Parameter|height}} defines the texture array at the mipmap level specified by {{Parameter|level}}. {{Parameter|internalformat}} specifies the internal format of the texture array.
The pixels in the rectangle are processed exactly as if {{KW|_glReadPixels}} had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0, 1] and then converted to the texture's internal format for storage in the texel array.
Pixel ordering is such that lower x and y screen coordinates correspond to lower s and t texture coordinates.
If any of the pixels within the specified rectangle of the current {{KW|_GL_READ_BUFFER}} are outside the window associated with the current rendering context, then the values obtained for those pixels are undefined.
When {{Parameter|internalformat}} is one of the sRGB types, the GL does not automatically convert the source pixels to the sRGB color space. In this case, the '''_glPixelMap''' function can be used to accomplish the conversion.
{{PageNotes}}
1, 2, 3, and 4 are not accepted values for {{Parameter|internalformat}}.
An image with height or width of 0 indicates a NULL texture.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}} is not {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, or {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
{{KW|_GL_INVALID_VALUE}} may be generated if {{Parameter|level}} is greater than log<sub>2</sub>(max}, where max is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|width}} is less than 0 or greater than {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|border}} is not 0.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|internalformat}} is not an accepted format.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|internalformat}} is {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_DEPTH_COMPONENT16}}, {{KW|_GL_DEPTH_COMPONENT24}}, or {{KW|_GL_DEPTH_COMPONENT32}} and there is no depth buffer.
{{PageUseWith}}
{{KW|_glGetTexImage}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glBindFramebuffer}}, {{KW|_glCopyTexImage1D}}, {{KW|_glCopyImageSubData}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage2D}}, {{KW|_glReadBuffer}}
{{PageCopyright}}

View file

@ -1,65 +0,0 @@
'''_glCopyTexSubImage1D:''' copy a one-dimensional texture subimage
{{PageSyntax}}
: SUB _glCopyTexSubImage1D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL xoffset AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG)
: void '''_glCopyTexSubImage1D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}});
; target
: Specifies the target texture. Must be {{KW|_GL_TEXTURE_1D}}.
; level
: Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
; xoffset
: Specifies the texel offset within the texture array.
; x, y
: Specify the window coordinates of the left corner of the row of pixels to be copied.
; width
: Specifies the width of the texture subimage.
{{PageDescription}}
'''_glCopyTexSubImage1D''' replaces a portion of a one-dimensional texture image with pixels from the current {{KW|_GL_READ_BUFFER}} (rather than from main memory, as is the case for {{KW|_glTexSubImage1D}}).
The screen-aligned pixel row with left corner at ({{Parameter|x}},\ {{Parameter|y}}), and with length {{Parameter|width}} replaces the portion of the texture array with x indices {{Parameter|xoffset}} through ''xoffset + width - 1'', inclusive. The destination in the texture array may not include any texels outside the texture array as it was originally specified.
The pixels in the row are processed exactly as if {{KW|_glReadPixels}} had been called, but the process stops just before final conversion. At this point, all pixel component values are clamped to the range [0, 1] and then converted to the texture's internal format for storage in the texel array.
It is not an error to specify a subtexture with zero width, but such a specification has no effect. If any of the pixels within the specified row of the current {{KW|_GL_READ_BUFFER}} are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.
No change is made to the ''internalformat'', ''width'', or ''border'' parameters of the specified texture array or to texel values outside the specified subregion.
{{PageNotes}}
The {{KW|_glPixelStore}} mode affects texture images.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if /{{Parameter|target}} is not {{KW|_GL_TEXTURE_1D}}.
{{KW|_GL_INVALID_OPERATION}} is generated if the texture array has not been defined by a previous {{KW|_glTexImage1D}} or {{KW|_glCopyTexImage1D}} operation.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
{{KW|_GL_INVALID_VALUE}} may be generated if ''level'' is greater than log<sub>2</sub>(max), where ''max'' is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_VALUE}} is generated if xoffset < 0 or xoffset + width > w, where w is the {{KW|_GL_TEXTURE_WIDTH}}.
{{PageUseWith}}
{{KW|_glGetTexImage}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glBindFramebuffer}}, {{KW|_glCopyImageSubData}}, {{KW|_glCopyTexSubImage2D}}, {{KW|_glCopyTexSubImage3D}}, {{KW|_glCopyTexImage1D}}, {{KW|_glReadBuffer}}
{{PageCopyright}}

View file

@ -1,73 +0,0 @@
'''_glCopyTexSubImage2D:''' copy a two-dimensional texture subimage
{{PageSyntax}}
: SUB _glCopyTexSubImage2D (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL xoffset AS LONG, BYVAL yoffset AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL height AS LONG)
: void '''_glCopyTexSubImage2D'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLint {{Parameter|xoffset}}, GLint {{Parameter|yoffset}}, GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}});
; target
: Specifies the target texture. Must be {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}.
; level
: Specifies the level-of-detail number. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
; xoffset
: Specifies a texel offset in the x direction within the texture array.
; yoffset
: Specifies a texel offset in the y direction within the texture array.
; x, y
: Specify the window coordinates of the lower left corner of the rectangular region of pixels to be copied.
; width
: Specifies the width of the texture subimage.
; height
: Specifies the height of the texture subimage.
{{PageDescription}}
'''_glCopyTexSubImage2D''' replaces a rectangular portion of a two-dimensional texture image, cube-map texture image or a linear portion of a number of slices of a one-dimensional array texture with pixels from the current {{KW|_GL_READ_BUFFER}} (rather than from main memory, as is the case for {{KW|_glTexSubImage2D}}).
The screen-aligned pixel rectangle with lower left corner at (''x'', ''y'') and with width {{Parameter|width}} and height {{Parameter|height}} replaces the portion of the texture array with x indices {{Parameter|xoffset}} through ''xoffset + width - 1'', inclusive, and y indices {{Parameter|yoffset}} through ''yoffset + height - 1'', inclusive, at the mipmap level specified by {{Parameter|level}}.
The pixels in the rectangle are processed exactly as if {{KW|_glReadPixels}} had been called, but the process stops just before final conversion. At this point, all pixel component values are clamped to the range [0, 1] and then converted to the texture's internal format for storage in the texel array.
The destination rectangle in the texture array may not include any texels outside the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.
When {{Parameter|target}} is {{KW|_GL_TEXTURE_1D_ARRAY}} then the y coordinate and height are treated as the start slice and number of slices to modify.
If any of the pixels within the specified rectangle of the current {{KW|_GL_READ_BUFFER}} are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined.
No change is made to the ''internalformat'', ''width'', ''height'', or ''border'' parameters of the specified texture array or to texel values outside the specified subregion.
{{PageNotes}}
{{KW|_glPixelStore}} modes affect texture images.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}} is not {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}.
{{KW|_GL_INVALID_OPERATION}} is generated if the texture array has not been defined by a previous {{KW|_glTexImage2D}} or {{KW|_glCopyTexImage2D}} operation.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
{{KW|_GL_INVALID_VALUE}} may be generated if ''level'' is greater than log<sub>2</sub>(max), where ''max'' is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_VALUE}} is generated if xoffset < 0, xoffset + width > w, yoffset < 0, or yoffset + height > h, where w is the {{KW|_GL_TEXTURE_WIDTH}} and h is the {{KW|_GL_TEXTURE_HEIGHT}} of the texture image being modified.
{{PageUseWith}}
{{KW|_glGetTexImage}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glBindFramebuffer}}, {{KW|_glCopyImageSubData}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage3D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glReadBuffer}}
{{PageCopyright}}

View file

@ -1,44 +0,0 @@
'''_glCullFace:''' specify whether front- or back-facing facets can be culled
{{PageSyntax}}
::SUB '''_glCullFace''' (BYVAL mode AS _UNSIGNED LONG)
:: void '''_glCullFace'''(GLenum {{Parameter|mode}});
; mode
: Specifies whether front- or back-facing facets are candidates for culling. Symbolic constants {{KW|_GL_FRONT}}, {{KW|_GL_BACK}}, and {{KW|_GL_FRONT_AND_BACK}} are accepted. The initial value is {{KW|_GL_BACK}}.
{{PageDescription}}
'''_glCullFace''' specifies whether front- or back-facing facets are culled (as specified by ''mode'') when facet culling is enabled. Facet culling is initially disabled. To enable and disable facet culling, call the {{KW|_glEnable}} and {{KW|_glDisable}} commands with the argument {{KW|_GL_CULL_FACE}}. Facets include triangles, quadrilaterals, polygons, and rectangles.
{{KW|_glFrontFace}} specifies which of the clockwise and counterclockwise facets are front-facing and back-facing. See {{KW|_glFrontFace}}.
{{PageNotes}}
If {{Parameter|mode}} is {{KW|_GL_FRONT_AND_BACK}}, no facets are drawn, but other primitives such as points and lines are drawn.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not an accepted value.
{{PageUseWith}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_CULL_FACE}}
{{KW|_glGet}} with argument {{KW|_GL_CULL_FACE_MODE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_CULL_FACE)}}, {{KW|_glFrontFace}}
{{PageCopyright}}

View file

@ -1,40 +0,0 @@
'''_glDeleteTextures:''' delete named textures
{{PageSyntax}}
: SUB _glDeleteTextures (BYVAL n AS LONG, textures AS _UNSIGNED LONG)
: void '''_glDeleteTextures'''(GLsizei {{Parameter|n}}, const GLuint * {{Parameter|textures}});
; n
: Specifies the number of textures to be deleted.
; textures
: Specifies an array of textures to be deleted.
{{PageDescription}}
'''_glDeleteTextures''' deletes {{Parameter|n}} textures named by the elements of the array {{Parameter|textures}}. After a texture is deleted, it has no contents or dimensionality, and its name is free for reuse (for example by {{KW|_glGenTextures}}). If a texture that is currently bound is deleted, the binding reverts to 0 (the default texture).
'''_glDeleteTextures''' silently ignores 0's and names that do not correspond to existing textures.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|n}} is negative.
{{PageUseWith}}
{{KW|_glIsTexture}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindTexture}}, {{KW|_glGenTextures}}, {{KW|_glIsTexture}}
{{PageCopyright}}

View file

@ -1,62 +0,0 @@
'''_glDepthFunc:''' specify the value used for depth buffer comparisons
{{PageSyntax}}
:: SUB _glDepthFunc (BYVAL func AS _UNSIGNED LONG)
:: void '''_glDepthFunc'''(GLenum {{Parameter|func}});
; func
: Specifies the depth comparison function. Symbolic constants {{KW|_GL_NEVER}}, {{KW|_GL_LESS}}, {{KW|_GL_EQUAL}}, {{KW|_GL_LEQUAL}}, {{KW|_GL_GREATER}}, {{KW|_GL_NOTEQUAL}}, {{KW|_GL_GEQUAL}}, and {{KW|_GL_ALWAYS}} are accepted. The initial value is {{KW|_GL_LESS}}.
{{PageDescription}}
'''_glDepthFunc''' specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer. The comparison is performed only if depth testing is enabled. (See {{KW|_glEnable}} and {{KW|_glDisable}} of {{KW|_GL_DEPTH_TEST}}.)
{{Parameter|func}} specifies the conditions under which the pixel will be drawn. The comparison functions are as follows:
; {{KW|_GL_NEVER}}
: Never passes.
; {{KW|_GL_LESS}}
: Passes if the incoming depth value is less than the stored depth value.
; {{KW|_GL_EQUAL}}
: Passes if the incoming depth value is equal to the stored depth value.
; {{KW|_GL_LEQUAL}}
: Passes if the incoming depth value is less than or equal to the stored depth value.
; {{KW|_GL_GREATER}}
: Passes if the incoming depth value is greater than the stored depth value.
; {{KW|_GL_NOTEQUAL}}
: Passes if the incoming depth value is not equal to the stored depth value.
; {{KW|_GL_GEQUAL}}
: Passes if the incoming depth value is greater than or equal to the stored depth value.
; {{KW|_GL_ALWAYS}}
: Always passes.
The initial value of {{Parameter|func}} is {{KW|_GL_LESS}}. Initially, depth testing is disabled. If depth testing is disabled or if no depth buffer exists, it is as if the depth test always passes.
{{PageNotes}}
Even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. In order to unconditionally write to the depth buffer, the depth test should be enabled and set to {{KW|_GL_ALWAYS}}.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|func}} is not an accepted value.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_DEPTH_FUNC}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_DEPTH_TEST}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_DEPTH_TEST)}}, {{KW|_glDepthRange}}, {{KW|_glPolygonOffset}}
{{PageCopyright}}

View file

@ -1,35 +0,0 @@
'''_glDepthMask:''' enable or disable writing into the depth buffer
{{PageSyntax}}
:: SUB _glDepthMask (BYVAL flag AS _UNSIGNED _BYTE)
:: void '''_glDepthMask'''(GLboolean {{Parameter|flag}});
; flag
: Specifies whether the depth buffer is enabled for writing. If {{Parameter|flag}} is {{KW|_GL_FALSE}}, depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.
{{PageDescription}}
'''_glDepthMask''' specifies whether the depth buffer is enabled for writing. If {{Parameter|flag}} is {{KW|_GL_FALSE}}, depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_DEPTH_WRITEMASK}}
{{PageNotes}}
Even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. In order to unconditionally write to the depth buffer, the depth test should be enabled and set to {{KW|_GL_ALWAYS}} (see {{KW|_glDepthFunc}}).
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glColorMask}}, {{KW|_glClearBuffer}}, {{KW|_glDepthFunc}}, {{KW|_glDepthRange}}, {{KW|_glStencilMask}}
{{PageCopyright}}

View file

@ -1,42 +0,0 @@
'''_glDepthRange:''' specify mapping of depth values from normalized device coordinates to window coordinates
{{PageSyntax}}
:: SUB _glDepthRange (BYVAL zNear AS DOUBLE, BYVAL zFar AS DOUBLE)
:: void '''_glDepthRange'''(GLdouble {{Parameter|nearVal}}, GLdouble {{Parameter|farVal}});
:: void '''_glDepthRangef'''(GLfloat {{Parameter|nearVal}}, GLfloat {{Parameter|farVal}});
; nearVal
: Specifies the mapping of the near clipping plane to window coordinates. The initial value is 0.
; farVal
: Specifies the mapping of the far clipping plane to window coordinates. The initial value is 1.
{{PageDescription}}
After clipping and division by ''w'', depth coordinates range from -1 to 1, corresponding to the near and far clipping planes. '''_glDepthRange''' specifies a linear mapping of the normalized depth coordinates in this range to window depth coordinates. Regardless of the actual depth buffer implementation, window coordinate depth values are treated as though they range from 0 through 1 (like color components). Thus, the values accepted by '''_glDepthRange''' are both clamped to this range before they are accepted.
The setting of (0,1) maps the near plane to 0 and the far plane to 1. With this mapping, the depth buffer range is fully utilized.
{{PageNotes}}
It is not necessary that {{Parameter|nearVal}} be less than {{Parameter|farVal}}. Reverse mappings such as ''nearVal'' = 1, and ''farVal'' = 0 are acceptable.
The type of the {{Parameter|nearVal}} and {{Parameter|farVal}} parameters was changed from GLclampf to GLfloat for '''_glDepthRangef''' and from GLclampd to GLdouble for '''_glDepthRange'''. This change is transparent to user code.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_DEPTH_RANGE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glDepthFunc}}, {{KW|_glDepthRangeArray}}, {{KW|_glDepthRangeIndexed}}, {{KW|_glPolygonOffset}}, {{KW|_glViewport}}
{{PageCopyright}}

View file

@ -1,49 +0,0 @@
'''_glDrawArrays:''' render primitives from array data
{{PageSyntax}}
:: SUB _glDrawArrays (BYVAL mode AS _UNSIGNED LONG, BYVAL first AS LONG, BYVAL count AS LONG)
:: void '''_glDrawArrays'''(GLenum {{Parameter|mode}}, GLint {{Parameter|first}}, GLsizei {{Parameter|count}});
; mode
: Specifies what kind of primitives to render. Symbolic constants {{KW|_GL_POINTS}}, {{KW|_GL_LINE_STRIP}}, {{KW|_GL_LINE_LOOP}}, {{KW|_GL_LINES}}, {{KW|_GL_LINE_STRIP_ADJACENCY}}, {{KW|_GL_LINES_ADJACENCY}}, {{KW|_GL_TRIANGLE_STRIP}}, {{KW|_GL_TRIANGLE_FAN}}, {{KW|_GL_TRIANGLES}}, {{KW|_GL_TRIANGLE_STRIP_ADJACENCY}}, {{KW|_GL_TRIANGLES_ADJACENCY}} and {{KW|_GL_PATCHES}} are accepted.
; first
: Specifies the starting index in the enabled arrays.
; count
: Specifies the number of indices to be rendered.
{{PageDescription}}
'''_glDrawArrays''' specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to '''_glDrawArrays'''.
When '''_glDrawArrays''' is called, it uses {{Parameter|count}} sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element {{Parameter|first}}. {{Parameter|mode}} specifies what kind of primitives are constructed and how the array elements construct those primitives.
Vertex attributes that are modified by '''_glDrawArrays''' have an unspecified value after '''_glDrawArrays''' returns. Attributes that aren't modified remain well defined.
{{PageNotes}}
{{KW|_GL_LINE_STRIP_ADJACENCY}}, {{KW|_GL_LINES_ADJACENCY}}, {{KW|_GL_TRIANGLE_STRIP_ADJACENCY}} and {{KW|_GL_TRIANGLES_ADJACENCY}} are available only if the GL version is 3.2 or greater.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|count}} is negative.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to an enabled array and the buffer object's data store is currently mapped.
{{KW|_GL_INVALID_OPERATION}} is generated if a geometry shader is active and {{Parameter|mode}} is incompatible with the input primitive type of the geometry shader in the currently installed program object.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindVertexArray}}, {{KW|_glDrawArraysIndirect}}, {{KW|_glDrawArraysInstanced}}, {{KW|_glDrawArraysInstancedBaseInstance}}, {{KW|_glMultiDrawArrays}}, {{KW|_glMultiDrawArraysIndirect}}
{{PageCopyright}}

View file

@ -1,61 +0,0 @@
'''_glDrawBuffer:''' specify which color buffers are to be drawn into
{{PageSyntax}}
:: SUB _glDrawBuffer (BYVAL mode AS _UNSIGNED LONG)
:: void '''_glDrawBuffer'''(GLenum {{Parameter|mode}});
; mode
: Specifies up to four color buffers to be drawn into. Symbolic constants {{KW|_GL_NONE}}, {{KW|_GL_FRONT_LEFT}}, {{KW|_GL_FRONT_RIGHT}}, {{KW|_GL_BACK_LEFT}}, {{KW|_GL_BACK_RIGHT}}, {{KW|_GL_FRONT}}, {{KW|_GL_BACK}}, {{KW|_GL_LEFT}}, {{KW|_GL_RIGHT}}, and {{KW|_GL_FRONT_AND_BACK}} are accepted. The initial value is {{KW|_GL_FRONT}} for single-buffered contexts, and {{KW|_GL_BACK}} for double-buffered contexts.
{{PageDescription}}
When colors are written to the frame buffer, they are written into the color buffers specified by '''_glDrawBuffer'''. The specifications are as follows:
; {{KW|_GL_NONE}}
: No color buffers are written.
; {{KW|_GL_FRONT_LEFT}}
: Only the front left color buffer is written.
; {{KW|_GL_FRONT_RIGHT}}
: Only the front right color buffer is written.
; {{KW|_GL_BACK_LEFT}}
: Only the back left color buffer is written.
; {{KW|_GL_BACK_RIGHT}}
: Only the back right color buffer is written.
; {{KW|_GL_FRONT}}
: Only the front left and front right color buffers are written. If there is no front right color buffer, only the front left color buffer is written.
; {{KW|_GL_BACK}}
: Only the back left and back right color buffers are written. If there is no back right color buffer, only the back left color buffer is written.
; {{KW|_GL_LEFT}}
: Only the front left and back left color buffers are written. If there is no back left color buffer, only the front left color buffer is written.
; {{KW|_GL_RIGHT}}
: Only the front right and back right color buffers are written. If there is no back right color buffer, only the front right color buffer is written.
; {{KW|_GL_FRONT_AND_BACK}}
: All the front and back color buffers (front left, front right, back left, back right) are written. If there are no back color buffers, only the front left and front right color buffers are written. If there are no right color buffers, only the front left and back left color buffers are written. If there are no right or back color buffers, only the front left color buffer is written.
If more than one color buffer is selected for drawing, then blending or logical operations are computed and applied independently for each color buffer and can produce different results in each buffer.
Monoscopic contexts include only ''left'' buffers, and stereoscopic contexts include both ''left'' and ''right'' buffers. Likewise, single-buffered contexts include only ''front'' buffers, and double-buffered contexts include both ''front'' and ''back'' buffers. The context is selected at GL initialization.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not an accepted value.
{{KW|_GL_INVALID_OPERATION}} is generated if none of the buffers indicated by {{Parameter|mode}} exists.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_DRAW_BUFFER}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindFramebuffer}}, {{KW|_glBlendFunc}}, {{KW|_glColorMask}}, {{KW|_glDrawBuffers}}, {{KW|_glLogicOp}}
{{PageCopyright}}

View file

@ -1,51 +0,0 @@
'''_glDrawElements:''' render primitives from array data
{{PageSyntax}}
: SUB _glDrawElements (BYVAL mode AS _UNSIGNED LONG, BYVAL count AS LONG, BYVAL type AS _UNSIGNED LONG, indices AS _OFFSET)
: void '''_glDrawElements'''(GLenum {{Parameter|mode}}, GLsizei {{Parameter|count}}, GLenum {{Parameter|type}}, const GLvoid * {{Parameter|indices}});
; mode
: Specifies what kind of primitives to render. Symbolic constants {{KW|_GL_POINTS}}, {{KW|_GL_LINE_STRIP}}, {{KW|_GL_LINE_LOOP}}, {{KW|_GL_LINES}}, {{KW|_GL_LINE_STRIP_ADJACENCY}}, {{KW|_GL_LINES_ADJACENCY}}, {{KW|_GL_TRIANGLE_STRIP}}, {{KW|_GL_TRIANGLE_FAN}}, {{KW|_GL_TRIANGLES}}, {{KW|_GL_TRIANGLE_STRIP_ADJACENCY}}, {{KW|_GL_TRIANGLES_ADJACENCY}} and {{KW|_GL_PATCHES}} are accepted.
; count
: Specifies the number of elements to be rendered.
; type
: Specifies the type of the values in {{Parameter|indices}}. Must be one of {{KW|_GL_UNSIGNED_BYTE}}, {{KW|_GL_UNSIGNED_SHORT}}, or {{KW|_GL_UNSIGNED_INT}}.
; indices
: Specifies a pointer to the location where the indices are stored.
{{PageDescription}}
'''_glDrawElements''' specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL function to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can prespecify separate arrays of vertices, normals, and so on, and use them to construct a sequence of primitives with a single call to '''_glDrawElements'''.
When '''_glDrawElements''' is called, it uses {{Parameter|count}} sequential elements from an enabled array, starting at {{Parameter|indices}} (interpreted as a byte count) to construct a sequence of geometric primitives. {{Parameter|mode}} specifies what kind of primitives are constructed and how the array elements construct these primitives. If more than one array is enabled, each is used.
Vertex attributes that are modified by '''_glDrawElements''' have an unspecified value after '''_glDrawElements''' returns. Attributes that aren't modified maintain their previous values.
{{PageNotes}}
{{KW|_GL_LINE_STRIP_ADJACENCY}}, {{KW|_GL_LINES_ADJACENCY}}, {{KW|_GL_TRIANGLE_STRIP_ADJACENCY}} and {{KW|_GL_TRIANGLES_ADJACENCY}} are available only if the GL version is 3.2 or greater.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|count}} is negative.
{{KW|_GL_INVALID_OPERATION}} is generated if a geometry shader is active and {{Parameter|mode}} is incompatible with the input primitive type of the geometry shader in the currently installed program object.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindVertexArray}}, {{KW|_glDrawArrays}}, {{KW|_glDrawElementsBaseVertex}}, {{KW|_glDrawElementsIndirect}}, {{KW|_glDrawElementsInstanced}}, {{KW|_glDrawElementsInstancedBaseInstance}}, {{KW|_glDrawElementsInstancedBaseVertex}}, {{KW|_glDrawElementsInstancedBaseVertexBaseInstance}}, {{KW|_glDrawRangeElements}}, {{KW|_glDrawRangeElementsBaseVertex}}, {{KW|_glMultiDrawElements}}, {{KW|_glMultiDrawElementsBaseVertex}}, {{KW|_glMultiDrawElementsIndirect}}
{{PageCopyright}}

View file

@ -1,140 +0,0 @@
'''_glEnable:''' enable or disable server-side GL capabilities
{{PageSyntax}}
SUB _glEnable (BYVAL cap AS _UNSIGNED LONG)
void '''_glEnable'''(GLenum {{Parameter|cap}});
SUB _glDisable (BYVAL cap AS _UNSIGNED LONG)
void '''_glDisable'''(GLenum {{Parameter|cap}});
; cap
: Specifies a symbolic constant indicating a GL capability.
{{PageSyntax}}
| name = glEnablei, glDisablei
| core = 3.0
}}
void '''_glEnablei'''(GLenum {{Parameter|cap}}, GLuint {{Parameter|index}});
void '''_glDisablei'''(GLenum {{Parameter|cap}}, GLuint {{Parameter|index}});
; cap
: Specifies a symbolic constant indicating a GL capability.
; index
: Specifies the index of the capability to enable/disable.
{{PageDescription}}
'''_glEnable''' and {{KW|_glDisable}} enable and disable various capabilities. Use {{KW|_glIsEnabled}} or {{KW|_glGet}} to determine the current setting of any capability. The initial value for each capability with the exception of {{KW|_GL_DITHER}} and {{KW|_GL_MULTISAMPLE}} is {{KW|_GL_FALSE}}. The initial value for {{KW|_GL_DITHER}} and {{KW|_GL_MULTISAMPLE}} is {{KW|_GL_TRUE}}.
Both '''_glEnable''' and {{KW|_glDisable}} take a single argument, {{Parameter|cap}}, which can assume one of the following values:
; {{KW|_GL_BLEND}}
: If enabled, blend the computed fragment color values with the values in the color buffers. See [[GLAPI/glBlendFunc|glBlendFunc]]. Sets the blend enable/disable flag for all color buffers.
; {{KW|_GL_CLIP_DISTANCE}}''i''
: If enabled, clip geometry against user-defined half space ''i''.
; {{KW|_GL_COLOR_LOGIC_OP}}
: If enabled, apply the currently selected logical operation to the computed fragment color and color buffer values. See [[GLAPI/glLogicOp|glLogicOp]].
; {{KW|_GL_CULL_FACE}}
: If enabled, cull polygons based on their winding in window coordinates. See [[GLAPI/glCullFace|glCullFace]].
; {{KW|_GL_DEBUG_OUTPUT}}
: If enabled, debug messages are produced by a debug context. When disabled, the debug message log is silenced. Note that in a non-debug context, very few, if any messages might be produced, even when {{KW|_GL_DEBUG_OUTPUT}} is enabled.
; {{KW|_GL_DEBUG_OUTPUT_SYNCHRONOUS}}
: If enabled, debug messages are produced synchronously by a debug context. If disabled, debug messages may be produced asynchronously. In particular, they may be delayed relative to the execution of GL commands, and the debug callback function may be called from a thread other than that in which the commands are executed. See {{KW|_glDebugMessageCallback}}.
; {{KW|_GL_DEPTH_CLAMP}}
: If enabled, the -w<sub>c</sub> ≤ z<sub>c</sub> ≤ w<sub>c</sub> plane equation is ignored by view volume clipping (effectively, there is no near or far plane clipping). See [[GLAPI/glDepthRange|glDepthRange]].
; {{KW|_GL_DEPTH_TEST}}
: If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See [[GLAPI/glDepthFunc|glDepthFunc]] and [[GLAPI/glDepthRange|glDepthRange]].
; {{KW|_GL_DITHER}}
: If enabled, dither color components or indices before they are written to the color buffer.
; {{KW|_GL_FRAMEBUFFER_SRGB}}
: If enabled and the value of {{KW|_GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING}} for the framebuffer attachment corresponding to the destination buffer is {{KW|_GL_SRGB}}, the R, G, and B destination color values (after conversion from fixed-point to floating-point) are considered to be encoded for the sRGB color space and hence are linearized prior to their use in blending.
; {{KW|_GL_LINE_SMOOTH}}
: If enabled, draw lines with correct filtering. Otherwise, draw aliased lines. See [[GLAPI/glLineWidth|glLineWidth]].
; {{KW|_GL_MULTISAMPLE}}
: If enabled, use multiple fragment samples in computing the final color of a pixel. See [[GLAPI/glSampleCoverage|glSampleCoverage]].
; {{KW|_GL_POLYGON_OFFSET_FILL}}
: If enabled, and if the polygon is rendered in {{KW|_GL_FILL}} mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See [[GLAPI/glPolygonOffset|glPolygonOffset]].
; {{KW|_GL_POLYGON_OFFSET_LINE}}
: If enabled, and if the polygon is rendered in {{KW|_GL_LINE}} mode, an offset is added to depth values of a polygon's fragments before the depth comparison is performed. See [[GLAPI/glPolygonOffset|glPolygonOffset]].
; {{KW|_GL_POLYGON_OFFSET_POINT}}
: If enabled, an offset is added to depth values of a polygon's fragments before the depth comparison is performed, if the polygon is rendered in {{KW|_GL_POINT}} mode. See [[GLAPI/glPolygonOffset|glPolygonOffset]].
; {{KW|_GL_POLYGON_SMOOTH}}
: If enabled, draw polygons with proper filtering. Otherwise, draw aliased polygons. For correct antialiased polygons, an alpha buffer is needed and the polygons must be sorted front to back.
; {{KW|_GL_PRIMITIVE_RESTART}}
: Enables primitive restarting. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the primitive restart index. See {{KW|_glPrimitiveRestartIndex}}.
; {{KW|_GL_PRIMITIVE_RESTART_FIXED_INDEX}}
: Enables primitive restarting with a fixed index. If enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL will restart the primitive when the index of the vertex is equal to the fixed primitive index for the specified index type. The fixed index is equal to <math>2^n - 1</math> where ''n'' is equal to 8 for {{KW|_GL_UNSIGNED_BYTE}}, 16 for {{KW|_GL_UNSIGNED_SHORT}} and 32 for {{KW|_GL_UNSIGNED_INT}}.
; {{KW|_GL_RASTERIZER_DISCARD}}
: If enabled, all primitives are discarded before rasterization, but ''after'' any optional transform feedback. Also causes {{KW|_glClear}} and {{KW|_glClearBuffer}} commands to be ignored.
; {{KW|_GL_SAMPLE_ALPHA_TO_COVERAGE}}
: If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value.
; {{KW|_GL_SAMPLE_ALPHA_TO_ONE}}
: If enabled, each sample alpha value is replaced by the maximum representable alpha value.
; {{KW|_GL_SAMPLE_COVERAGE}}
: If enabled, the fragment's coverage is ANDed with the temporary coverage value. If {{KW|_GL_SAMPLE_COVERAGE_INVERT}} is set to {{KW|_GL_TRUE}}, invert the coverage value. See [[GLAPI/glSampleCoverage|glSampleCoverage]].
; {{KW|_GL_SAMPLE_SHADING}}
: If enabled, the active fragment shader is run once for each covered sample, or at fraction of this rate as determined by the current value of {{KW|_GL_MIN_SAMPLE_SHADING_VALUE}}. See [[GLAPI/glMinSampleShading|glMinSampleShading]].
; {{KW|_GL_SAMPLE_MASK}}
: If enabled, the sample coverage mask generated for a fragment during rasterization will be ANDed with the value of {{KW|_GL_SAMPLE_MASK_VALUE}} before shading occurs. See [[GLAPI/glSampleMaski|glSampleMaski]].
; {{KW|_GL_SCISSOR_TEST}}
: If enabled, discard fragments that are outside the scissor rectangle. See [[GLAPI/glScissor|glScissor]].
; {{KW|_GL_STENCIL_TEST}}
: If enabled, do stencil testing and update the stencil buffer. See [[GLAPI/glStencilFunc|glStencilFunc]] and [[GLAPI/glStencilOp|glStencilOp]].
; {{KW|_GL_TEXTURE_CUBE_MAP_SEAMLESS}}
: If enabled, cubemap textures are sampled such that when linearly sampling from the border between two adjacent faces, texels from both faces are used to generate the final sample value. When disabled, texels from only a single face are used to construct the final sample value.
; {{KW|_GL_PROGRAM_POINT_SIZE}}
: If enabled and a vertex or geometry shader is active, then the derived point size is taken from the (potentially clipped) shader builtin {{code|gl_PointSize}} and clamped to the implementation-dependent point size range.
=== Indexed Capabilities ===
Some of the GL's capabilities are indexed. '''_glEnablei''' and '''_glDisablei''' enable and disable indexed capabilities. Only the following capabilities may be used with indices higher than zero:
; {{KW|_GL_BLEND}}
: If enabled, blend the computed fragment color values with the values in the specified color buffer. {{Parameter|index}} must be less than {{KW|_GL_MAX_DRAW_BUFFERS}} or {{KW|_GL_INVALID_VALUE}} will result. See [[GLAPI/glBlendFunc|glBlendFunc]].
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|cap}} is not one of the values listed previously.
{{KW|_GL_INVALID_VALUE}} is generated by '''_glEnablei''' and '''_glDisablei''' if {{Parameter|index}} is greater than or equal to the number of indexed capabilities for {{Parameter|cap}}.
{{PageNotes}}
{{KW|_GL_PRIMITIVE_RESTART}} is available only if the GL version is 3.1 or greater.
{{KW|_GL_TEXTURE_CUBE_MAP_SEAMLESS}} is available only if the GL version is 3.2 or greater.
{{KW|_GL_PRIMITIVE_RESTART_FIXED_INDEX}} is available only if the GL version is 4.3 or greater.
{{KW|_GL_DEBUG_OUTPUT}} and {{KW|_GL_DEBUG_OUTPUT_SYNCHRONOUS}} are available only if the GL version is 4.3 or greater.
Any token accepted by '''_glEnable''' or '''_glDisable''' is also accepted by '''_glEnablei''' and '''_glDisablei''', but if the capability is not indexed, the maximum value that {{Parameter|index}} may take is zero.
In general, passing an indexed capability to '''_glEnable''' or '''_glDisable''' will enable or disable that capability for all indices, resepectively.
{{PageUseWith}}
{{KW|_glIsEnabled}}
{{KW|_glGet}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glBlendFunc}}, {{KW|_glCullFace}}, {{KW|_glDepthFunc}}, {{KW|_glDepthRange}}, {{KW|_glGet}}, {{KW|_glIsEnabled}}, {{KW|_glLineWidth}}, {{KW|_glLogicOp}}, {{KW|_glPointSize}}, {{KW|_glPolygonMode}}, {{KW|_glPolygonOffset}}, {{KW|_glSampleCoverage}}, {{KW|_glScissor}}, {{KW|_glStencilFunc}}, {{KW|_glStencilOp}}, {{KW|_glTexImage1D}}, {{KW|_glTexImage2D}}, {{KW|_glTexImage3D}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010-2011 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,29 +0,0 @@
'''_glFinish:''' block until all GL execution is complete
{{PageSyntax}}
SUB _glFinish
void '''_glFinish'''({{Parameter|void}});
{{PageDescription}}
'''_glFinish''' does not return until the effects of all previously called GL commands are complete. Such effects include all changes to GL state, all changes to connection state, and all changes to the frame buffer contents.
{{PageNotes}}
'''_glFinish''' requires a round trip to the server.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glFlush}}, {{KW|_glFenceSync}}, {{KW|_glWaitSync}}, {{KW|_glClientWaitSync}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,31 +0,0 @@
'''_glFlush:''' force execution of GL commands in finite time
{{PageSyntax}}
SUB _glFlush
void '''_glFlush'''({{Parameter|void}});
{{PageDescription}}
Different GL implementations buffer commands in several different locations, including network buffers and the graphics accelerator itself. '''_glFlush''' empties all of these buffers, causing all issued commands to be executed as quickly as they are accepted by the actual rendering engine. Though this execution may not be completed in any particular time period, it does complete in finite time.
Because any GL program might be executed over a network, or on an accelerator that buffers commands, all programs should call '''_glFlush''' whenever they count on having all of their previously issued commands completed. For example, call '''_glFlush''' before waiting for user input that depends on the generated image.
{{PageNotes}}
'''_glFlush''' can return at any time. It does not wait until the execution of all previously issued GL commands is complete.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glFinish}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,39 +0,0 @@
'''_glFrontFace:''' define front- and back-facing polygons
{{PageSyntax}}
SUB _glFrontFace (BYVAL mode AS _UNSIGNED LONG)
void '''_glFrontFace'''(GLenum {{Parameter|mode}});
; mode
: Specifies the orientation of front-facing polygons. {{KW|_GL_CW}} and {{KW|_GL_CCW}} are accepted. The initial value is {{KW|_GL_CCW}}.
{{PageDescription}}
In a scene composed entirely of opaque closed surfaces, back-facing polygons are never visible. Eliminating these invisible polygons has the obvious benefit of speeding up the rendering of the image. To enable and disable elimination of back-facing polygons, call {{KW|_glEnable}} and {{KW|_glDisable}} with argument {{KW|_GL_CULL_FACE}}.
The projection of a polygon to window coordinates is said to have clockwise winding if an imaginary object following the path from its first vertex, its second vertex, and so on, to its last vertex, and finally back to its first vertex, moves in a clockwise direction about the interior of the polygon. The polygon's winding is said to be counterclockwise if the imaginary object following the same path moves in a counterclockwise direction about the interior of the polygon. '''_glFrontFace''' specifies whether polygons with clockwise winding in window coordinates, or counterclockwise winding in window coordinates, are taken to be front-facing. Passing {{KW|_GL_CCW}} to {{Parameter|mode}} selects counterclockwise polygons as front-facing; {{KW|_GL_CW}} selects clockwise polygons as front-facing. By default, counterclockwise polygons are taken to be front-facing.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not an accepted value.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_FRONT_FACE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glCullFace}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,43 +0,0 @@
'''_glGenTextures:''' generate texture names
{{PageSyntax}}
SUB _glGenTextures (BYVAL n AS LONG, textures AS _UNSIGNED LONG)
void '''_glGenTextures'''(GLsizei {{Parameter|n}}, GLuint * {{Parameter|textures}});
; n
: Specifies the number of texture names to be generated.
; textures
: Specifies an array in which the generated texture names are stored.
{{PageDescription}}
'''_glGenTextures''' returns {{Parameter|n}} texture names in {{Parameter|textures}}. There is no guarantee that the names form a contiguous set of integers; however, it is guaranteed that none of the returned names was in use immediately before the call to '''_glGenTextures'''.
The generated textures have no dimensionality; they assume the dimensionality of the texture target to which they are first bound (see {{KW|_glBindTexture}}).
Texture names returned by a call to '''_glGenTextures''' are not returned by subsequent calls, unless they are first deleted with {{KW|_glDeleteTextures}}.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|n}} is negative.
{{PageUseWith}}
{{KW|_glIsTexture}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindTexture}}, {{KW|_glDeleteTextures}}, {{KW|_glIsTexture}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,42 +0,0 @@
'''_glGetError:''' return error information
{{PageSyntax}}
FUNCTION _glGetError~&
GLenum '''_glGetError'''({{Parameter|void}});
{{PageDescription}}
'''_glGetError''' returns the value of the error flag. Each detectable error is assigned a numeric code and symbolic name. When an error occurs, the error flag is set to the appropriate error code value. No other errors are recorded until '''_glGetError''' is called, the error code is returned, and the flag is reset to {{KW|_GL_NO_ERROR}}. If a call to '''_glGetError''' returns {{KW|_GL_NO_ERROR}}, there has been no detectable error since the last call to '''_glGetError''', or since the GL was initialized.
To allow for distributed implementations, there may be several error flags. If any single error flag has recorded an error, the value of that flag is returned and that flag is reset to {{KW|_GL_NO_ERROR}} when '''_glGetError''' is called. If more than one flag has recorded an error, '''_glGetError''' returns and clears an arbitrary error flag value. Thus, '''_glGetError''' should always be called in a loop, until it returns {{KW|_GL_NO_ERROR}}, if all error flags are to be reset.
Initially, all error flags are set to {{KW|_GL_NO_ERROR}}.
The following errors are currently defined:
; {{KW|_GL_NO_ERROR}}
: No error has been recorded. The value of this symbolic constant is guaranteed to be 0.
; {{KW|_GL_INVALID_ENUM}}
: An unacceptable value is specified for an enumerated argument. The offending command is ignored and has no other side effect than to set the error flag.
; {{KW|_GL_INVALID_VALUE}}
: A numeric argument is out of range. The offending command is ignored and has no other side effect than to set the error flag.
; {{KW|_GL_INVALID_OPERATION}}
: The specified operation is not allowed in the current state. The offending command is ignored and has no other side effect than to set the error flag.
; {{KW|_GL_INVALID_FRAMEBUFFER_OPERATION}}
: The framebuffer object is not complete. The offending command is ignored and has no other side effect than to set the error flag.
; {{KW|_GL_OUT_OF_MEMORY}}
: There is not enough memory left to execute the command. The state of the GL is undefined, except for the state of the error flags, after this error is recorded.
; {{KW|_GL_STACK_UNDERFLOW}}
: An attempt has been made to perform an operation that would cause an internal stack to underflow.
; {{KW|_GL_STACK_OVERFLOW}}
: An attempt has been made to perform an operation that would cause an internal stack to overflow.
When an error flag is set, results of a GL operation are undefined only if {{KW|_GL_OUT_OF_MEMORY}} has occurred. In all other cases, the command generating the error is ignored and has no effect on the GL state or frame buffer contents. If the generating command returns a value, it returns 0. If '''_glGetError''' itself generates an error, it returns 0.
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2012 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,72 +0,0 @@
'''_glGetString:''' return a string describing the current GL connection
{{PageSyntax}}
FUNCTION _glGetString&& (BYVAL name AS _UNSIGNED LONG)
const GLubyte* '''_glGetString'''(GLenum {{Parameter|name}});
const GLubyte* '''_glGetStringi'''(GLenum {{Parameter|name}}, GLuint {{Parameter|index}});
; name
: Specifies a symbolic constant, one of {{KW|_GL_VENDOR}}, {{KW|_GL_RENDERER}}, {{KW|_GL_VERSION}}, or {{KW|_GL_SHADING_LANGUAGE_VERSION}}. Additionally, '''_glGetStringi''' accepts the {{KW|_GL_EXTENSIONS}} token.
; index
: For '''_glGetStringi''', specifies the index of the string to return.
{{PageDescription}}
'''_glGetString''' returns a pointer to a static string describing some aspect of the current GL connection. {{Parameter|name}} can be one of the following:
; {{KW|_GL_VENDOR}}
:
Returns the company responsible for this GL implementation. This name does not change from release to release.
; {{KW|_GL_RENDERER}}
:
Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release.
; {{KW|_GL_VERSION}}
:
Returns a version or release number.
; {{KW|_GL_SHADING_LANGUAGE_VERSION}}
:
Returns a version or release number for the shading language.
Strings {{KW|_GL_VENDOR}} and {{KW|_GL_RENDERER}} together uniquely specify a platform. They do not change from release to release and should be used by platform-recognition algorithms.
'''_glGetStringi''' returns a pointer to a static string indexed by {{Parameter|index}}. {{Parameter|name}} can be one of the following:
; {{KW|_GL_EXTENSIONS}}
: For '''_glGetStringi''' only, returns the extension string supported by the implementation at {{Parameter|index}}. The index {{Parameter|index}} is on the range [0 to {{KW|_glGet|Integerv(GL_NUM_EXTENSIONS)}} - 1].
; {{KW|_GL_SHADING_LANGUAGE_VERSION}}
: Returns one of the versions of [[GLSL]] supported by this implementation. {{Parameter|index}} is on the range [0 to {{KW|_glGet|Integerv(GL_NUM_SHADING_LANGUAGE_VERSIONS)}} - 1].
The {{KW|_GL_VERSION}} and {{KW|_GL_SHADING_LANGUAGE_VERSION}} strings begin with a version number. The version number uses one of these forms:
''major_number.minor_number''
or
''major_number.minor_number.release_number''
Vendor-specific information may follow the version number. Its format depends on the implementation, but a space always separates the version number and the vendor-specific information.
All strings are null-terminated.
{{PageNotes}}
If an error is generated, '''_glGetString''' returns 0.
The client and server may support different versions. '''_glGetString''' always returns a compatible version number. The release number always describes the server.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|name}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated by '''_glGetStringi''' if {{Parameter|index}} is outside the valid range for indexed state {{Parameter|name}}.
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,82 +0,0 @@
'''_glGetTexImage:''' return a texture image
{{PageSyntax}}
SUB _glGetTexImage (BYVAL target AS _UNSIGNED LONG, BYVAL level AS LONG, BYVAL format AS _UNSIGNED LONG, BYVAL type AS _UNSIGNED LONG, pixels AS _OFFSET)
void '''_glGetTexImage'''(GLenum {{Parameter|target}}, GLint {{Parameter|level}}, GLenum {{Parameter|format}}, GLenum {{Parameter|type}}, GLvoid * {{Parameter|img}});
; target
: Specifies which texture is to be obtained. {{KW|_GL_TEXTURE_1D}}, {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_3D}}, {{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_2D_ARRAY}}, {{KW|_GL_TEXTURE_RECTANGLE}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_X}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y}}, {{KW|_GL_TEXTURE_CUBE_MAP_POSITIVE_Z}}, and {{KW|_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z}} are accepted.
; level
: Specifies the level-of-detail number of the desired image. Level 0 is the base image level. Level ''n'' is the ''n''th mipmap reduction image.
; format
: Specifies a pixel format for the returned data. The supported formats are {{KW|_GL_STENCIL_INDEX}}, {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_DEPTH_STENCIL}}, {{KW|_GL_RED}}, {{KW|_GL_GREEN}}, {{KW|_GL_BLUE}}, {{KW|_GL_RG}}, {{KW|_GL_RGB}}, {{KW|_GL_RGBA}}, {{KW|_GL_BGR}}, {{KW|_GL_BGRA}}, {{KW|_GL_RED_INTEGER}}, {{KW|_GL_GREEN_INTEGER}}, {{KW|_GL_BLUE_INTEGER}}, {{KW|_GL_RG_INTEGER}}, {{KW|_GL_RGB_INTEGER}}, {{KW|_GL_RGBA_INTEGER}}, {{KW|_GL_BGR_INTEGER}}, {{KW|_GL_BGRA_INTEGER}}.
; type
: Specifies a pixel type for the returned data. The supported types are {{KW|_GL_UNSIGNED_BYTE}}, {{KW|_GL_BYTE}}, {{KW|_GL_UNSIGNED_SHORT}}, {{KW|_GL_SHORT}}, {{KW|_GL_UNSIGNED_INT}}, {{KW|_GL_INT}}, {{KW|_GL_HALF_FLOAT}}, {{KW|_GL_FLOAT}}, {{KW|_GL_UNSIGNED_BYTE_3_3_2}}, {{KW|_GL_UNSIGNED_BYTE_2_3_3_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}}, {{KW|_GL_UNSIGNED_SHORT_4_4_4_4}}, {{KW|_GL_UNSIGNED_SHORT_4_4_4_4_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_5_5_1}}, {{KW|_GL_UNSIGNED_SHORT_1_5_5_5_REV}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8_REV}}, {{KW|_GL_UNSIGNED_INT_10_10_10_2}}, {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}}, {{KW|_GL_UNSIGNED_INT_24_8}}, {{KW|_GL_UNSIGNED_INT_10F_11F_11F_REV}}, {{KW|_GL_UNSIGNED_INT_5_9_9_9_REV}}, and {{KW|_GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
; img
: Returns the texture image. Should be a pointer to an array of the type specified by {{Parameter|type}}.
{{PageDescription}}
'''_glGetTexImage''' returns a texture image into {{Parameter|img}}. {{Parameter|target}} specifies whether the desired texture image is one specified by {{KW|_glTexImage1D}} ({{KW|_GL_TEXTURE_1D}}), {{KW|_glTexImage2D}} ({{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_RECTANGLE}}, {{KW|_GL_TEXTURE_2D}} or any of {{KW|_GL_TEXTURE_CUBE_MAP_*}}), or {{KW|_glTexImage3D}} ({{KW|_GL_TEXTURE_2D_ARRAY}}, {{KW|_GL_TEXTURE_3D}}). {{Parameter|level}} specifies the level-of-detail number of the desired image. {{Parameter|format}} and {{Parameter|type}} specify the format and type of the desired image array. See the reference page for {{KW|_glTexImage1D}} for a description of the acceptable values for the {{Parameter|format}} and {{Parameter|type}} parameters, respectively.
If a non-zero named buffer object is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target (see {{KW|_glBindBuffer}}) while a texture image is requested, {{Parameter|img}} is treated as a byte offset into the buffer object's data store.
To understand the operation of '''_glGetTexImage''', consider the selected internal four-component texture image to be an RGBA color buffer the size of the image. The semantics of '''_glGetTexImage''' are then identical to those of {{KW|_glReadPixels}}, with the exception that no pixel transfer operations are performed, when called with the same {{Parameter|format}} and {{Parameter|type}}, with ''x'' and ''y'' set to 0, ''width'' set to the width of the texture image and ''height'' set to 1 for 1D images, or to the height of the texture image for 2D images.
If the selected texture image does not contain four components, the following mappings are applied. Single-component textures are treated as RGBA buffers with red set to the single-component value, green set to 0, blue set to 0, and alpha set to 1. Two-component textures are treated as RGBA buffers with red set to the value of component zero, alpha set to the value of component one, and green and blue set to 0. Finally, three-component textures are treated as RGBA buffers with red set to component zero, green set to component one, blue set to component two, and alpha set to 1.
To determine the required size of {{Parameter|img}}, use {{KW|_glGetTexLevelParameter}} to determine the dimensions of the internal texture image, then scale the required number of pixels by the storage required for each pixel, based on {{Parameter|format}} and {{Parameter|type}}. Be sure to take the pixel storage parameters into account, especially {{KW|_GL_PACK_ALIGNMENT}}.
{{PageNotes}}
If an error is generated, no change is made to the contents of {{Parameter|img}}.
'''_glGetTexImage''' returns the texture image for the active texture unit.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|target}}, {{Parameter|format}}, or {{Parameter|type}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|level}} is less than 0.
{{KW|_GL_INVALID_VALUE}} may be generated if {{Parameter|level}} is greater than log<sub>2</sub>(''max''), where ''max'' is the returned value of {{KW|_GL_MAX_TEXTURE_SIZE}}.
{{KW|_GL_INVALID_OPERATION}} is returned if {{Parameter|type}} is one of {{KW|_GL_UNSIGNED_BYTE_3_3_2}}, {{KW|_GL_UNSIGNED_BYTE_2_3_3_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}}, or {{KW|_GL_UNSIGNED_INT_10F_11F_11F_REV}} and {{Parameter|format}} is not {{KW|_GL_RGB}}.
{{KW|_GL_INVALID_OPERATION}} is returned if {{Parameter|type}} is one of {{KW|_GL_UNSIGNED_SHORT_4_4_4_4}}, {{KW|_GL_UNSIGNED_SHORT_4_4_4_4_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_5_5_1}}, {{KW|_GL_UNSIGNED_SHORT_1_5_5_5_REV}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8_REV}}, {{KW|_GL_UNSIGNED_INT_10_10_10_2}}, {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}}, or {{KW|_GL_UNSIGNED_INT_5_9_9_9_REV}} and {{Parameter|format}} is neither {{KW|_GL_RGBA}} or {{KW|_GL_BGRA}}.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target and the buffer object's data store is currently mapped.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target and {{Parameter|img}} is not evenly divisible into the number of bytes needed to store in memory a datum indicated by {{Parameter|type}}.
{{PageUseWith}}
{{KW|_glGetTexLevelParameter}} with argument {{KW|_GL_TEXTURE_WIDTH}}
{{KW|_glGetTexLevelParameter}} with argument {{KW|_GL_TEXTURE_HEIGHT}}
{{KW|_glGetTexLevelParameter}} with argument {{KW|_GL_TEXTURE_INTERNAL_FORMAT}}
{{KW|_glGet}} with arguments {{KW|_GL_PACK_ALIGNMENT}} and others
{{KW|_glGet}} with argument {{KW|_GL_PIXEL_PACK_BUFFER_BINDING}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glActiveTexture}}, {{KW|_glBindTexture}}, {{KW|_glPixelStore}}, {{KW|_glReadPixels}}, {{KW|_glTexSubImage1D}}, {{KW|_glTexSubImage2D}}, {{KW|_glTexSubImage3D}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,56 +0,0 @@
'''_glHint:''' specify implementation-specific hints
{{PageSyntax}}
SUB _glHint (BYVAL target AS _UNSIGNED LONG, BYVAL mode AS _UNSIGNED LONG)
void '''_glHint'''(GLenum {{Parameter|target}}, GLenum {{Parameter|mode}});
; target
: Specifies a symbolic constant indicating the behavior to be controlled. {{KW|_GL_LINE_SMOOTH_HINT}}, {{KW|_GL_POLYGON_SMOOTH_HINT}}, {{KW|_GL_TEXTURE_COMPRESSION_HINT}}, and {{KW|_GL_FRAGMENT_SHADER_DERIVATIVE_HINT}} are accepted.
; mode
: Specifies a symbolic constant indicating the desired behavior. {{KW|_GL_FASTEST}}, {{KW|_GL_NICEST}}, and {{KW|_GL_DONT_CARE}} are accepted.
{{PageDescription}}
Certain aspects of GL behavior, when there is room for interpretation, can be controlled with hints. A hint is specified with two arguments. {{Parameter|target}} is a symbolic constant indicating the behavior to be controlled, and {{Parameter|mode}} is another symbolic constant indicating the desired behavior. The initial value for each {{Parameter|target}} is {{KW|_GL_DONT_CARE}}. {{Parameter|mode}} can be one of the following:
; {{KW|_GL_FASTEST}}
:
The most efficient option should be chosen.
; {{KW|_GL_NICEST}}
:
The most correct, or highest quality, option should be chosen.
; {{KW|_GL_DONT_CARE}}
:
No preference.
Though the implementation aspects that can be hinted are well defined, the interpretation of the hints depends on the implementation. The hint aspects that can be specified with {{Parameter|target}}, along with suggested semantics, are as follows:
; {{KW|_GL_FRAGMENT_SHADER_DERIVATIVE_HINT}}
:
Indicates the accuracy of the derivative calculation for the GL shading language fragment processing built-in functions: {{KW|_dFdx}}, {{KW|_dFdy}}, and {{KW|_fwidth}}.
; {{KW|_GL_LINE_SMOOTH_HINT}}
:
Indicates the sampling quality of antialiased lines. If a larger filter function is applied, hinting {{KW|_GL_NICEST}} can result in more pixel fragments being generated during rasterization.
; {{KW|_GL_POLYGON_SMOOTH_HINT}}
:
Indicates the sampling quality of antialiased polygons. Hinting {{KW|_GL_NICEST}} can result in more pixel fragments being generated during rasterization, if a larger filter function is applied.
; {{KW|_GL_TEXTURE_COMPRESSION_HINT}}
:
Indicates the quality and performance of the compressing texture images. Hinting {{KW|_GL_FASTEST}} indicates that texture images should be compressed as quickly as possible, while {{KW|_GL_NICEST}} indicates that texture images should be compressed with as little image quality loss as possible. {{KW|_GL_NICEST}} should be selected if the texture is to be retrieved by {{KW|_glGetCompressedTexImage}} for reuse.
{{PageNotes}}
The interpretation of hints depends on the implementation. Some implementations ignore '''_glHint''' settings.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if either {{Parameter|target}} or {{Parameter|mode}} is not an accepted value.
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,131 +0,0 @@
'''_glIsEnabled, glIsEnabledi:''' test whether a capability is enabled
{{PageSyntax}}
FUNCTION _glIsEnabled~%% (BYVAL cap AS _UNSIGNED LONG)
GLboolean '''_glIsEnabled'''(GLenum {{Parameter|cap}});
GLboolean '''_glIsEnabledi'''(GLenum {{Parameter|cap}}, GLuint {{Parameter|index}});
; cap
: Specifies a symbolic constant indicating a GL capability.
; index
: Specifies the index of the capability.
{{PageDescription}}
'''_glIsEnabled''' returns {{KW|_GL_TRUE}} if {{Parameter|cap}} is an enabled capability and returns {{KW|_GL_FALSE}} otherwise. Boolean states that are indexed may be tested with '''_glIsEnabledi'''. For '''_glIsEnabledi''', {{Parameter|index}} specifies the index of the capability to test. {{Parameter|index}} must be between zero and the count of indexed capabilities for {{Parameter|cap}}. Initially all capabilities except {{KW|_GL_DITHER}} are disabled; {{KW|_GL_DITHER}} is initially enabled.
The following capabilities are accepted for {{Parameter|cap}}:
{|
|+
! '''Constant'''
! '''See'''
|+
| {{KW|_GL_BLEND}}
| {{KW|_glBlendFunc}}, {{KW|_glLogicOp}}
|+
| {{KW|_GL_CLIP_DISTANCE}}''i''
| {{KW|_glEnable}}
|+
| {{KW|_GL_COLOR_LOGIC_OP}}
| {{KW|_glLogicOp}}
|+
| {{KW|_GL_CULL_FACE}}
| {{KW|_glCullFace}}
|+
| {{KW|_GL_DEPTH_CLAMP}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_DEBUG_OUTPUT}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_DEBUG_OUTPUT_SYNCHRONOUS}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_DEPTH_TEST}}
| {{KW|_glDepthFunc}}, {{KW|_glDepthRange}}
|+
| {{KW|_GL_DITHER}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_FRAMEBUFFER_SRGB}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_LINE_SMOOTH}}
| {{KW|_glLineWidth}}
|+
| {{KW|_GL_MULTISAMPLE}}
| {{KW|_glSampleCoverage}}
|+
| {{KW|_GL_POLYGON_SMOOTH}}
| {{KW|_glPolygonMode}}
|+
| {{KW|_GL_POLYGON_OFFSET_FILL}}
| {{KW|_glPolygonOffset}}
|+
| {{KW|_GL_POLYGON_OFFSET_LINE}}
| {{KW|_glPolygonOffset}}
|+
| {{KW|_GL_POLYGON_OFFSET_POINT}}
| {{KW|_glPolygonOffset}}
|+
| {{KW|_GL_PROGRAM_POINT_SIZE}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_PRIMITIVE_RESTART}}
| {{KW|_glEnable}}, {{KW|_glPrimitiveRestartIndex}}
|+
| {{KW|_GL_SAMPLE_ALPHA_TO_COVERAGE}}
| {{KW|_glSampleCoverage}}
|+
| {{KW|_GL_SAMPLE_ALPHA_TO_ONE}}
| {{KW|_glSampleCoverage}}
|+
| {{KW|_GL_SAMPLE_COVERAGE}}
| {{KW|_glSampleCoverage}}
|+
| {{KW|_GL_SAMPLE_MASK}}
| {{KW|_glEnable}}
|+
| {{KW|_GL_SCISSOR_TEST}}
| {{KW|_glScissor}}
|+
| {{KW|_GL_STENCIL_TEST}}
| {{KW|_glStencilFunc}}, {{KW|_glStencilOp}}
|+
| {{KW|_GL_TEXTURE_CUBEMAP_SEAMLESS}}
| {{KW|_glEnable}}
|}
{{PageNotes}}
If an error is generated, '''_glIsEnabled''' and '''_glIsEnabledi''' return {{KW|_GL_FALSE}}.
{{KW|_GL_DEBUG_OUTPUT}} and {{KW|_GL_DEBUG_OUTPUT_SYNCHRONOUS}} are available only if the GL version is 4.3 or greater.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|cap}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated by '''_glIsEnabledi''' if {{Parameter|index}} is outside the valid range for the indexed state {{Parameter|cap}}.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable}}, {{KW|_glDisable}}, {{KW|_glGet}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2010-2011 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,29 +0,0 @@
'''_glIsTexture:''' determine if a name corresponds to a texture
{{PageSyntax}}
FUNCTION _glIsTexture~%% (BYVAL texture AS _UNSIGNED LONG)
GLboolean '''_glIsTexture'''(GLuint {{Parameter|texture}});
; texture
: Specifies a value that may be the name of a texture.
{{PageDescription}}
'''_glIsTexture''' returns {{KW|_GL_TRUE}} if {{Parameter|texture}} is currently the name of a texture. If {{Parameter|texture}} is zero, or is a non-zero value that is not currently the name of a texture, or if an error occurs, '''_glIsTexture''' returns {{KW|_GL_FALSE}}.
A name returned by {{KW|_glGenTextures}}, but not yet associated with a texture by calling {{KW|_glBindTexture}}, is not the name of a texture.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindTexture}}, {{KW|_glDeleteTextures}}, {{KW|_glGenTextures}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,60 +0,0 @@
'''_glLineWidth:''' specify the width of rasterized lines
{{PageSyntax}}
SUB _glLineWidth (BYVAL width AS SINGLE)
void '''_glLineWidth'''(GLfloat {{Parameter|width}});
; width
: Specifies the width of rasterized lines. The initial value is 1.
{{PageDescription}}
'''_glLineWidth''' specifies the rasterized width of both aliased and antialiased lines. Using a line width other than 1 has different effects, depending on whether line antialiasing is enabled. To enable and disable line antialiasing, call {{KW|_glEnable}} and {{KW|_glDisable}} with argument {{KW|_GL_LINE_SMOOTH}}. Line antialiasing is initially disabled.
If line antialiasing is disabled, the actual width is determined by rounding the supplied width to the nearest integer. (If the rounding results in the value 0, it is as if the line width were 1.) If <math>|\Delta X| \ge |\Delta Y|</math>, ''i'' pixels are filled in each column that is rasterized, where ''i'' is the rounded value of {{Parameter|width}}. Otherwise, ''i'' pixels are filled in each row that is rasterized.
If antialiasing is enabled, line rasterization produces a fragment for each pixel square that intersects the region lying within the rectangle having width equal to the current line width, length equal to the actual length of the line, and centered on the mathematical line segment. The coverage value for each fragment is the window coordinate area of the intersection of the rectangular region with the corresponding pixel square. This value is saved and used in the final rasterization step.
Not all widths can be supported when line antialiasing is enabled. If an unsupported width is requested, the nearest supported width is used. Only width 1 is guaranteed to be supported; others depend on the implementation. Likewise, there is a range for aliased line widths as well. To query the range of supported widths and the size difference between supported widths within the range, call {{KW|_glGet}} with arguments {{KW|_GL_ALIASED_LINE_WIDTH_RANGE}}, {{KW|_GL_SMOOTH_LINE_WIDTH_RANGE}}, and {{KW|_GL_SMOOTH_LINE_WIDTH_GRANULARITY}}.
{{PageNotes}}
The line width specified by '''_glLineWidth''' is always returned when {{KW|_GL_LINE_WIDTH}} is queried. Clamping and rounding for aliased and antialiased lines have no effect on the specified value.
Nonantialiased line width may be clamped to an implementation-dependent maximum. Call {{KW|_glGet}} with {{KW|_GL_ALIASED_LINE_WIDTH_RANGE}} to determine the maximum width.
In OpenGL 1.2, the tokens {{KW|_GL_LINE_WIDTH_RANGE}} and {{KW|_GL_LINE_WIDTH_GRANULARITY}} were replaced by {{KW|_GL_ALIASED_LINE_WIDTH_RANGE}}, {{KW|_GL_SMOOTH_LINE_WIDTH_RANGE}}, and {{KW|_GL_SMOOTH_LINE_WIDTH_GRANULARITY}}. The old names are retained for backward compatibility, but should not be used in new code.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|width}} is less than or equal to 0.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_LINE_WIDTH}}
{{KW|_glGet}} with argument {{KW|_GL_ALIASED_LINE_WIDTH_RANGE}}
{{KW|_glGet}} with argument {{KW|_GL_SMOOTH_LINE_WIDTH_RANGE}}
{{KW|_glGet}} with argument {{KW|_GL_SMOOTH_LINE_WIDTH_GRANULARITY}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_LINE_SMOOTH}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,104 +0,0 @@
'''_glLogicOp:''' specify a logical pixel operation for rendering
{{PageSyntax}}
SUB _glLogicOp (BYVAL opcode AS _UNSIGNED LONG)
void '''_glLogicOp'''(GLenum {{Parameter|opcode}});
; opcode
: Specifies a symbolic constant that selects a logical operation. The following symbols are accepted: {{KW|_GL_CLEAR}}, {{KW|_GL_SET}}, {{KW|_GL_COPY}}, {{KW|_GL_COPY_INVERTED}}, {{KW|_GL_NOOP}}, {{KW|_GL_INVERT}}, {{KW|_GL_AND}}, {{KW|_GL_NAND}}, {{KW|_GL_OR}}, {{KW|_GL_NOR}}, {{KW|_GL_XOR}}, {{KW|_GL_EQUIV}}, {{KW|_GL_AND_REVERSE}}, {{KW|_GL_AND_INVERTED}}, {{KW|_GL_OR_REVERSE}}, and {{KW|_GL_OR_INVERTED}}. The initial value is {{KW|_GL_COPY}}.
{{PageDescription}}
'''_glLogicOp''' specifies a logical operation that, when enabled, is applied between the incoming RGBA color and the RGBA color at the corresponding location in the frame buffer. To enable or disable the logical operation, call {{KW|_glEnable}} and {{KW|_glDisable}} using the symbolic constant {{KW|_GL_COLOR_LOGIC_OP}}. The initial value is disabled.
{|
|+
! '''Opcode'''
! '''Resulting Operation'''
|+
| {{KW|_GL_CLEAR}}
| 0
|+
| {{KW|_GL_SET}}
| 1
|+
| {{KW|_GL_COPY}}
| s
|+
| {{KW|_GL_COPY_INVERTED}}
| ~s
|+
| {{KW|_GL_NOOP}}
| d
|+
| {{KW|_GL_INVERT}}
| ~d
|+
| {{KW|_GL_AND}}
| s & d
|+
| {{KW|_GL_NAND}}
| ~(s & d)
|+
| {{KW|_GL_OR}}
| s | d
|+
| {{KW|_GL_NOR}}
| ~(s | d)
|+
| {{KW|_GL_XOR}}
| s ^ d
|+
| {{KW|_GL_EQUIV}}
| ~(s ^ d)
|+
| {{KW|_GL_AND_REVERSE}}
| s & ~d
|+
| {{KW|_GL_AND_INVERTED}}
| ~s & d
|+
| {{KW|_GL_OR_REVERSE}}
| s | ~d
|+
| {{KW|_GL_OR_INVERTED}}
| ~s | d
|}
{{Parameter|opcode}} is a symbolic constant chosen from the list above. In the explanation of the logical operations, ''s'' represents the incoming color and ''d'' represents the color in the frame buffer. Standard C-language operators are used. As these bitwise operators suggest, the logical operation is applied independently to each bit pair of the source and destination colors.
{{PageNotes}}
When more than one RGBA color buffer is enabled for drawing, logical operations are performed separately for each enabled buffer, using for the destination value the contents of that buffer (see {{KW|_glDrawBuffer}}).
Logic operations have no effect on floating point draw buffers. However, if {{KW|_GL_COLOR_LOGIC_OP}} is enabled, blending is still disabled in this case.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|opcode}} is not an accepted value.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_LOGIC_OP_MODE}}.
{{KW|_glIsEnabled}} with argument {{KW|_GL_COLOR_LOGIC_OP}}.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_COLOR_LOGIC_OP)}}, {{KW|_glDrawBuffer}}, {{KW|_glDrawBuffers}}, {{KW|_glStencilOp}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,54 +0,0 @@
'''_glPointSize:''' specify the diameter of rasterized points
{{PageSyntax}}
SUB _glPointSize (BYVAL size AS SINGLE)
void '''_glPointSize'''(GLfloat {{Parameter|size}});
; size
: Specifies the diameter of rasterized points. The initial value is 1.
{{PageDescription}}
'''_glPointSize''' specifies the rasterized diameter of points. If point size mode is disabled (see {{KW|_glEnable}} with parameter {{KW|_GL_PROGRAM_POINT_SIZE}}), this value will be used to rasterize points. Otherwise, the value written to the shading language built-in variable {{code|gl_PointSize}} will be used.
{{PageNotes}}
The point size specified by '''_glPointSize''' is always returned when {{KW|_GL_POINT_SIZE}} is queried. Clamping and rounding for points have no effect on the specified value.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if {{Parameter|size}} is less than or equal to 0.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_POINT_SIZE_RANGE}}
{{KW|_glGet}} with argument {{KW|_GL_POINT_SIZE_GRANULARITY}}
{{KW|_glGet}} with argument {{KW|_GL_POINT_SIZE}}
{{KW|_glGet}} with argument {{KW|_GL_POINT_SIZE_MIN}}
{{KW|_glGet}} with argument {{KW|_GL_POINT_SIZE_MAX}}
{{KW|_glGet}} with argument {{KW|_GL_POINT_FADE_THRESHOLD_SIZE}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_PROGRAM_POINT_SIZE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_PROGRAM_POINT_SIZE)}}, {{KW|_glPointParameter}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,62 +0,0 @@
'''_glPolygonMode:''' select a polygon rasterization mode
{{PageSyntax}}
SUB _glPolygonMode (BYVAL face AS _UNSIGNED LONG, BYVAL mode AS _UNSIGNED LONG)
void '''_glPolygonMode'''(GLenum {{Parameter|face}}, GLenum {{Parameter|mode}});
; face
: Specifies the polygons that {{Parameter|mode}} applies to. Must be {{KW|_GL_FRONT_AND_BACK}} for front- and back-facing polygons.
; mode
: Specifies how polygons will be rasterized. Accepted values are {{KW|_GL_POINT}}, {{KW|_GL_LINE}}, and {{KW|_GL_FILL}}. The initial value is {{KW|_GL_FILL}} for both front- and back-facing polygons.
{{PageDescription}}
'''_glPolygonMode''' controls the interpretation of polygons for rasterization. {{Parameter|face}} describes which polygons {{Parameter|mode}} applies to: both front and back-facing polygons ({{KW|_GL_FRONT_AND_BACK}}). The polygon mode affects only the final rasterization of polygons. In particular, a polygon's vertices are lit and the polygon is clipped and possibly culled before these modes are applied.
Three modes are defined and can be specified in {{Parameter|mode}}:
; {{KW|_GL_POINT}}
: Polygon vertices that are marked as the start of a boundary edge are drawn as points. Point attributes such as {{KW|_GL_POINT_SIZE}} and {{KW|_GL_POINT_SMOOTH}} control the rasterization of the points. Polygon rasterization attributes other than {{KW|_GL_POLYGON_MODE}} have no effect.
; {{KW|_GL_LINE}}
: Boundary edges of the polygon are drawn as line segments. Line attributes such as {{KW|_GL_LINE_WIDTH}} and {{KW|_GL_LINE_SMOOTH}} control the rasterization of the lines. Polygon rasterization attributes other than {{KW|_GL_POLYGON_MODE}} have no effect.
; {{KW|_GL_FILL}}
: The interior of the polygon is filled. Polygon attributes such as {{KW|_GL_POLYGON_SMOOTH}} control the rasterization of the polygon.
== Examples ==
To draw a surface with outlined polygons, call
<source lang="cpp">
glPolygonMode(, );
</source>
{{PageNotes}}
Vertices are marked as boundary or nonboundary with an edge flag. Edge flags are generated internally by the GL when it decomposes triangle stips and fans.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if either {{Parameter|face}} or {{Parameter|mode}} is not an accepted value.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_POLYGON_MODE}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glLineWidth}}, {{KW|_glPointSize}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,38 +0,0 @@
'''_glPolygonOffset:''' set the scale and units used to calculate depth values
{{PageSyntax}}
SUB _glPolygonOffset (BYVAL factor AS SINGLE, BYVAL units AS SINGLE)
void '''_glPolygonOffset'''(GLfloat {{Parameter|factor}}, GLfloat {{Parameter|units}});
; factor
: Specifies a scale factor that is used to create a variable depth offset for each polygon. The initial value is 0.
; units
: Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.
{{PageDescription}}
When {{KW|_GL_POLYGON_OFFSET_FILL}}, {{KW|_GL_POLYGON_OFFSET_LINE}}, or {{KW|_GL_POLYGON_OFFSET_POINT}} is enabled, each fragment's ''depth'' value will be offset after it is interpolated from the ''depth'' values of the appropriate vertices. The value of the offset is ''factor'' * ''DZ'' + ''r'' * ''units'', where ''DZ'' is a measurement of the change in depth relative to the screen area of the polygon, and ''r'' is the smallest value that is guaranteed to produce a resolvable offset for a given implementation. The offset is added before the depth test is performed and before the value is written into the depth buffer.
'''_glPolygonOffset''' is useful for rendering hidden-line images, for applying decals to surfaces, and for rendering solids with highlighted edges.
{{PageUseWith}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_POLYGON_OFFSET_FILL}}, {{KW|_GL_POLYGON_OFFSET_LINE}}, or {{KW|_GL_POLYGON_OFFSET_POINT}}.
{{KW|_glGet}} with argument {{KW|_GL_POLYGON_OFFSET_FACTOR}} or {{KW|_GL_POLYGON_OFFSET_UNITS}}.
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glDepthFunc}}, {{KW|_glEnable}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,47 +0,0 @@
'''_glReadBuffer:''' select a color buffer source for pixel read operations from the current read framebuffer.
{{PageSyntax}}
SUB _glReadBuffer (BYVAL mode AS _UNSIGNED LONG)
void '''_glReadBuffer'''(GLenum {{Parameter|mode}});
; mode
: Specifies a color buffer. Accepted values are {{KW|_GL_FRONT_LEFT}}, {{KW|_GL_FRONT_RIGHT}}, {{KW|_GL_BACK_LEFT}}, {{KW|_GL_BACK_RIGHT}}, {{KW|_GL_FRONT}}, {{KW|_GL_BACK}}, {{KW|_GL_LEFT}}, {{KW|_GL_RIGHT}}, and the constants {{KW|_GL_COLOR_ATTACHMENT''i''}}.
{{PageDescription}}
'''_glReadBuffer''' specifies which color buffer within the current bound {{KW|_GL_READ_FRAMEBUFFER}} will be used as the source for pixel reading commands. These commands include: {{KW|_glBlitFramebuffer}}, {{KW|_glReadPixels}}, {{KW|_glCopyTexImage1D}}, {{KW|_glCopyTexImage2D}}, {{KW|_glCopyTexSubImage1D}}, {{KW|_glCopyTexSubImage2D}}, and {{KW|_glCopyTexSubImage3D}}.
{{Parameter|mode}} accepts one of twelve or more predefined values. If the [[default framebuffer]] (the zero [[framebuffer object]])is bound to {{KW|_GL_READ_FRAMEBUFFER}}, then the following enumerators can be used: {{KW|_GL_FRONT}}, {{KW|_GL_LEFT}}, and {{KW|_GL_FRONT_LEFT}} all name the front left buffer, {{KW|_GL_FRONT_RIGHT}} and {{KW|_GL_RIGHT}} name the front right buffer, and {{KW|_GL_BACK_LEFT}} and {{KW|_GL_BACK}} name the back left buffer. Nonstereo double-buffered configurations have only a front left and a back left buffer. Single-buffered configurations have a front left and a front right buffer if stereo, and only a front left buffer if nonstereo.
If a non-zero framebuffer object is bound, then the constants {{KW|_GL_COLOR_ATTACHMENT''i''}} may be used to indicate the ''i''<sup>th</sup> color attachment, where ''i'' ranges from zero to the value of {{KW|_GL_MAX_COLOR_ATTACHMENTS}} minus one.
It is an error to specify a nonexistent buffer to '''_glReadBuffer'''.
For the default framebuffer, {{Parameter|mode}} is initially {{KW|_GL_FRONT}} in single-buffered configurations and {{KW|_GL_BACK}} in double-buffered configurations. For framebuffer objects, the default read buffer is {{KW|_GL_COLOR_ATTACHMENT0}}.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|mode}} is not one of the twelve (or more) accepted values.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|mode}} specifies a buffer that does not exist.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_READ_BUFFER}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindFramebuffer}}, {{KW|_glDrawBuffer}}, {{KW|_glDrawBuffers}}, {{KW|_glReadPixels}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. Copyright 2011 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,201 +0,0 @@
'''_glReadPixels:''' read a block of pixels from the frame buffer
{{PageSyntax}}
SUB _glReadPixels (BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL height AS LONG, BYVAL format AS _UNSIGNED LONG, BYVAL type AS _UNSIGNED LONG, pixels AS _OFFSET)
void '''_glReadPixels'''(GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}}, GLenum {{Parameter|format}}, GLenum {{Parameter|type}}, GLvoid * {{Parameter|data}});
; x, y
: Specify the window coordinates of the first pixel that is read from the frame buffer. This location is the lower left corner of a rectangular block of pixels.
; width, height
: Specify the dimensions of the pixel rectangle. {{Parameter|width}} and {{Parameter|height}} of one correspond to a single pixel.
{{Template:Glapi pixeltransferupparams|read=|}}
{{PageDescription}}
'''_glReadPixels''' returns pixel data from the frame buffer, starting with the pixel whose lower left corner is at location ({{Parameter|x}}, {{Parameter|y}}), into client memory starting at location {{Parameter|data}}. Several parameters control the processing of the pixel data before it is placed into client memory. These parameters are set with {{KW|_glPixelStore}}. This reference page describes the effects on '''_glReadPixels''' of most, but not all of the parameters specified by these three commands.
If a non-zero named buffer object is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target (see {{KW|_glBindBuffer}}) while a block of pixels is requested, {{Parameter|data}} is treated as a byte offset into the buffer object's data store rather than a pointer to client memory.
'''_glReadPixels''' returns values from each pixel with lower left corner at (''x'' + ''i'', ''y'' + ''j'') for 0 ≤ ''i'' < ''width'' and 0 ≤ ''j'' < ''height''. This pixel is said to be the ''i''th pixel in the ''j''th row. Pixels are returned in row order from the lowest to the highest row, left to right in each row.
{{Parameter|format}} specifies the format for the returned pixel values; accepted values are:
; {{KW|_GL_STENCIL_INDEX}}
: Stencil values are read from the stencil buffer. Each index is converted to fixed point, shifted left or right depending on the value and sign of {{KW|_GL_INDEX_SHIFT}}, and added to {{KW|_GL_INDEX_OFFSET}}. If {{KW|_GL_MAP_STENCIL}} is {{KW|_GL_TRUE}}, indices are replaced by their mappings in the table {{KW|_GL_PIXEL_MAP_S_TO_S}}.
; {{KW|_GL_DEPTH_COMPONENT}}
: Depth values are read from the depth buffer. Each component is converted to floating point such that the minimum depth value maps to 0 and the maximum value maps to 1. Each component is then multiplied by {{KW|_GL_DEPTH_SCALE}}, added to {{KW|_GL_DEPTH_BIAS}}, and finally clamped to the range [0, 1].
; {{KW|_GL_DEPTH_STENCIL}}
: Values are taken from both the depth and stencil buffers. The {{Parameter|type}} parameter must be {{KW|_GL_UNSIGNED_INT_24_8}} or {{KW|_GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
; {{KW|_GL_RED}}
; {{KW|_GL_GREEN}}
; {{KW|_GL_BLUE}}
; {{KW|_GL_RGB}}
; {{KW|_GL_BGR}}
; {{KW|_GL_RGBA}}
; {{KW|_GL_BGRA}}
: Finally, the indices or components are converted to the proper format, as specified by {{Parameter|type}}. If {{Parameter|format}} is {{KW|_GL_STENCIL_INDEX}} and {{Parameter|type}} is not {{KW|_GL_FLOAT}}, each index is masked with the mask value given in the following table. If {{Parameter|type}} is {{KW|_GL_FLOAT}}, then each integer index is converted to single-precision floating-point format.
If {{Parameter|format}} is {{KW|_GL_RED}}, {{KW|_GL_GREEN}}, {{KW|_GL_BLUE}}, {{KW|_GL_RGB}}, {{KW|_GL_BGR}}, {{KW|_GL_RGBA}}, or {{KW|_GL_BGRA}} and {{Parameter|type}} is not {{KW|_GL_FLOAT}}, each component is multiplied by the multiplier shown in the following table. If type is {{KW|_GL_FLOAT}}, then each component is passed as is (or converted to the client's single-precision floating-point format if it is different from the one used by the GL).
{| class="wikitable"
|+
! {{Parameter|type}}
! '''Index Mask'''
! '''Component Conversion'''
|+
| {{KW|_GL_UNSIGNED_BYTE}}
| 2<sup>8</sup> - 1
| <math>(2^8 - 1)c</math>
|+
| {{KW|_GL_BYTE}}
| 2<sup>7</sup> - 1
| <math>\tfrac{(2^8 - 1)c - 1}{2}</math>
|+
| {{KW|_GL_UNSIGNED_SHORT}}
| 2<sup>16</sup> - 1
| <math>(2^{16} - 1)c</math>
|+
| {{KW|_GL_SHORT}}
| 2<sup>15</sup> - 1
| <math>\tfrac{(2^{16} - 1)c - 1}{2}</math>
|+
| {{KW|_GL_UNSIGNED_INT}}
| 2<sup>32</sup> - 1
| <math>(2^{32} - 1)c</math>
|+
| {{KW|_GL_INT}}
| 2<sup>31</sup> - 1
| <math>\tfrac{(2^{32} - 1)c - 1}{2}</math>
|+
| {{KW|_GL_HALF_FLOAT}}
| none
| ''c''
|+
| {{KW|_GL_FLOAT}}
| none
| ''c''
|+
| {{KW|_GL_UNSIGNED_BYTE_3_3_2}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_BYTE_2_3_3_REV}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_SHORT_5_6_5}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_SHORT_4_4_4_4}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_SHORT_4_4_4_4_REV}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_SHORT_5_5_5_1}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_SHORT_1_5_5_5_REV}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_INT_8_8_8_8}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_INT_8_8_8_8_REV}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_INT_10_10_10_2}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_INT_24_8}}
| 2<sup>N</sup> - 1
| <math>(2^N - 1)c</math>
|+
| {{KW|_GL_UNSIGNED_INT_10F_11F_11F_REV}}
| --
| Special
|+
| {{KW|_GL_UNSIGNED_INT_5_9_9_9_REV}}
| --
| Special
|+
| {{KW|_GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}
| none
| ''c'' (Depth Only)
|}
Return values are placed in memory as follows. If {{Parameter|format}} is {{KW|_GL_STENCIL_INDEX}}, {{KW|_GL_DEPTH_COMPONENT}}, {{KW|_GL_RED}}, {{KW|_GL_GREEN}}, or {{KW|_GL_BLUE}}, a single value is returned and the data for the ''i''th pixel in the ''j''th row is placed in location ''j'' * ''width'' + ''i''. {{KW|_GL_RGB}} and {{KW|_GL_BGR}} return three values, {{KW|_GL_RGBA}} and {{KW|_GL_BGRA}} return four values for each pixel, with all values corresponding to a single pixel occupying contiguous space in {{Parameter|data}}. Storage parameters set by {{KW|_glPixelStore}}, such as {{KW|_GL_PACK_LSB_FIRST}} and {{KW|_GL_PACK_SWAP_BYTES}}, affect the way that data is written into memory. See {{KW|_glPixelStore}} for a description.
{{PageNotes}}
Values for pixels that lie outside the window connected to the current GL context are undefined.
If an error is generated, no change is made to the contents of {{Parameter|data}}.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|format}} or {{Parameter|type}} is not an accepted value.
{{KW|_GL_INVALID_VALUE}} is generated if either {{Parameter|width}} or {{Parameter|height}} is negative.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|format}} is {{KW|_GL_STENCIL_INDEX}} and there is no stencil buffer.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|format}} is {{KW|_GL_DEPTH_COMPONENT}} and there is no depth buffer.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|format}} is {{KW|_GL_DEPTH_STENCIL}} and there is no depth buffer or if there is no stencil buffer.
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|format}} is {{KW|_GL_DEPTH_STENCIL}} and {{Parameter|type}} is not {{KW|_GL_UNSIGNED_INT_24_8}} or {{KW|_GL_FLOAT_32_UNSIGNED_INT_24_8_REV}}.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|type}} is one of {{KW|_GL_UNSIGNED_BYTE_3_3_2}}, {{KW|_GL_UNSIGNED_BYTE_2_3_3_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_6_5}}, or {{KW|_GL_UNSIGNED_SHORT_5_6_5_REV}} and {{Parameter|format}} is not {{KW|_GL_RGB}}.
{{KW|_GL_INVALID_OPERATION}} is generated if {{Parameter|type}} is one of {{KW|_GL_UNSIGNED_SHORT_4_4_4_4}}, {{KW|_GL_UNSIGNED_SHORT_4_4_4_4_REV}}, {{KW|_GL_UNSIGNED_SHORT_5_5_5_1}}, {{KW|_GL_UNSIGNED_SHORT_1_5_5_5_REV}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8}}, {{KW|_GL_UNSIGNED_INT_8_8_8_8_REV}}, {{KW|_GL_UNSIGNED_INT_10_10_10_2}}, or {{KW|_GL_UNSIGNED_INT_2_10_10_10_REV}} and {{Parameter|format}} is neither {{KW|_GL_RGBA}} nor {{KW|_GL_BGRA}}.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target and the buffer object's data store is currently mapped.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target and the data would be packed to the buffer object such that the memory writes required would exceed the data store size.
{{KW|_GL_INVALID_OPERATION}} is generated if a non-zero buffer object name is bound to the {{KW|_GL_PIXEL_PACK_BUFFER}} target and {{Parameter|data}} is not evenly divisible into the number of bytes needed to store in memory a datum indicated by {{Parameter|type}}.
{{KW|_GL_INVALID_OPERATION}} is generated if {{KW|_GL_READ_FRAMEBUFFER_BINDING}} is non-zero, the read framebuffer is complete, and the value of {{KW|_GL_SAMPLE_BUFFERS}} for the read framebuffer is greater than zero.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_INDEX_MODE}}
{{KW|_glGet}} with argument {{KW|_GL_PIXEL_PACK_BUFFER_BINDING}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBindFramebuffer}}, {{KW|_glClampColor}}, {{KW|_glDrawBuffers}}, {{KW|_glDrawBuffers}}, {{KW|_glPixelStore}}
[[Pixel Transfer]], [[Pixel Buffer Object]]
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,45 +0,0 @@
'''_glScissor:''' define the scissor box
{{PageSyntax}}
SUB _glScissor (BYVAL x AS LONG, BYVAL y AS LONG, BYVAL width AS LONG, BYVAL height AS LONG)
void '''_glScissor'''(GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}});
; x, y
: Specify the lower left corner of the scissor box. Initially (0, 0).
; width, height
: Specify the width and height of the scissor box. When a GL context is first attached to a window, {{Parameter|width}} and {{Parameter|height}} are set to the dimensions of that window.
{{PageDescription}}
'''_glScissor''' defines a rectangle, called the scissor box, in window coordinates. The first two arguments, {{Parameter|x}} and {{Parameter|y}}, specify the lower left corner of the box. {{Parameter|width}} and {{Parameter|height}} specify the width and height of the box.
To enable and disable the scissor test, call {{KW|_glEnable}} and {{KW|_glDisable}} with argument {{KW|_GL_SCISSOR_TEST}}. The test is initially disabled. While the test is enabled, only pixels that lie within the scissor box can be modified by drawing commands. Window coordinates have integer values at the shared corners of frame buffer pixels. {{code|glScissor(0,0,1,1)}} allows modification of only the lower left pixel in the window, and {{code|glScissor(0,0,0,0)}} doesn't allow modification of any pixels in the window.
When the scissor test is disabled, it is as though the scissor box includes the entire window.
{{PageErrors}}
{{KW|_GL_INVALID_VALUE}} is generated if either {{Parameter|width}} or {{Parameter|height}} is negative.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_SCISSOR_BOX}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_SCISSOR_TEST}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_SCISSOR_TEST)}}, {{KW|_glScissorArray}}, {{KW|_glScissorIndexed}}, {{KW|_glViewport}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,76 +0,0 @@
'''_glStencilFunc:''' set front and back function and reference value for stencil testing
{{PageSyntax}}
SUB _glStencilFunc (BYVAL func AS _UNSIGNED LONG, BYVAL ref AS LONG, BYVAL mask AS _UNSIGNED LONG)
void '''_glStencilFunc'''(GLenum {{Parameter|func}}, GLint {{Parameter|ref}}, GLuint {{Parameter|mask}});
; func
: Specifies the test function. Eight symbolic constants are valid: {{KW|_GL_NEVER}}, {{KW|_GL_LESS}}, {{KW|_GL_LEQUAL}}, {{KW|_GL_GREATER}}, {{KW|_GL_GEQUAL}}, {{KW|_GL_EQUAL}}, {{KW|_GL_NOTEQUAL}}, and {{KW|_GL_ALWAYS}}. The initial value is {{KW|_GL_ALWAYS}}.
; ref
: Specifies the reference value for the stencil test. {{Parameter|ref}} is clamped to the range [0, 2<sup>n</sup> - 1, where ''n'' is the number of bitplanes in the stencil buffer. The initial value is 0.
; mask
: Specifies a mask that is ANDed with both the reference value and the stored stencil value when the test is done. The initial value is all 1's.
{{PageDescription}}
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. Stencil planes are first drawn into using GL drawing primitives, then geometry and images are rendered using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.
The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the reference value and the value in the stencil buffer. To enable and disable the test, call {{KW|_glEnable}} and {{KW|_glDisable}} with argument {{KW|_GL_STENCIL_TEST}}. To specify actions based on the outcome of the stencil test, call {{KW|_glStencilOp}} or {{KW|_glStencilOpSeparate}}.
There can be two separate sets of {{Parameter|func}}, {{Parameter|ref}}, and {{Parameter|mask}} parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. {{KW|_glStencilFunc}} sets both front and back stencil state to the same values. Use {{KW|_glStencilFuncSeparate}} to set front and back stencil state to different values.
{{Parameter|func}} is a symbolic constant that determines the stencil comparison function. It accepts one of eight values, shown in the following list. {{Parameter|ref}} is an integer reference value that is used in the stencil comparison. It is clamped to the range [0, 2<sup>n</sup> - 1], where ''n'' is the number of bitplanes in the stencil buffer. {{Parameter|mask}} is bitwise ANDed with both the reference value and the stored stencil value, with the ANDed values participating in the comparison.
If ''stencil'' represents the value stored in the corresponding stencil buffer location, the following list shows the effect of each comparison function that can be specified by {{Parameter|func}}. Only if the comparison succeeds is the pixel passed through to the next stage in the rasterization process (see {{KW|_glStencilOp}}). All tests treat ''stencil'' values as unsigned integers in the range [0, 2<sup>n</sup> - 1], where ''n'' is the number of bitplanes in the stencil buffer.
The following values are accepted by {{Parameter|func}}:
; {{KW|_GL_NEVER}}
: Always fails.
; {{KW|_GL_LESS}}
: Passes if ( {{Parameter|ref}} & {{Parameter|mask}} ) < ( ''stencil'' & {{Parameter|mask}} ).
; {{KW|_GL_LEQUAL}}
: Passes if ( {{Parameter|ref}} & {{Parameter|mask}} ) <= ( ''stencil'' & {{Parameter|mask}} ).
; {{KW|_GL_GREATER}}
: Passes if ( {{Parameter|ref}} & {{Parameter|mask}} ) > ( ''stencil'' & {{Parameter|mask}} ).
; {{KW|_GL_GEQUAL}}
: Passes if ( {{Parameter|ref}} & {{Parameter|mask}} ) >= ( ''stencil'' & {{Parameter|mask}} ).
; {{KW|_GL_EQUAL}}
: Passes if ( {{Parameter|ref}} & {{Parameter|mask}} ) = ( ''stencil'' & {{Parameter|mask}} ).
; {{KW|_GL_NOTEQUAL}}
: Passes if ( {{Parameter|ref}} & {{Parameter|mask}} ) != ( ''stencil'' & {{Parameter|mask}} ).
; {{KW|_GL_ALWAYS}}
: Always passes.
{{PageNotes}}
Initially, the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil test always passes.
{{KW|_glStencilFunc}} is the same as calling {{KW|_glStencilFuncSeparate}} with {{Parameter|face}} set to {{KW|_GL_FRONT_AND_BACK}}.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|func}} is not one of the eight accepted values.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_STENCIL_FUNC}}, {{KW|_GL_STENCIL_VALUE_MASK}}, {{KW|_GL_STENCIL_REF}}, {{KW|_GL_STENCIL_BACK_FUNC}}, {{KW|_GL_STENCIL_BACK_VALUE_MASK}}, {{KW|_GL_STENCIL_BACK_REF}}, or {{KW|_GL_STENCIL_BITS}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_STENCIL_TEST}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glEnable|(GL_STENCIL_TEST)}}, {{KW|_glLogicOp}}, {{KW|_glStencilFuncSeparate}}, {{KW|_glStencilMask}}, {{KW|_glStencilMaskSeparate}}, {{KW|_glStencilOp}}, {{KW|_glStencilOpSeparate}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,39 +0,0 @@
'''_glStencilMask:''' control the front and back writing of individual bits in the stencil planes
{{PageSyntax}}
SUB _glStencilMask (BYVAL mask AS _UNSIGNED LONG)
void '''_glStencilMask'''(GLuint {{Parameter|mask}});
; mask
: Specifies a bit mask to enable and disable writing of individual bits in the stencil planes. Initially, the mask is all 1's.
{{PageDescription}}
'''_glStencilMask''' controls the writing of individual bits in the stencil planes. The least significant ''n'' bits of {{Parameter|mask}}, where ''n'' is the number of bits in the stencil buffer, specify a mask. Where a 1 appears in the mask, it's possible to write to the corresponding bit in the stencil buffer. Where a 0 appears, the corresponding bit is write-protected. Initially, all bits are enabled for writing.
There can be two separate {{Parameter|mask}} writemasks; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. {{KW|_glStencilMask}} sets both front and back stencil writemasks to the same values. Use {{KW|_glStencilMaskSeparate}} to set front and back stencil writemasks to different values.
{{PageNotes}}
{{KW|_glStencilMask}} is the same as calling {{KW|_glStencilMaskSeparate}} with {{Parameter|face}} set to {{KW|_GL_FRONT_AND_BACK}}.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_STENCIL_WRITEMASK}}, {{KW|_GL_STENCIL_BACK_WRITEMASK}}, or {{KW|_GL_STENCIL_BITS}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glClear}}, {{KW|_glClearBuffer}}, {{KW|_glColorMask}}, {{KW|_glDepthMask}}, {{KW|_glStencilFunc}}, {{KW|_glStencilFuncSeparate}}, {{KW|_glStencilMaskSeparate}}, {{KW|_glStencilOp}}, {{KW|_glStencilOpSeparate}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

View file

@ -1,76 +0,0 @@
'''_glStencilOp:''' set front and back stencil test actions
{{PageSyntax}}
SUB _glStencilOp (BYVAL fail AS _UNSIGNED LONG, BYVAL zfail AS _UNSIGNED LONG, BYVAL zpass AS _UNSIGNED LONG)
void '''_glStencilOp'''(GLenum {{Parameter|sfail}}, GLenum {{Parameter|dpfail}}, GLenum {{Parameter|dppass}});
; sfail
: Specifies the action to take when the stencil test fails. Eight symbolic constants are accepted: {{KW|_GL_KEEP}}, {{KW|_GL_ZERO}}, {{KW|_GL_REPLACE}}, {{KW|_GL_INCR}}, {{KW|_GL_INCR_WRAP}}, {{KW|_GL_DECR}}, {{KW|_GL_DECR_WRAP}}, and {{KW|_GL_INVERT}}. The initial value is {{KW|_GL_KEEP}}.
; dpfail
: Specifies the stencil action when the stencil test passes, but the depth test fails. {{Parameter|dpfail}} accepts the same symbolic constants as {{Parameter|sfail}}. The initial value is {{KW|_GL_KEEP}}.
; dppass
: Specifies the stencil action when both the stencil test and the depth test pass, or when the stencil test passes and either there is no depth buffer or depth testing is not enabled. {{Parameter|dppass}} accepts the same symbolic constants as {{Parameter|sfail}}. The initial value is {{KW|_GL_KEEP}}.
{{PageDescription}}
Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen. Stenciling is typically used in multipass rendering algorithms to achieve special effects, such as decals, outlining, and constructive solid geometry rendering.
The stencil test conditionally eliminates a pixel based on the outcome of a comparison between the value in the stencil buffer and a reference value. To enable and disable the test, call {{KW|_glEnable}} and {{KW|_glDisable}} with argument {{KW|_GL_STENCIL_TEST}}; to control it, call {{KW|_glStencilFunc}} or {{KW|_glStencilFuncSeparate}}.
There can be two separate sets of {{Parameter|sfail}}, {{Parameter|dpfail}}, and {{Parameter|dppass}} parameters; one affects back-facing polygons, and the other affects front-facing polygons as well as other non-polygon primitives. {{KW|_glStencilOp}} sets both front and back stencil state to the same values. Use {{KW|_glStencilOpSeparate}} to set front and back stencil state to different values.
'''_glStencilOp''' takes three arguments that indicate what happens to the stored stencil value while stenciling is enabled. If the stencil test fails, no change is made to the pixel's color or depth buffers, and {{Parameter|sfail}} specifies what happens to the stencil buffer contents. The following eight actions are possible.
; {{KW|_GL_KEEP}}
: Keeps the current value.
; {{KW|_GL_ZERO}}
: Sets the stencil buffer value to 0.
; {{KW|_GL_REPLACE}}
: Sets the stencil buffer value to ''ref'', as specified by {{KW|_glStencilFunc}}.
; {{KW|_GL_INCR}}
: Increments the current stencil buffer value. Clamps to the maximum representable unsigned value.
; {{KW|_GL_INCR_WRAP}}
: Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value.
; {{KW|_GL_DECR}}
: Decrements the current stencil buffer value. Clamps to 0.
; {{KW|_GL_DECR_WRAP}}
: Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero.
; {{KW|_GL_INVERT}}
: Bitwise inverts the current stencil buffer value.
Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and 2<sup>n</sup> - 1, where ''n'' is the value returned by querying {{KW|_GL_STENCIL_BITS}}.
The other two arguments to '''_glStencilOp''' specify stencil buffer actions that depend on whether subsequent depth buffer tests succeed ({{Parameter|dppass}}) or fail ({{Parameter|dpfail}}) (see {{KW|_glDepthFunc}}). The actions are specified using the same eight symbolic constants as {{Parameter|sfail}}. Note that {{Parameter|dpfail}} is ignored when there is no depth buffer, or when the depth buffer is not enabled. In these cases, {{Parameter|sfail}} and {{Parameter|dppass}} specify stencil action when the stencil test fails and passes, respectively.
{{PageNotes}}
Initially the stencil test is disabled. If there is no stencil buffer, no stencil modification can occur and it is as if the stencil tests always pass, regardless of any call to '''_glStencilOp'''.
{{KW|_glStencilOp}} is the same as calling {{KW|_glStencilOpSeparate}} with {{Parameter|face}} set to {{KW|_GL_FRONT_AND_BACK}}.
{{PageErrors}}
{{KW|_GL_INVALID_ENUM}} is generated if {{Parameter|sfail}}, {{Parameter|dpfail}}, or {{Parameter|dppass}} is any value other than the defined constant values.
{{PageUseWith}}
{{KW|_glGet}} with argument {{KW|_GL_STENCIL_FAIL}}, {{KW|_GL_STENCIL_PASS_DEPTH_PASS}}, {{KW|_GL_STENCIL_PASS_DEPTH_FAIL}}, {{KW|_GL_STENCIL_BACK_FAIL}}, {{KW|_GL_STENCIL_BACK_PASS_DEPTH_PASS}}, {{KW|_GL_STENCIL_BACK_PASS_DEPTH_FAIL}}, or {{KW|_GL_STENCIL_BITS}}
{{KW|_glIsEnabled}} with argument {{KW|_GL_STENCIL_TEST}}
{{PageSeeAlso}}
[[_GL|SUB _GL]]
{{KW|_glBlendFunc}}, {{KW|_glDepthFunc}}, {{KW|_glEnable}}, {{KW|_glLogicOp}}, {{KW|_glStencilFunc}}, {{KW|_glStencilFuncSeparate}}, {{KW|_glStencilMask}}, {{KW|_glStencilMaskSeparate}}, {{KW|_glStencilOpSeparate}}
{{PageCopyright}}
Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see [http://oss.sgi.com/projects/FreeB/ http://oss.sgi.com/projects/FreeB/].

Some files were not shown because too many files have changed in this diff Show more