GlScissor: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:_glScissor}}
{{DISPLAYTITLE:_glScissor}}
This will define the scissor box.
The '''_glScissor''' statement defines the scissor box.




{{PageSyntax}}
{{PageSyntax}}
; QB64: SUB [[_glScissor]] (BYVAL {{Parameter|x}} AS LONG, BYVAL {{Parameter|y}} AS LONG, BYVAL {{Parameter|width}} AS LONG, BYVAL {{Parameter|height}}) AS LONG)
: [[_glScissor]] GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}}
; C/C++: void [[_glScissor]](GLint {{Parameter|x}}, GLint {{Parameter|y}}, GLsizei {{Parameter|width}}, GLsizei {{Parameter|height}});




{{PageParameters}}
{{PageParameters}}
;x, y: Specify the lower left corner of the scissor box. Initially (0, 0).
* OpenGL is using its own set of variable types to describe its command parameters.
; 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.
* Use the following table to find the respective QB64 [[Variable Types]].
{{OpenGLTypesPlugin}}




{{PageDescription}}
{{PageDescription}}
 
* OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
'''_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.
* The full description for this command can be found at [https://learn.microsoft.com/en-us/windows/win32/opengl/glscissor Microsoft Docs] and is also valid for QB64 usage.
 
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. {{InlineCode}}_glScissor(0,0,1,1){{InlineCodeEnd}} allows modification of only the lower left pixel in the window, and {{InlineCode}}_glScissor(0,0,0,0){{InlineCodeEnd}} 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}}
{{PageSeeAlso}}
 
* [[_GL|SUB _GL]]
[[_GL|SUB _GL]]
* [[_glBegin]], [[_glEnable]], [[_glEnd]], [[_glIsEnabled]]
{{KW|_glEnable|(GL_SCISSOR_TEST)}}, {{KW|_glScissorArray}}, {{KW|_glScissorIndexed}}, {{KW|_glViewport}}
* [[_glViewport]]




{{PageCopyright}}
{{PageNavigation}}

Latest revision as of 01:36, 28 January 2023

The _glScissor statement defines the scissor box.


Syntax

_glScissor GLint x, GLint y, GLsizei width, GLsizei height


Parameters

  • OpenGL is using its own set of variable types to describe its command parameters.
  • Use the following table to find the respective QB64 Variable Types.
   Table 2: Relations between the OpenGL variable types vs. C/C++ and QB64.
 ┌──────────────┬────────────────┬──────────────────────────────────────────┐
 │    OpenGLC/C++QB64                                 │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLenum       │ unsigned int   │ _UNSIGNED LONG                           │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLboolean    │ unsigned char  │ _UNSIGNED _BYTE                          │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLbitfield   │ unsigned int   │ _UNSIGNED LONG                           │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLbyte       │ signed char    │ _BYTE                                    │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLshort      │ short          │ INTEGER                                  │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLint        │ int            │ LONG                                     │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLsizei      │ int            │ LONG                                     │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLubyte      │ unsigned char  │ _UNSIGNED _BYTE                          │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLushort     │ unsigned short │ _UNSIGNED INTEGER                        │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLuint       │ unsigned int   │ _UNSIGNED LONG                           │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLfloat      │ float          │ SINGLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLclampf     │ float          │ SINGLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLdouble     │ double         │ DOUBLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLclampd     │ double         │ DOUBLE                                   │
 ├──────────────┼────────────────┼──────────────────────────────────────────┤
 │ GLvoid   (1) │ void           │ _OFFSET(any fixed lenght string or _BYTE │
 │              │                │         array element)                   │
 └──────────────┴────────────────┴──────────────────────────────────────────┘
 Note: If a parameter has an asterisk (*) in front, then it's a pointer to
       the designated OpenGL variable type, rather than a value of that type.
       Those must be passed using the _OFFSET(...) notation.

 E.g.  GLuint *anyParam is actually the offset of a _UNSIGNED LONG (~&)
       variable or array, which must be passed as _OFFSET(anyVar~&) or
       _OFFSET(anyArr~&()) respectively.

  (1)  This type is regularly only used for pointers (with asterisk (*)) to
       any byte sized memory data, hence _BYTE or fixed length strings.


Description

  • OpenGL's documentation is available in several places, so we won't reproduce it here for another time.
  • The full description for this command can be found at Microsoft Docs and is also valid for QB64 usage.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link