* Returns the string version of a WebGL argument. * Attempts to convert enum arguments to strings. * @param {string} functionName the name of the WebGL function. * @param {number} numArgs the number of arguments passed to the function. * @param {number} argumentIndx the index of the argument. *
(functionName, numArgs, argumentIndex, value)
| 34521 | * @return {string} The value as a string. |
| 34522 | */ |
| 34523 | function glFunctionArgToString(functionName, numArgs, argumentIndex, value) { |
| 34524 | var funcInfo = glValidEnumContexts[functionName]; |
| 34525 | if (funcInfo !== undefined) { |
| 34526 | var funcInfo = funcInfo[numArgs]; |
| 34527 | if (funcInfo !== undefined) { |
| 34528 | if (funcInfo[argumentIndex]) { |
| 34529 | if (typeof funcInfo[argumentIndex] === 'object' && |
| 34530 | funcInfo[argumentIndex]['enumBitwiseOr'] !== undefined) { |
| 34531 | var enums = funcInfo[argumentIndex]['enumBitwiseOr']; |
| 34532 | var orResult = 0; |
| 34533 | var orEnums = []; |
| 34534 | for (var i = 0; i < enums.length; ++i) { |
| 34535 | var enumValue = enumStringToValue[enums[i]]; |
| 34536 | if ((value & enumValue) !== 0) { |
| 34537 | orResult |= enumValue; |
| 34538 | orEnums.push(glEnumToString(enumValue)); |
| 34539 | } |
| 34540 | } |
| 34541 | if (orResult === value) { |
| 34542 | return orEnums.join(' | '); |
| 34543 | } else { |
| 34544 | return glEnumToString(value); |
| 34545 | } |
| 34546 | } else { |
| 34547 | return glEnumToString(value); |
| 34548 | } |
| 34549 | } |
| 34550 | } |
| 34551 | } |
| 34552 | if (value === null) { |
| 34553 | return "null"; |
| 34554 | } else if (value === undefined) { |
| 34555 | return "undefined"; |
| 34556 | } else { |
| 34557 | return value.toString(); |
| 34558 | } |
| 34559 | } |
| 34560 | |
| 34561 | /** |
| 34562 | * Converts the arguments of a WebGL function to a string. |
no test coverage detected