现在的位置: 首页 > 综合 > 正文

OpenGL 4.3 (Core Profile) – August 6, 2012 spec Fundamental 2.2 Command Syntax

2018年05月27日 ⁄ 综合 ⁄ 共 2214字 ⁄ 字号 评论关闭

In general, a command declaration has the form
rtype Name{1234}{f b s i i64 f d ub us ui ui64}{v}

( [args ,] T arg1, : : :, T argN [, args] );

一句话表示一个函数族。{1234}暗示维度,之后类型描述符,v是vector

Type Descriptor Corresponding GL Type
b byte
s short
i int
i64 int64
f float
d double
ub ubyte
us ushort
ui uint
ui64 uint64

GL Type Description
Bit Width
boolean 1 or more Boolean
byte 8 Signed two’s complement binary integer
ubyte 8 Unsigned binary integer
char 8 Characters making up strings
short 16 Signed two’s complement binary integer
ushort 16 Unsigned binary integer
int 32 Signed two’s complement binary integer
uint 32 Unsigned binary integer
fixed 32 Signed two’s complement 16.16(固定浮点,小数点前后各16)
scaled integer
int64 64 Signed two’s complement binary integer
uint64 64 Unsigned binary integer
sizei 32 Non-negative binary integer size
enum 32 Enumerated binary integer value
intptr ptrbits Signed twos complement binary integer
sizeiptr ptrbits Non-negative binary integer size
sync ptrbits Sync object handle (see section 4.1)
bitfield 32 Bit field
half 16 Half-precision floating-point value
encoded in an unsigned scalar
float 32 Floating-point value
clampf 32 Floating-point value clamped to [0; 1]
double 64 Floating-point value
clampd 64 Floating-point value clamped to [0; 1]


ptrbits is the number of bits required to represent a pointer type; in other words,
types intptr, sizeiptr, and sync must be large enough to store any CPU address.
sync is defined as an anonymous struct pointer in the C language bindings
while intptr and sizeiptr are defined as integer types large enough to hold
a pointer.

When the type of internal state is boolean, zero integer or floating-point values
are converted to FALSE and non-zero values are converted to TRUE.
When the type of internal state is integer or enum, boolean values of FALSE
and TRUE are converted to 0 and 1, respectively. Floating-point values are
rounded to the nearest integer.
When the type of internal state is floating-point, boolean values of FALSE
and TRUE are converted to 0:0 and 1:0, respectively. Integer values are converted
to floating-point, with or without normalization as described for specific
commands.

三种情况下bool值的确定

If a command returning integer data is called, such as GetIntegerv or Get-
Integer64v, a boolean value of TRUE or FALSE is interpreted as 1 or 0, respectively.
A floating-point value is rounded to the nearest integer, unless the
value is an RGBA color component, a DepthRange value, or a depth buffer
clear value. In these cases, the query command converts the floating-point
value to an integer according to the INT entry of table 18.2; a value not in
[

抱歉!评论已关闭.