Commit Graph

35 Commits

Author SHA1 Message Date
Konstantin Käfer
e67abfbe67 [core] Refactor OpenGL extension loading mechanism
Previously, we initialized global variables that held pointers to the extension functions. While this seemed to work, the spec doesn't guarantee that the function pointers are identical for different OpenGL contexts. Therefore, we are now making them a member variable of the Context object.
2017-03-23 14:50:11 -07:00
Konstantin Käfer
3c91b6b7de [core] cache binary shaders on Android 2017-03-22 15:59:10 +01:00
John Firebaugh
4e752f63b9 [core] Redo approach to unsupported VAO extension 2017-02-20 08:24:42 -08:00
John Firebaugh
0bbc6b814c [core] Restore support for GL implementations without VAO extension 2017-02-10 18:04:45 -06:00
John Firebaugh
141e995806 [core] Add support for data-driven styling 2017-02-02 09:44:42 -08:00
John Firebaugh
c12b52c6a7 [core] Fix debug rendering
* Off-by-one in DebugBucket indexing
* Must unbind VAO before binding index buffer in Context::createIndexBuffer
2016-12-13 09:42:46 -08:00
John Firebaugh
54c557d982 [core] Use indexed rendering everywhere 2016-12-01 08:57:11 -08:00
Konstantin Käfer
e76de05402 [build] move logging to util 2016-11-22 20:58:51 +01:00
John Firebaugh
9d2be04461 [core] Return to static, per-segment approach to VAOs
This is safer now -- it can be an implementation detail of Segment/Context. And the typing of SegmentVector now ensures that the attributes and program match.
2016-11-15 13:55:08 -08:00
John Firebaugh
58877d1b3d [core] Assign attribute locations sequentially
Two reasons to prefer explicit sequential location assignment, rather than relying on the GLSL linker to assign locations:

* For data-driven properties, we want to have the option to use glDisableVertexAttribArray plus glVertexAttrib*. In order to use glDisableVertexAttribArray, we must avoid using attribute location 0, which cannot be disabled.
* We want to use the same VAO in cases where, say, a fill layer might be rendered with FillProgram at first, and then FillPatternProgram later. VAOs do not store the program binding, only the attribute bindings, so as long as the two programs have the same attributes and attribute locations, only a single VAO (per segment) is needed.
2016-11-15 13:55:08 -08:00
John Firebaugh
1db2ffbc1b [core] Use gl::Program to resolve some rough edges in the GL binding types
* Extract `ignore` util to separate header.
* `Segment` now tracks offset and length of indices, rather than primitives. This is more natural.
* Introduce `VertexVector` and `IndexVector` types. These types carry information about the intended draw mode (`Triangles`, `LineStrip`, etc.), and ensure that elements are always appended in a group size appropriate for that draw mode, for both indexed and unindexed rendering.
* `Program`, rather than `Drawable`, is now the unifying object for draw calls. `Program` is the best place to type check the draw call, because it is typed to carry information about the intended primitive, vertex type, attributes, and uniforms.
* Use the debug shaders for debug tile rendering, like gl-js.
* Fix the draw mode for background. It was drawing triangle strips with a triangles array. Surprised this didn’t cause issues. Now it’s type checked.
2016-11-08 08:09:29 -08:00
John Firebaugh
66bdbc3b96 [core] Introduce gl::Program template 2016-11-08 08:09:29 -08:00
John Firebaugh
36210fe4e9 [core] Make attribute binding more similar to uniform binding 2016-11-08 08:09:28 -08:00
Konstantin Käfer
7b772611d5 [core] move pixel blitting to gl::Context 2016-11-04 21:24:05 +01:00
Konstantin Käfer
c90a559599 [core] move framebuffer reading to gl::Context 2016-11-04 21:24:05 +01:00
Konstantin Käfer
eed16cb1bb [core] add state tracking to pixel transfer 2016-11-04 21:24:05 +01:00
Konstantin Käfer
008a83b915 [core] add state tracking to pixel store packing alignment 2016-11-04 21:24:05 +01:00
Konstantin Käfer
ed155460d3 [core] convert LineAtlas to use managed texture handling 2016-11-01 18:41:52 +01:00
Konstantin Käfer
358701f475 [core] add ability to upload alpha-only textures + images 2016-11-01 18:41:52 +01:00
Konstantin Käfer
9e3839781f [core] convert SpriteAtlas to use managed texture handling 2016-11-01 18:41:52 +01:00
John Firebaugh
39d5cb3250 [core] Use VAOs internally 2016-10-28 17:14:07 -07:00
John Firebaugh
0e57d10d77 [core] Modern C++ bindings for OpenGL 2016-10-28 17:14:01 -07:00
Konstantin Käfer
62b56b799a [core] change std::array<uint16_t, 2> to mbgl::Size 2016-10-27 18:30:58 -07:00
Konstantin Käfer
a4d259c33f [core] move gl::Context to Backend and refactor View 2016-10-25 13:52:36 -07:00
John Firebaugh
e4310aa874 [core] Improve attribute binding API 2016-10-05 10:52:19 -07:00
John Firebaugh
7a3bef091e [core] Refactor Buffer 2016-10-05 10:52:19 -07:00
Konstantin Käfer
07315711d6 [core] remove Raster object in favor of a more low-level Texture object 2016-10-04 14:00:30 -07:00
Konstantin Käfer
2ec2860ce5 [core] move OpenGL extension loading to their own headers 2016-09-29 13:19:27 -07:00
Konstantin Käfer
cc78b74098 [core] remove dependence on gl.h types 2016-09-29 10:17:47 -07:00
Konstantin Käfer
15aece8a30 [core] introduces types for GL objects 2016-09-29 10:17:47 -07:00
Konstantin Käfer
d1a84d9b51 [core] rename VAO => VertexArray, FBO => Framebuffer 2016-09-29 10:17:47 -07:00
Konstantin Käfer
1777b8757a [core] don't iterate over references to uint32_t 2016-09-28 19:03:03 +02:00
Konstantin Käfer
068732fc9e [core] don't iterate too much over program objects scheduled for deletion 2016-09-28 19:03:03 +02:00
John Firebaugh
aa0fc68fea [core] Mark tracked state as dirty when the tracked object is destroyed 2016-09-28 10:54:48 +02:00
Konstantin Käfer
44c7e9d05e [core] merge gl::ObjectStore into gl::Context 2016-09-27 11:03:29 -07:00