Webgl points / handle using short instead of int for indices

This is controlled by the availability of the OES_element_index_uint
webgl extension.
This commit is contained in:
Olivier Guyot
2019-05-18 16:23:42 +02:00
parent e0983cb1c6
commit 03e70bd10e
4 changed files with 56 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
* @module ol/renderer/webgl/PointsLayer
*/
import WebGLArrayBuffer from '../../webgl/Buffer.js';
import {DYNAMIC_DRAW, ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, FLOAT} from '../../webgl.js';
import {DYNAMIC_DRAW, ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, FLOAT, EXTENSIONS as WEBGL_EXTENSIONS} from '../../webgl.js';
import {DefaultAttrib, DefaultUniform} from '../../webgl/Helper.js';
import GeometryType from '../../geom/GeometryType.js';
import WebGLLayerRenderer, {
@@ -19,6 +19,7 @@ import {
apply as applyTransform
} from '../../transform.js';
import {create as createWebGLWorker} from '../../worker/webgl.js';
import {includes} from '../../array.js';
const VERTEX_SHADER = `
precision mediump float;
@@ -419,7 +420,8 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
/** @type import('./Layer').WebGLWorkerGenerateBuffersMessage */
const message = {
type: WebGLWorkerMessageType.GENERATE_BUFFERS,
renderInstructions: this.renderInstructions_.buffer
renderInstructions: this.renderInstructions_.buffer,
useShortIndices: !includes(WEBGL_EXTENSIONS, 'OES_element_index_uint')
};
// additional properties will be sent back as-is by the worker
message['projectionTransform'] = projectionTransform;