本文整理汇总了C++中MBGL_CHECK_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ MBGL_CHECK_ERROR函数的具体用法?C++ MBGL_CHECK_ERROR怎么用?C++ MBGL_CHECK_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MBGL_CHECK_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: showDebugImage
void showDebugImage(std::string name, const char *data, size_t width, size_t height) {
glfwInit();
static GLFWwindow *debugWindow = nullptr;
if (!debugWindow) {
debugWindow = glfwCreateWindow(width, height, name.c_str(), nullptr, nullptr);
if (!debugWindow) {
glfwTerminate();
fprintf(stderr, "Failed to initialize window\n");
exit(1);
}
}
GLFWwindow *currentWindow = glfwGetCurrentContext();
glfwSetWindowSize(debugWindow, width, height);
glfwMakeContextCurrent(debugWindow);
int fbWidth, fbHeight;
glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight);
float scale = static_cast<float>(fbWidth) / static_cast<float>(width);
{
gl::PreservePixelZoom pixelZoom;
gl::PreserveRasterPos rasterPos;
MBGL_CHECK_ERROR(glPixelZoom(scale, -scale));
MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, 1.0f));
MBGL_CHECK_ERROR(glDrawPixels(width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, data));
}
glfwSwapBuffers(debugWindow);
glfwMakeContextCurrent(currentWindow);
}
开发者ID:kongx73,项目名称:mapbox-gl-native,代码行数:35,代码来源:glfw_view.cpp
示例2: Get
inline static Type Get() {
GLint sfail, dpfail, dppass;
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_FAIL, &sfail));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &dpfail));
MBGL_CHECK_ERROR(glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &dppass));
return { static_cast<GLenum>(sfail), static_cast<GLenum>(dpfail), static_cast<GLuint>(dppass) };
}
开发者ID:vfaSonnt,项目名称:mapbox-gl-native,代码行数:7,代码来源:gl_config.hpp
示例3: MBGL_CHECK_ERROR
void LinepatternShader::bind(GLbyte* offset) {
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_pos, 2, GL_SHORT, false, 8, offset + 0));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_data));
MBGL_CHECK_ERROR(glVertexAttribPointer(a_data, 4, GL_UNSIGNED_BYTE, false, 8, offset + 4));
}
开发者ID:Budroid,项目名称:mapbox-gl-native,代码行数:7,代码来源:linepattern_shader.cpp
示例4: MBGL_CHECK_ERROR
void Painter::renderClipMasks() {
config.stencilTest = GL_FALSE;
config.depthTest = GL_FALSE;
config.program = 0;
config.colorMask = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE };
#ifndef GL_ES_VERSION_2_0
config.pixelZoom = { 1, 1 };
config.rasterPos = {{ -1, -1, 0, 0 }};
// Read the stencil buffer
const auto& fbSize = frame.framebufferSize;
auto pixels = std::make_unique<uint8_t[]>(fbSize[0] * fbSize[1]);
MBGL_CHECK_ERROR(glReadPixels(
0, // GLint x
0, // GLint y
fbSize[0], // GLsizei width
fbSize[1], // GLsizei height
GL_STENCIL_INDEX, // GLenum format
GL_UNSIGNED_BYTE, // GLenum type
pixels.get() // GLvoid * data
));
// Scale the Stencil buffer to cover the entire color space.
auto it = pixels.get();
auto end = it + fbSize[0] * fbSize[1];
const auto factor = 255.0f / *std::max_element(it, end);
for (; it != end; ++it) {
*it *= factor;
}
MBGL_CHECK_ERROR(glWindowPos2i(0, 0));
MBGL_CHECK_ERROR(glDrawPixels(fbSize[0], fbSize[1], GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels.get()));
#endif // GL_ES_VERSION_2_0
}
开发者ID:ShurupuS,项目名称:mapbox-gl-native,代码行数:35,代码来源:painter_debug.cpp
示例5: MBGL_CHECK_ERROR
void ObjectStore::performCleanup() {
for (GLuint id : abandonedPrograms) {
MBGL_CHECK_ERROR(glDeleteProgram(id));
}
abandonedPrograms.clear();
for (GLuint id : abandonedShaders) {
MBGL_CHECK_ERROR(glDeleteShader(id));
}
abandonedShaders.clear();
if (!abandonedBuffers.empty()) {
MBGL_CHECK_ERROR(glDeleteBuffers(int(abandonedBuffers.size()), abandonedBuffers.data()));
abandonedBuffers.clear();
}
if (!abandonedTextures.empty()) {
MBGL_CHECK_ERROR(glDeleteTextures(int(abandonedTextures.size()), abandonedTextures.data()));
abandonedTextures.clear();
}
if (!abandonedVAOs.empty()) {
MBGL_CHECK_ERROR(gl::DeleteVertexArrays(int(abandonedVAOs.size()), abandonedVAOs.data()));
abandonedVAOs.clear();
}
}
开发者ID:Budroid,项目名称:mapbox-gl-native,代码行数:26,代码来源:object_store.cpp
示例6: glPixelTransferf
void Painter::renderDepthBuffer() {
context.stencilTest = GL_FALSE;
context.depthTest = GL_FALSE;
context.program = 0;
context.colorMask = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE };
#ifndef GL_ES_VERSION_2_0
context.pixelZoom = { 1, 1 };
context.rasterPos = {{ -1, -1, 0, 0 }};
// Read the stencil buffer
const auto& fbSize = frame.framebufferSize;
auto pixels = std::make_unique<GLubyte[]>(fbSize[0] * fbSize[1]);
const double base = 1.0 / (1.0 - depthRangeSize);
glPixelTransferf(GL_DEPTH_SCALE, base);
glPixelTransferf(GL_DEPTH_BIAS, 1.0 - base);
MBGL_CHECK_ERROR(glReadPixels(
0, // GLint x
0, // GLint y
fbSize[0], // GLsizei width
fbSize[1], // GLsizei height
GL_DEPTH_COMPONENT, // GLenum format
GL_UNSIGNED_BYTE, // GLenum type
pixels.get() // GLvoid * data
));
MBGL_CHECK_ERROR(glWindowPos2i(0, 0));
MBGL_CHECK_ERROR(glDrawPixels(fbSize[0], fbSize[1], GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels.get()));
#endif // GL_ES_VERSION_2_0
}
开发者ID:OrdnanceSurvey,项目名称:mapbox-gl-native,代码行数:32,代码来源:painter_debug.cpp
示例7: end_group
inline void end_group() {
if (gl::PopDebugGroup != nullptr) {
MBGL_CHECK_ERROR(gl::PopDebugGroup());
} else if (gl::PopGroupMarkerEXT != nullptr) {
MBGL_CHECK_ERROR(gl::PopGroupMarkerEXT());
}
// indent--;
}
开发者ID:andrewstay,项目名称:mapbox-gl-native,代码行数:8,代码来源:gl.hpp
示例8: MBGL_CHECK_ERROR
void Raster::updateFilter() {
MBGL_CHECK_ERROR(glTexParameteri(
GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
filter == Scaling::Linear
? (mipmap == MipMap::Yes ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR)
: (mipmap == MipMap::Yes ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST)));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
filter == Scaling::Linear ? GL_LINEAR : GL_NEAREST));
}
开发者ID:OrdnanceSurvey,项目名称:mapbox-gl-native,代码行数:9,代码来源:raster.cpp
示例9: start_group
// static int indent = 0;
inline void start_group(const std::string &str) {
if (gl::PushDebugGroup != nullptr) {
MBGL_CHECK_ERROR(gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str()));
} else if (gl::PushGroupMarkerEXT != nullptr) {
MBGL_CHECK_ERROR(gl::PushGroupMarkerEXT(GLsizei(str.size() + 1), str.c_str()));
}
// fprintf(stderr, "%s%s\n", std::string(indent * 4, ' ').c_str(), str.c_str());
// indent++;
}
开发者ID:andrewstay,项目名称:mapbox-gl-native,代码行数:10,代码来源:gl.hpp
示例10: enable
void enable() {
if (!DebugMessageControl || !DebugMessageCallback) {
return;
}
// This will enable all messages including performance hints
//MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE));
// This will only enable high and medium severity messages
MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, nullptr, GL_TRUE));
MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM, 0, nullptr, GL_TRUE));
MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_NOTIFICATION, 0, nullptr, GL_FALSE));
MBGL_CHECK_ERROR(DebugMessageCallback(debugCallback, nullptr));
}
开发者ID:AJcravea,项目名称:mapbox-gl-native,代码行数:15,代码来源:debugging.cpp
示例11: MBGL_CHECK_ERROR
void VertexArrayObject::bindVertexArrayObject() {
if (!GenVertexArrays || !BindVertexArray) {
static bool reported = false;
if (!reported) {
Log::Warning(Event::OpenGL, "Not using Vertex Array Objects");
reported = true;
}
return;
}
if (!vao) {
MBGL_CHECK_ERROR(GenVertexArrays(1, &vao));
}
MBGL_CHECK_ERROR(BindVertexArray(vao));
}
开发者ID:Dyziorek,项目名称:mapbox-gl-native,代码行数:15,代码来源:vao.cpp
示例12: MBGL_DEBUG_GROUP
void Painter::drawClippingMasks(PaintParameters& parameters, const std::map<UnwrappedTileID, ClipID>& stencils) {
MBGL_DEBUG_GROUP("clipping masks");
auto& plainShader = parameters.shaders.plain;
auto& arrayCoveringPlain = parameters.shaders.coveringPlainArray;
mat4 matrix;
const GLuint mask = 0b11111111;
config.program = plainShader.getID();
config.stencilOp.reset();
config.stencilTest = GL_TRUE;
config.depthTest = GL_FALSE;
config.depthMask = GL_FALSE;
config.colorMask = { GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE };
config.stencilMask = mask;
arrayCoveringPlain.bind(plainShader, tileStencilBuffer, BUFFER_OFFSET_0, store);
for (const auto& stencil : stencils) {
const auto& id = stencil.first;
const auto& clip = stencil.second;
MBGL_DEBUG_GROUP(std::string{ "mask: " } + util::toString(id));
state.matrixFor(matrix, id);
matrix::multiply(matrix, projMatrix, matrix);
plainShader.u_matrix = matrix;
const GLint ref = (GLint)(clip.reference.to_ulong());
config.stencilFunc = { GL_ALWAYS, ref, mask };
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index()));
}
}
开发者ID:Budroid,项目名称:mapbox-gl-native,代码行数:33,代码来源:painter_clipping.cpp
示例13: MBGL_CHECK_ERROR
void AttributeBinding<T, N>::bind(Context& context, AttributeLocation location, std::size_t vertexOffset) const {
// FillProgram will attempt to bind at location -1 because it includes
// a fill-outline-color paint property but does not use it or have an
// a_outline_color shader attribute - in this case, we have nothing to bind.
if (location == -1) return;
context.vertexBuffer = vertexBuffer;
MBGL_CHECK_ERROR(glEnableVertexAttribArray(location));
MBGL_CHECK_ERROR(glVertexAttribPointer(
location,
static_cast<GLint>(attributeSize),
static_cast<GLenum>(DataTypeOf<T>),
static_cast<GLboolean>(false),
static_cast<GLsizei>(vertexSize),
reinterpret_cast<GLvoid*>(attributeOffset + (vertexSize * vertexOffset))));
}
开发者ID:tabsong,项目名称:mapbox-gl-native,代码行数:16,代码来源:attribute.cpp
示例14: bind
// Transfers this buffer to the GPU and binds the buffer to the GL context.
void bind() {
if (buffer) {
MBGL_CHECK_ERROR(glBindBuffer(bufferType, buffer));
} else {
MBGL_CHECK_ERROR(glGenBuffers(1, &buffer));
MBGL_CHECK_ERROR(glBindBuffer(bufferType, buffer));
if (array == nullptr) {
Log::Debug(Event::OpenGL, "Buffer doesn't contain elements");
pos = 0;
}
MBGL_CHECK_ERROR(glBufferData(bufferType, pos, array, GL_STATIC_DRAW));
if (!retainAfterUpload) {
cleanup();
}
}
}
开发者ID:vfaSonnt,项目名称:mapbox-gl-native,代码行数:17,代码来源:buffer.hpp
示例15: bind
// Transfers this buffer to the GPU and binds the buffer to the GL context.
void bind(gl::ObjectStore& store) {
if (buffer) {
MBGL_CHECK_ERROR(glBindBuffer(bufferType, *buffer));
} else {
buffer = store.createBuffer();
MBGL_CHECK_ERROR(glBindBuffer(bufferType, *buffer));
if (array == nullptr) {
Log::Debug(Event::OpenGL, "Buffer doesn't contain elements");
pos = 0;
}
MBGL_CHECK_ERROR(glBufferData(bufferType, pos, array, GL_STATIC_DRAW));
if (!retainAfterUpload) {
cleanup();
}
}
}
开发者ID:EricAlex,项目名称:mapbox-gl-native,代码行数:17,代码来源:buffer.hpp
示例16: MBGL_CHECK_ERROR
void FrameHistory::bind(gl::ObjectStore& store, gl::Config& config, uint32_t unit) {
if (!texture) {
texture = store.createTexture();
config.activeTexture = unit;
config.texture[unit] = *texture;
#ifndef GL_ES_VERSION_2_0
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0));
#endif
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
} else if (config.texture[unit] != *texture) {
config.activeTexture = unit;
config.texture[unit] = *texture;
}
}
开发者ID:Budroid,项目名称:mapbox-gl-native,代码行数:17,代码来源:frame_history.cpp
示例17: MBGL_CHECK_ERROR
void SymbolBucket::drawCollisionBoxes(CollisionBoxShader &shader) {
GLbyte *vertex_index = BUFFER_OFFSET_0;
auto& collisionBox = renderData->collisionBox;
for (auto &group : collisionBox.groups) {
group->array[0].bind(shader, collisionBox.vertices, vertex_index);
MBGL_CHECK_ERROR(glDrawArrays(GL_LINES, 0, group->vertex_length));
}
}
开发者ID:roblabs,项目名称:mapbox-gl-native,代码行数:8,代码来源:symbol_bucket.cpp
示例18: showColorDebugImage
void showColorDebugImage(std::string name, const char *data, size_t logicalWidth, size_t logicalHeight, size_t width, size_t height) {
glfwInit();
static GLFWwindow *debugWindow = nullptr;
if (!debugWindow) {
debugWindow = glfwCreateWindow(logicalWidth, logicalHeight, name.c_str(), nullptr, nullptr);
if (!debugWindow) {
glfwTerminate();
fprintf(stderr, "Failed to initialize window\n");
exit(1);
}
}
GLFWwindow *currentWindow = glfwGetCurrentContext();
glfwSetWindowSize(debugWindow, logicalWidth, logicalHeight);
glfwMakeContextCurrent(debugWindow);
int fbWidth, fbHeight;
glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight);
float xScale = static_cast<float>(fbWidth) / static_cast<float>(width);
float yScale = static_cast<float>(fbHeight) / static_cast<float>(height);
MBGL_CHECK_ERROR(glClearColor(0.8, 0.8, 0.8, 1));
MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT));
MBGL_CHECK_ERROR(glEnable(GL_BLEND));
MBGL_CHECK_ERROR(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
MBGL_CHECK_ERROR(glPixelZoom(xScale, -yScale));
MBGL_CHECK_ERROR(glRasterPos2f(-1.0f, 1.0f));
MBGL_CHECK_ERROR(glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data));
glfwSwapBuffers(debugWindow);
glfwMakeContextCurrent(currentWindow);
}
开发者ID:eliassun,项目名称:mapbox-gl-native,代码行数:35,代码来源:glfw_view.cpp
示例19: BUFFER_OFFSET
void SymbolBucket::drawIcons(IconShader &shader) {
char *vertex_index = BUFFER_OFFSET(0);
char *elements_index = BUFFER_OFFSET(0);
for (auto &group : icon.groups) {
assert(group);
group->array[1].bind(shader, icon.vertices, icon.triangles, vertex_index);
MBGL_CHECK_ERROR(glDrawElements(GL_TRIANGLES, group->elements_length * 3, GL_UNSIGNED_SHORT, elements_index));
vertex_index += group->vertex_length * icon.vertices.itemSize;
elements_index += group->elements_length * icon.triangles.itemSize;
}
}
开发者ID:andrewstay,项目名称:mapbox-gl-native,代码行数:11,代码来源:symbol_bucket.cpp
示例20: assert
void HeadlessView::clearBuffers() {
assert(isActive());
MBGL_CHECK_ERROR(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
if (fbo) {
MBGL_CHECK_ERROR(glDeleteFramebuffersEXT(1, &fbo));
fbo = 0;
}
if (fboColor) {
MBGL_CHECK_ERROR(glDeleteTextures(1, &fboColor));
fboColor = 0;
}
if (fboDepthStencil) {
MBGL_CHECK_ERROR(glDeleteRenderbuffersEXT(1, &fboDepthStencil));
fboDepthStencil = 0;
}
}
开发者ID:Dyziorek,项目名称:mapbox-gl-native,代码行数:20,代码来源:headless_view.cpp
注:本文中的MBGL_CHECK_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论