Match js attribute layout

This commit is contained in:
John Firebaugh
2014-09-05 13:40:45 -07:00
parent 9d5f02ccaa
commit 4c0b4a7901
2 changed files with 18 additions and 17 deletions

View File

@@ -19,14 +19,15 @@ size_t TextVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, uint16_t
shorts[3] = std::round(oy * 64);
uint8_t *ubytes = static_cast<uint8_t *>(data);
ubytes[8] = tx / 4;
ubytes[9] = ty / 4;
ubytes[10] = labelminzoom * 10;
ubytes[11] = minzoom * 10; // 1/10 zoom levels: z16 == 160.
ubytes[12] = fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
ubytes[13] = (int16_t)round(angle * angleFactor) % 256;
ubytes[14] = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256;
ubytes[15] = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256;
ubytes[8] = labelminzoom * 10;
ubytes[9] = minzoom * 10; // 1/10 zoom levels: z16 == 160.
ubytes[10] = fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
ubytes[11] = (int16_t)round(angle * angleFactor) % 256;
ubytes[12] = util::max((int16_t)std::round(range[0] * angleFactor), (int16_t)0) % 256;
ubytes[13] = util::min((int16_t)std::round(range[1] * angleFactor), (int16_t)255) % 256;
ubytes[14] = tx / 4;
ubytes[15] = ty / 4;
return idx;
}

View File

@@ -35,29 +35,29 @@ void SDFShader::bind(char *offset) {
glEnableVertexAttribArray(a_offset);
glVertexAttribPointer(a_offset, 2, GL_SHORT, false, 16, offset + 4);
glEnableVertexAttribArray(a_tex);
glVertexAttribPointer(a_tex, 2, GL_UNSIGNED_BYTE, false, 16, offset + 8);
glEnableVertexAttribArray(a_labelminzoom);
glVertexAttribPointer(a_labelminzoom, 1, GL_UNSIGNED_BYTE, false, 16,
offset + 10);
offset + 8);
glEnableVertexAttribArray(a_minzoom);
glVertexAttribPointer(a_minzoom, 1, GL_UNSIGNED_BYTE, false, 16,
offset + 11);
offset + 9);
glEnableVertexAttribArray(a_maxzoom);
glVertexAttribPointer(a_maxzoom, 1, GL_UNSIGNED_BYTE, false, 16,
offset + 12);
offset + 10);
glEnableVertexAttribArray(a_angle);
glVertexAttribPointer(a_angle, 1, GL_UNSIGNED_BYTE, false, 16, offset + 13);
glVertexAttribPointer(a_angle, 1, GL_UNSIGNED_BYTE, false, 16, offset + 11);
glEnableVertexAttribArray(a_rangeend);
glVertexAttribPointer(a_rangeend, 1, GL_UNSIGNED_BYTE, false, 16,
offset + 14);
offset + 12);
glEnableVertexAttribArray(a_rangestart);
glVertexAttribPointer(a_rangestart, 1, GL_UNSIGNED_BYTE, false, 16,
offset + 15);
offset + 13);
glEnableVertexAttribArray(a_tex);
glVertexAttribPointer(a_tex, 2, GL_UNSIGNED_BYTE, false, 16, offset + 14);
}