Rename lots of things
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -161,13 +161,13 @@ bool NativeMapView::initializeDisplay() {
|
||||
// Detect if we are in emulator
|
||||
char prop[PROP_VALUE_MAX];
|
||||
__system_property_get("ro.kernel.qemu", prop);
|
||||
bool in_emulator = strtol(prop, nullptr, 0) == 1;
|
||||
if (in_emulator) {
|
||||
bool inEmulator = strtol(prop, nullptr, 0) == 1;
|
||||
if (inEmulator) {
|
||||
mbgl::Log::Warning(mbgl::Event::Android, "In emulator! Enabling hacks :-(");
|
||||
}
|
||||
|
||||
// Get all configs at least RGB 565 with 16 depth and 8 stencil
|
||||
EGLint config_attribs[] = {
|
||||
EGLint configAttribs[] = {
|
||||
EGL_CONFIG_CAVEAT, EGL_NONE,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
@@ -177,30 +177,30 @@ bool NativeMapView::initializeDisplay() {
|
||||
EGL_BLUE_SIZE, 5,
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_STENCIL_SIZE, 8,
|
||||
(in_emulator ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT, // Ugly hack
|
||||
(in_emulator ? EGL_NONE : EGL_COLOR_BUFFER_TYPE), EGL_RGB_BUFFER, // Ugly hack
|
||||
(inEmulator ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT, // Ugly hack
|
||||
(inEmulator ? EGL_NONE : EGL_COLOR_BUFFER_TYPE), EGL_RGB_BUFFER, // Ugly hack
|
||||
EGL_NONE
|
||||
};
|
||||
EGLint num_configs;
|
||||
if (!eglChooseConfig(display, config_attribs, nullptr, 0, &num_configs)) {
|
||||
EGLint numConfigs;
|
||||
if (!eglChooseConfig(display, configAttribs, nullptr, 0, &numConfigs)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig(NULL) returned error %d", eglGetError());
|
||||
terminateDisplay();
|
||||
return false;
|
||||
}
|
||||
if (num_configs < 1) {
|
||||
if (numConfigs < 1) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig() returned no configs.");
|
||||
terminateDisplay();
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::unique_ptr<EGLConfig[]> configs = mbgl::util::make_unique<EGLConfig[]>(num_configs);
|
||||
if (!eglChooseConfig(display, config_attribs, configs.get(), num_configs, &num_configs)) {
|
||||
const std::unique_ptr<EGLConfig[]> configs = mbgl::util::make_unique<EGLConfig[]>(numConfigs);
|
||||
if (!eglChooseConfig(display, configAttribs, configs.get(), numConfigs, &numConfigs)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglChooseConfig() returned error %d", eglGetError());
|
||||
terminateDisplay();
|
||||
return false;
|
||||
}
|
||||
|
||||
config = chooseConfig(configs.get(), num_configs);
|
||||
config = chooseConfig(configs.get(), numConfigs);
|
||||
if (config == nullptr) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "No config chosen");
|
||||
terminateDisplay();
|
||||
@@ -251,11 +251,11 @@ bool NativeMapView::initializeContext() {
|
||||
assert(context == EGL_NO_CONTEXT);
|
||||
assert(config != nullptr);
|
||||
|
||||
const EGLint context_attribs[] = {
|
||||
const EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
context = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attribs);
|
||||
context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs);
|
||||
if (context == EGL_NO_CONTEXT) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglCreateContext() returned error %d", eglGetError());
|
||||
terminateContext();
|
||||
@@ -267,8 +267,8 @@ bool NativeMapView::initializeContext() {
|
||||
|
||||
void NativeMapView::terminateContext() {
|
||||
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::terminateContext");
|
||||
|
||||
if (display != EGL_NO_DISPLAY) {
|
||||
|
||||
if (!eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglMakeCurrent(EGL_NO_CONTEXT) returned error %d",
|
||||
eglGetError());
|
||||
@@ -298,18 +298,18 @@ bool NativeMapView::createSurface(ANativeWindow* window_) {
|
||||
|
||||
ANativeWindow_setBuffersGeometry(window, 0, 0, format);
|
||||
|
||||
const EGLint surface_attribs[] = {
|
||||
const EGLint surfaceAttribs[] = {
|
||||
EGL_NONE
|
||||
};
|
||||
surface = eglCreateWindowSurface(display, config, window, surface_attribs);
|
||||
surface = eglCreateWindowSurface(display, config, window, surfaceAttribs);
|
||||
if (surface == EGL_NO_SURFACE) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglCreateWindowSurface() returned error %d", eglGetError());
|
||||
destroySurface();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!first_time) {
|
||||
first_time = true;
|
||||
if (!firstTime) {
|
||||
firstTime = true;
|
||||
|
||||
if (!eglMakeCurrent(display, surface, surface, context)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglMakeCurrent() returned error %d", eglGetError());
|
||||
@@ -385,15 +385,15 @@ typedef enum {
|
||||
// Tuple is <buffer_format, depth_stencil_format, is_not_conformant, is_caveat, config_num, config_id>
|
||||
typedef std::tuple<BufferFormat, DepthStencilFormat, bool, bool, int, EGLConfig> ConfigProperties;
|
||||
|
||||
EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_configs) {
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Found %d configs", num_configs);
|
||||
EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint numConfigs) {
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Found %d configs", numConfigs);
|
||||
|
||||
// Create a list of configs that pass our filters
|
||||
std::list<ConfigProperties> config_list;
|
||||
for (int i = 0; i < num_configs; i++) {
|
||||
std::list<ConfigProperties> configList;
|
||||
for (int i = 0; i < numConfigs; i++) {
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Config %d:", i);
|
||||
|
||||
EGLint caveat, conformant, bits, red, green, blue, alpha, alpha_mask, depth, stencil, sample_buffers, samples;
|
||||
EGLint caveat, conformant, bits, red, green, blue, alpha, alphaMask, depth, stencil, sampleBuffers, samples;
|
||||
|
||||
if (!eglGetConfigAttrib(display, configs[i], EGL_CONFIG_CAVEAT, &caveat)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglGetConfigAttrib(EGL_CONFIG_CAVEAT) returned error %d", eglGetError());
|
||||
@@ -430,7 +430,7 @@ EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_conf
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!eglGetConfigAttrib(display, configs[i], EGL_ALPHA_MASK_SIZE, &alpha_mask)) {
|
||||
if (!eglGetConfigAttrib(display, configs[i], EGL_ALPHA_MASK_SIZE, &alphaMask)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglGetConfigAttrib(EGL_ALPHA_MASK_SIZE) returned error %d", eglGetError());
|
||||
return nullptr;
|
||||
}
|
||||
@@ -445,7 +445,7 @@ EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_conf
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!eglGetConfigAttrib(display, configs[i], EGL_SAMPLE_BUFFERS, &sample_buffers)) {
|
||||
if (!eglGetConfigAttrib(display, configs[i], EGL_SAMPLE_BUFFERS, &sampleBuffers)) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "eglGetConfigAttrib(EGL_SAMPLE_BUFFERS) returned error %d", eglGetError());
|
||||
return nullptr;
|
||||
}
|
||||
@@ -462,76 +462,76 @@ EGLConfig NativeMapView::chooseConfig(const EGLConfig configs[], EGLint num_conf
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Green: %d", green);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Blue: %d", blue);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Alpha: %d", alpha);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Alpha mask: %d", alpha_mask);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Alpha mask: %d", alphaMask);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Depth: %d", depth);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Stencil: %d", stencil);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Sample buffers: %d", sample_buffers);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Sample buffers: %d", sampleBuffers);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "...Samples: %d", samples);
|
||||
|
||||
bool config_ok = true;
|
||||
config_ok &= (depth == 24) || (depth == 16);
|
||||
config_ok &= stencil == 8;
|
||||
config_ok &= sample_buffers == 0;
|
||||
config_ok &= samples == 0;
|
||||
bool configOk = true;
|
||||
configOk &= (depth == 24) || (depth == 16);
|
||||
configOk &= stencil == 8;
|
||||
configOk &= sampleBuffers == 0;
|
||||
configOk &= samples == 0;
|
||||
|
||||
// Filter our configs first for depth, stencil and anti-aliasing
|
||||
if (config_ok) {
|
||||
if (configOk) {
|
||||
// Work out the config's buffer format
|
||||
BufferFormat buffer_format;
|
||||
BufferFormat bufferFormat;
|
||||
if ((bits == 16) && (red == 5) && (green == 6) && (blue == 5) && (alpha == 0)) {
|
||||
buffer_format = Format16Bit;
|
||||
bufferFormat = Format16Bit;
|
||||
} else if ((bits == 32) && (red == 8) && (green == 8) && (blue == 8) && (alpha == 0)) {
|
||||
buffer_format = Format32BitNoAlpha;
|
||||
bufferFormat = Format32BitNoAlpha;
|
||||
} else if ((bits == 32) && (red == 8) && (green == 8) && (blue == 8) && (alpha == 8)) {
|
||||
buffer_format = Format32BitAlpha;
|
||||
bufferFormat = Format32BitAlpha;
|
||||
} else if ((bits == 24) && (red == 8) && (green == 8) && (blue == 8) && (alpha == 0)) {
|
||||
buffer_format = Format24Bit;
|
||||
bufferFormat = Format24Bit;
|
||||
} else {
|
||||
buffer_format = Unknown;
|
||||
bufferFormat = Unknown;
|
||||
}
|
||||
|
||||
// Work out the config's depth stencil format
|
||||
DepthStencilFormat depth_stencil_format;
|
||||
DepthStencilFormat depthStencilFormat;
|
||||
if ((depth == 16) && (stencil == 8)) {
|
||||
depth_stencil_format = Format16Depth8Stencil;
|
||||
depthStencilFormat = Format16Depth8Stencil;
|
||||
} else {
|
||||
depth_stencil_format = Format24Depth8Stencil;
|
||||
depthStencilFormat = Format24Depth8Stencil;
|
||||
}
|
||||
|
||||
bool is_not_conformant = (conformant & EGL_OPENGL_ES2_BIT) != EGL_OPENGL_ES2_BIT;
|
||||
bool is_caveat = caveat != EGL_NONE;
|
||||
EGLConfig config_id = configs[i];
|
||||
bool isNotConformant = (conformant & EGL_OPENGL_ES2_BIT) != EGL_OPENGL_ES2_BIT;
|
||||
bool isCaveat = caveat != EGL_NONE;
|
||||
EGLConfig configId = configs[i];
|
||||
|
||||
// Ignore formats we don't recognise
|
||||
if (buffer_format != Unknown)
|
||||
if (bufferFormat != Unknown)
|
||||
{
|
||||
config_list.push_back(std::make_tuple(buffer_format, depth_stencil_format, is_not_conformant, is_caveat, i, config_id));
|
||||
configList.push_back(std::make_tuple(bufferFormat, depthStencilFormat, isNotConformant, isCaveat, i, configId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config_list.empty()) {
|
||||
if (configList.empty()) {
|
||||
mbgl::Log::Error(mbgl::Event::OpenGL, "Config list was empty.");
|
||||
}
|
||||
|
||||
// Sort the configs to find the best one
|
||||
config_list.sort();
|
||||
using_depth24 = std::get<1>(config_list.front()) == Format24Depth8Stencil;
|
||||
bool is_conformant = !std::get<2>(config_list.front());
|
||||
bool is_caveat = std::get<3>(config_list.front());
|
||||
int config_num = std::get<4>(config_list.front());
|
||||
EGLConfig config_id = std::get<5>(config_list.front());
|
||||
configList.sort();
|
||||
usingDepth24 = std::get<1>(configList.front()) == Format24Depth8Stencil;
|
||||
bool isConformant = !std::get<2>(configList.front());
|
||||
bool isCaveat = std::get<3>(configList.front());
|
||||
int configNum = std::get<4>(configList.front());
|
||||
EGLConfig configId = std::get<5>(configList.front());
|
||||
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Chosen config is %d", config_num);
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Chosen config is %d", configNum);
|
||||
|
||||
if (is_caveat) {
|
||||
if (isCaveat) {
|
||||
mbgl::Log::Warning(mbgl::Event::OpenGL, "Chosen config has a caveat.");
|
||||
}
|
||||
if (!is_conformant) {
|
||||
if (!isConformant) {
|
||||
mbgl::Log::Warning(mbgl::Event::OpenGL, "Chosen config is not conformant.");
|
||||
}
|
||||
|
||||
return config_id;
|
||||
return configId;
|
||||
}
|
||||
|
||||
void NativeMapView::start() {
|
||||
@@ -578,13 +578,13 @@ void NativeMapView::loadExtensions() {
|
||||
|
||||
if (extensions.find("GL_OES_packed_depth_stencil") != std::string::npos) {
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Using GL_OES_packed_depth_stencil.");
|
||||
gl::is_packed_depth_stencil_supported = true;
|
||||
gl::isPackedDepthStencilSupported = true;
|
||||
}
|
||||
|
||||
if (extensions.find("GL_OES_depth24") != std::string::npos) {
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Using GL_OES_depth24.");
|
||||
if (using_depth24) {
|
||||
gl::is_depth24_supported = true;
|
||||
if (usingDepth24) {
|
||||
gl::isDepth24Supported = true;
|
||||
} else {
|
||||
mbgl::Log::Info(mbgl::Event::OpenGL, "Preferring 16 bit depth.");
|
||||
}
|
||||
@@ -600,11 +600,11 @@ void NativeMapView::stop() {
|
||||
}
|
||||
|
||||
|
||||
void NativeMapView::pause(bool wait_for_pause) {
|
||||
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::pause %s", (wait_for_pause) ? "true" : "false");
|
||||
void NativeMapView::pause(bool waitForPause) {
|
||||
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::pause %s", (waitForPause) ? "true" : "false");
|
||||
|
||||
if ((display != EGL_NO_DISPLAY) && (context != EGL_NO_CONTEXT)) {
|
||||
map.pause(wait_for_pause);
|
||||
map.pause(waitForPause);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ void NativeMapView::notifyMapChange() {
|
||||
}
|
||||
}
|
||||
|
||||
env->CallVoidMethod(obj, on_map_changed_id);
|
||||
env->CallVoidMethod(obj, onMapChangedId);
|
||||
if (env->ExceptionCheck()) {
|
||||
env->ExceptionDescribe();
|
||||
}
|
||||
@@ -668,28 +668,28 @@ void NativeMapView::notifyMapChange() {
|
||||
void NativeMapView::enableFps(bool enable) {
|
||||
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::enableFps()");
|
||||
|
||||
fps_enabled = enable;
|
||||
fpsEnabled = enable;
|
||||
}
|
||||
|
||||
void NativeMapView::updateFps() {
|
||||
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::updateFps()");
|
||||
|
||||
if (!fps_enabled) {
|
||||
if (!fpsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int frames = 0;
|
||||
static int64_t time_elapsed = 0LL;
|
||||
static int64_t timeElapsed = 0LL;
|
||||
|
||||
frames++;
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
int64_t current_time = now.tv_sec*1000000000LL + now.tv_nsec;
|
||||
int64_t currentTime = now.tv_sec*1000000000LL + now.tv_nsec;
|
||||
|
||||
if (current_time - time_elapsed >= 1) {
|
||||
fps = frames / ((current_time - time_elapsed) / 1E9);
|
||||
if (currentTime - timeElapsed >= 1) {
|
||||
fps = frames / ((currentTime - timeElapsed) / 1E9);
|
||||
mbgl::Log::Debug(mbgl::Event::Render, "FPS: %4.2f", fps);
|
||||
time_elapsed = current_time;
|
||||
timeElapsed = currentTime;
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
@@ -704,8 +704,8 @@ void NativeMapView::updateFps() {
|
||||
|
||||
jint ret;
|
||||
JNIEnv* env = nullptr;
|
||||
bool detach = false;
|
||||
ret = vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
|
||||
bool detach = false;
|
||||
ret = vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
|
||||
if (ret != JNI_OK) {
|
||||
if (ret != JNI_EDETACHED) {
|
||||
mbgl::Log::Error(mbgl::Event::JNI, "GetEnv() failed with %i", ret);
|
||||
@@ -720,7 +720,7 @@ void NativeMapView::updateFps() {
|
||||
}
|
||||
}
|
||||
|
||||
env->CallVoidMethod(obj, on_fps_changed_id, fps);
|
||||
env->CallVoidMethod(obj, onFpsChangedId, fps);
|
||||
if (env->ExceptionCheck()) {
|
||||
env->ExceptionDescribe();
|
||||
}
|
||||
|
||||
@@ -187,14 +187,14 @@ class NativeMapView {
|
||||
return nativeGetDefaultTransitionDuration(mNativeMapViewPtr);
|
||||
}
|
||||
|
||||
public void setDefaultTransitionDuration(long durationMilliseconds) {
|
||||
if (durationMilliseconds < 0) {
|
||||
public void setDefaultTransitionDuration(long milliseconds) {
|
||||
if (milliseconds < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"durationMilliseconds cannot be negative.");
|
||||
}
|
||||
|
||||
nativeSetDefaultTransitionDuration(mNativeMapViewPtr,
|
||||
durationMilliseconds);
|
||||
milliseconds);
|
||||
}
|
||||
|
||||
public void setStyleUrl(String url) {
|
||||
@@ -456,7 +456,7 @@ class NativeMapView {
|
||||
private native List<String> nativeGetAppliedClasses(long nativeMapViewPtr);
|
||||
|
||||
private native void nativeSetDefaultTransitionDuration(
|
||||
long nativeMapViewPtr, long durationMilliseconds);
|
||||
long nativeMapViewPtr, long milliseconds);
|
||||
|
||||
private native long nativeGetDefaultTransitionDuration(long nativeMapViewPtr);
|
||||
|
||||
|
||||
@@ -7,32 +7,32 @@
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
extern std::string cache_path;
|
||||
extern std::string data_path;
|
||||
extern std::string apk_path;
|
||||
extern std::string cachePath;
|
||||
extern std::string dataPath;
|
||||
extern std::string apkPath;
|
||||
|
||||
extern jmethodID on_map_changed_id;
|
||||
extern jmethodID on_fps_changed_id;
|
||||
extern jmethodID onMapChangedId;
|
||||
extern jmethodID onFpsChangedId;
|
||||
|
||||
extern jclass lon_lat_class;
|
||||
extern jmethodID lon_lat_constructor_id;
|
||||
extern jfieldID lon_lat_lon_id;
|
||||
extern jfieldID lon_lat_lat_id;
|
||||
extern jclass lonLatClass;
|
||||
extern jmethodID lonLatConstructorId;
|
||||
extern jfieldID lonLatLonId;
|
||||
extern jfieldID lonLatLatId;
|
||||
|
||||
extern jclass lon_lat_zoom_class;
|
||||
extern jmethodID lon_lat_zoom_constructor_id;
|
||||
extern jfieldID lon_lat_zoom_lon_id;
|
||||
extern jfieldID lon_lat_zoom_lat_id;
|
||||
extern jfieldID lon_lat_zoom_zoom_id;
|
||||
extern jclass lonLatZoomClass;
|
||||
extern jmethodID lonLatZoomConstructorId;
|
||||
extern jfieldID lonLatZoomLonId;
|
||||
extern jfieldID lonLatZoomLatId;
|
||||
extern jfieldID lonLatZoomZoomId;
|
||||
|
||||
extern jclass runtime_exception_class;
|
||||
extern jclass null_pointer_exception_class;;
|
||||
extern jclass runtimeExceptionClass;
|
||||
extern jclass nullPointerExceptionClass;;
|
||||
|
||||
extern jmethodID list_to_array_id;
|
||||
extern jmethodID listToArrayId;
|
||||
|
||||
extern jclass array_list_class;
|
||||
extern jmethodID array_list_constructor_id;
|
||||
extern jmethodID array_list_add_id;
|
||||
extern jclass arrayListClass;
|
||||
extern jmethodID arrayListConstructorId;
|
||||
extern jmethodID arrayListAddId;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void stop();
|
||||
|
||||
void resume();
|
||||
void pause(bool wait_for_pause = false);
|
||||
void pause(bool waitForPause = false);
|
||||
|
||||
void notifyMapChange();
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
void updateFps();
|
||||
|
||||
private:
|
||||
EGLConfig chooseConfig(const EGLConfig configs[], EGLint num_configs);
|
||||
EGLConfig chooseConfig(const EGLConfig configs[], EGLint numConfigs);
|
||||
|
||||
void loadExtensions();
|
||||
|
||||
@@ -83,14 +83,14 @@ private:
|
||||
EGLConfig config = nullptr;
|
||||
EGLint format = -1;
|
||||
|
||||
std::string style_url;
|
||||
std::string api_key;
|
||||
std::string styleUrl;
|
||||
std::string apiKey;
|
||||
|
||||
bool first_time = false;
|
||||
bool firstTime = false;
|
||||
|
||||
bool using_depth24 = false;
|
||||
bool usingDepth24 = false;
|
||||
|
||||
bool fps_enabled = false;
|
||||
bool fpsEnabled = false;
|
||||
double fps = 0.0;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace mbgl {
|
||||
|
||||
class AndroidLogBackend : public LogBackend {
|
||||
private:
|
||||
int severity_to_priority(EventSeverity severity);
|
||||
int severityToPriority(EventSeverity severity);
|
||||
|
||||
public:
|
||||
inline ~AndroidLogBackend() = default;
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
GLuint fbo = 0;
|
||||
GLuint fbo_depth_stencil = 0;
|
||||
GLuint fbo_color = 0;
|
||||
bool using_gl_3_or_newer = false;
|
||||
bool usingGl3OrNewer = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -129,10 +129,10 @@ extern PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
|
||||
extern PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
|
||||
extern PFNGLISVERTEXARRAYPROC IsVertexArray;
|
||||
|
||||
extern bool is_packed_depth_stencil_supported;
|
||||
extern bool isPackedDepthStencilSupported;
|
||||
#define GL_DEPTH24_STENCIL8 0x88F0
|
||||
|
||||
extern bool is_depth24_supported;
|
||||
extern bool isDepth24Supported;
|
||||
#define GL_DEPTH_COMPONENT24 0x81A6
|
||||
|
||||
// Debug group markers, useful for debugging on iOS
|
||||
|
||||
@@ -26,11 +26,11 @@ public:
|
||||
const StyleBucketRaster &properties;
|
||||
|
||||
private:
|
||||
GLint previous_fbo = 0;
|
||||
GLint previousFbo = 0;
|
||||
GLuint fbo = 0;
|
||||
GLuint texture = 0;
|
||||
GLuint fbo_depth= 0;
|
||||
GLuint fbo_stencil = 0;
|
||||
GLuint fboDepth= 0;
|
||||
GLuint fboStencil = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -24,20 +24,20 @@ void AssetRequestBaton::run(AssetRequestBaton *ptr) {
|
||||
}
|
||||
|
||||
int error = 0;
|
||||
struct zip *apk = zip_open(mbgl::android::apk_path.c_str(), 0, &error);
|
||||
struct zip *apk = zip_open(mbgl::android::apkPath.c_str(), 0, &error);
|
||||
if ((apk == nullptr) || ptr->canceled || !ptr->request) {
|
||||
// Opening the APK failed or was canceled. There isn't much left we can do.
|
||||
const int message_size = zip_error_to_str(nullptr, 0, error, errno);
|
||||
const std::unique_ptr<char[]> message = mbgl::util::make_unique<char[]>(message_size);
|
||||
const int messageSize = zip_error_to_str(nullptr, 0, error, errno);
|
||||
const std::unique_ptr<char[]> message = mbgl::util::make_unique<char[]>(messageSize);
|
||||
zip_error_to_str(message.get(), 0, error, errno);
|
||||
notify_error(ptr, 500, message.get());
|
||||
cleanup(ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string apk_file_path = "assets/" + ptr->path;
|
||||
struct zip_file *apk_file = zip_fopen(apk, apk_file_path.c_str(), ZIP_FL_NOCASE);
|
||||
if ((apk_file == nullptr) || ptr->canceled || !ptr->request) {
|
||||
std::string apkFilePath = "assets/" + ptr->path;
|
||||
struct zip_file *apkFile = zip_fopen(apk, apkFilePath.c_str(), ZIP_FL_NOCASE);
|
||||
if ((apkFile == nullptr) || ptr->canceled || !ptr->request) {
|
||||
// Opening the asset failed or was canceled. We already have an open file handle
|
||||
// though, which we'll have to close.
|
||||
zip_error_get(apk, &error, nullptr);
|
||||
@@ -49,12 +49,12 @@ void AssetRequestBaton::run(AssetRequestBaton *ptr) {
|
||||
}
|
||||
|
||||
struct zip_stat stat;
|
||||
if ((zip_stat(apk, apk_file_path.c_str(), ZIP_FL_NOCASE, &stat) != 0) || ptr->canceled || !ptr->request) {
|
||||
if ((zip_stat(apk, apkFilePath.c_str(), ZIP_FL_NOCASE, &stat) != 0) || ptr->canceled || !ptr->request) {
|
||||
// Stating failed or was canceled. We already have an open file handle
|
||||
// though, which we'll have to close.
|
||||
notify_error(ptr, 500, zip_strerror(apk));
|
||||
zip_fclose(apk_file);
|
||||
apk_file = nullptr;
|
||||
zip_fclose(apkFile);
|
||||
apkFile = nullptr;
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
cleanup(ptr);
|
||||
@@ -63,12 +63,12 @@ void AssetRequestBaton::run(AssetRequestBaton *ptr) {
|
||||
|
||||
const std::unique_ptr<char[]> data = mbgl::util::make_unique<char[]>(stat.size);
|
||||
|
||||
if (static_cast<zip_uint64_t>(zip_fread(apk_file, reinterpret_cast<void *>(data.get()), stat.size)) != stat.size || ptr->canceled || !ptr->request) {
|
||||
if (static_cast<zip_uint64_t>(zip_fread(apkFile, reinterpret_cast<void *>(data.get()), stat.size)) != stat.size || ptr->canceled || !ptr->request) {
|
||||
// Reading failed or was canceled. We already have an open file handle
|
||||
// though, which we'll have to close.
|
||||
notify_error(ptr, 500, zip_file_strerror(apk_file));
|
||||
zip_fclose(apk_file);
|
||||
apk_file = nullptr;
|
||||
notify_error(ptr, 500, zip_file_strerror(apkFile));
|
||||
zip_fclose(apkFile);
|
||||
apkFile = nullptr;
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
cleanup(ptr);
|
||||
@@ -83,10 +83,10 @@ void AssetRequestBaton::run(AssetRequestBaton *ptr) {
|
||||
ptr->request->notify();
|
||||
}
|
||||
|
||||
if (zip_fclose(apk_file) != 0) {
|
||||
if (zip_fclose(apkFile) != 0) {
|
||||
// Closing the asset failed. But there isn't anything we can do.
|
||||
}
|
||||
apk_file = nullptr;
|
||||
apkFile = nullptr;
|
||||
|
||||
if (zip_close(apk) != 0) {
|
||||
// Closing the APK failed. But there isn't anything we can do.
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace platform {
|
||||
|
||||
// Returns the path to the default cache database on this system.
|
||||
std::string defaultCacheDatabase() {
|
||||
return mbgl::android::cache_path + "/mbgl-cache.db";
|
||||
return mbgl::android::cachePath + "/mbgl-cache.db";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
int AndroidLogBackend::severity_to_priority(EventSeverity severity) {
|
||||
int AndroidLogBackend::severityToPriority(EventSeverity severity) {
|
||||
switch(severity) {
|
||||
case EventSeverity::Debug:
|
||||
return ANDROID_LOG_DEBUG;
|
||||
@@ -22,14 +22,14 @@ int AndroidLogBackend::severity_to_priority(EventSeverity severity) {
|
||||
|
||||
case EventSeverity::Error:
|
||||
return ANDROID_LOG_ERROR;
|
||||
|
||||
|
||||
default:
|
||||
return ANDROID_LOG_VERBOSE;
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidLogBackend::record(EventSeverity severity, Event event, const std::string &msg) {
|
||||
__android_log_print(severity_to_priority(severity), EventClass(event).c_str(), "%s", msg.c_str());
|
||||
__android_log_print(severityToPriority(severity), EventClass(event).c_str(), "%s", msg.c_str());
|
||||
}
|
||||
|
||||
void AndroidLogBackend::record(EventSeverity severity, Event event, const char* format, ...) {
|
||||
@@ -42,18 +42,18 @@ void AndroidLogBackend::record(EventSeverity severity, Event event, const char*
|
||||
|
||||
va_end(args);
|
||||
|
||||
__android_log_print(severity_to_priority(severity), EventClass(event).c_str(), "%s", buf);
|
||||
__android_log_print(severityToPriority(severity), EventClass(event).c_str(), "%s", buf);
|
||||
|
||||
delete buf;
|
||||
buf = nullptr;
|
||||
}
|
||||
|
||||
void AndroidLogBackend::record(EventSeverity severity, Event event, int64_t code) {
|
||||
__android_log_print(severity_to_priority(severity), EventClass(event).c_str(), "(%" PRId64 ")", code);
|
||||
__android_log_print(severityToPriority(severity), EventClass(event).c_str(), "(%" PRId64 ")", code);
|
||||
}
|
||||
|
||||
void AndroidLogBackend::record(EventSeverity severity, Event event, int64_t code, const std::string &msg) {
|
||||
__android_log_print(severity_to_priority(severity), EventClass(event).c_str(), "(%" PRId64 ") %s", code, msg.c_str());
|
||||
__android_log_print(severityToPriority(severity), EventClass(event).c_str(), "(%" PRId64 ") %s", code, msg.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void HeadlessView::loadExtensions() {
|
||||
make_active();
|
||||
|
||||
std::string extensions;
|
||||
if (using_gl_3_or_newer) {
|
||||
if (usingGl3OrNewer) {
|
||||
#ifdef GL_VERSION_3_0
|
||||
GLuint num_extensions = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, reinterpret_cast<GLint *>(&num_extensions));
|
||||
@@ -108,7 +108,7 @@ static const core_profile_version core_profile_versions[] = {
|
||||
{0, 0},
|
||||
};
|
||||
|
||||
GLXContext createCoreProfile(Display *dpy, GLXFBConfig fbconfig, bool& using_gl_3_or_newer) {
|
||||
GLXContext createCoreProfile(Display *dpy, GLXFBConfig fbconfig, bool& usingGl3OrNewer) {
|
||||
static bool context_creation_failed = false;
|
||||
GLXContext ctx = 0;
|
||||
|
||||
@@ -136,7 +136,7 @@ GLXContext createCoreProfile(Display *dpy, GLXFBConfig fbconfig, bool& using_gl_
|
||||
}
|
||||
|
||||
if (core_profile_versions[i].major >= 3) {
|
||||
using_gl_3_or_newer = true;
|
||||
usingGl3OrNewer = true;
|
||||
}
|
||||
|
||||
// Restore the old error handler.
|
||||
@@ -172,7 +172,7 @@ void HeadlessView::createContext() {
|
||||
#ifdef GLX_ARB_create_context
|
||||
if (glXCreateContextAttribsARB) {
|
||||
// Try to create a core profile context.
|
||||
gl_context = createCoreProfile(x_display, fb_configs[0], using_gl_3_or_newer);
|
||||
gl_context = createCoreProfile(x_display, fb_configs[0], usingGl3OrNewer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -417,13 +417,13 @@ size_t curl_header_cb(char * const buffer, const size_t size, const size_t nmemb
|
||||
static CURLcode sslctx_function(CURL */*curl*/, void *sslctx, void */*parm*/) {
|
||||
|
||||
int error = 0;
|
||||
struct zip *apk = zip_open(mbgl::android::apk_path.c_str(), 0, &error);
|
||||
struct zip *apk = zip_open(mbgl::android::apkPath.c_str(), 0, &error);
|
||||
if (apk == nullptr) {
|
||||
return CURLE_SSL_CACERT_BADFILE;
|
||||
}
|
||||
|
||||
struct zip_file *apk_file = zip_fopen(apk, "assets/ca-bundle.crt", ZIP_FL_NOCASE);
|
||||
if (apk_file == nullptr) {
|
||||
struct zip_file *apkFile = zip_fopen(apk, "assets/ca-bundle.crt", ZIP_FL_NOCASE);
|
||||
if (apkFile == nullptr) {
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
return CURLE_SSL_CACERT_BADFILE;
|
||||
@@ -431,16 +431,16 @@ static CURLcode sslctx_function(CURL */*curl*/, void *sslctx, void */*parm*/) {
|
||||
|
||||
struct zip_stat stat;
|
||||
if (zip_stat(apk, "assets/ca-bundle.crt", ZIP_FL_NOCASE, &stat) != 0) {
|
||||
zip_fclose(apk_file);
|
||||
apk_file = nullptr;
|
||||
zip_fclose(apkFile);
|
||||
apkFile = nullptr;
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
return CURLE_SSL_CACERT_BADFILE;
|
||||
}
|
||||
|
||||
if (stat.size > std::numeric_limits<int>::max()) {
|
||||
zip_fclose(apk_file);
|
||||
apk_file = nullptr;
|
||||
zip_fclose(apkFile);
|
||||
apkFile = nullptr;
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
return CURLE_SSL_CACERT_BADFILE;
|
||||
@@ -448,9 +448,9 @@ static CURLcode sslctx_function(CURL */*curl*/, void *sslctx, void */*parm*/) {
|
||||
|
||||
const std::unique_ptr<char[]> pem = util::make_unique<char[]>(stat.size);
|
||||
|
||||
if (static_cast<zip_uint64_t>(zip_fread(apk_file, reinterpret_cast<void *>(pem.get()), stat.size)) != stat.size) {
|
||||
zip_fclose(apk_file);
|
||||
apk_file = nullptr;
|
||||
if (static_cast<zip_uint64_t>(zip_fread(apkFile, reinterpret_cast<void *>(pem.get()), stat.size)) != stat.size) {
|
||||
zip_fclose(apkFile);
|
||||
apkFile = nullptr;
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
return CURLE_SSL_CACERT_BADFILE;
|
||||
@@ -498,8 +498,8 @@ static CURLcode sslctx_function(CURL */*curl*/, void *sslctx, void */*parm*/) {
|
||||
BIO_free(bio);
|
||||
bio = nullptr;
|
||||
|
||||
zip_fclose(apk_file);
|
||||
apk_file = nullptr;
|
||||
zip_fclose(apkFile);
|
||||
apkFile = nullptr;
|
||||
zip_close(apk);
|
||||
apk = nullptr;
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ PFNGLGENVERTEXARRAYSPROC GenVertexArrays = nullptr;
|
||||
PFNGLISVERTEXARRAYPROC IsVertexArray = nullptr;
|
||||
|
||||
// GL_OES_packed_depth_stencil
|
||||
bool is_packed_depth_stencil_supported = false;
|
||||
bool isPackedDepthStencilSupported = false;
|
||||
|
||||
// GL_OES_depth24
|
||||
bool is_depth24_supported = false;
|
||||
bool isDepth24Supported = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ PrerenderedTexture::~PrerenderedTexture() {
|
||||
texture = 0;
|
||||
}
|
||||
|
||||
if (fbo_depth != 0) {
|
||||
glDeleteRenderbuffers(1, &fbo_depth);
|
||||
fbo_depth = 0;
|
||||
if (fboDepth != 0) {
|
||||
glDeleteRenderbuffers(1, &fboDepth);
|
||||
fboDepth = 0;
|
||||
}
|
||||
|
||||
if (fbo_stencil != 0) {
|
||||
glDeleteRenderbuffers(1, &fbo_stencil);
|
||||
fbo_stencil = 0;
|
||||
if (fboStencil != 0) {
|
||||
glDeleteRenderbuffers(1, &fboStencil);
|
||||
fboStencil = 0;
|
||||
}
|
||||
|
||||
if (fbo != 0) {
|
||||
@@ -44,7 +44,7 @@ void PrerenderedTexture::bindTexture() {
|
||||
}
|
||||
|
||||
void PrerenderedTexture::bindFramebuffer() {
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &previous_fbo);
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &previousFbo);
|
||||
|
||||
if (texture == 0) {
|
||||
glGenTextures(1, &texture);
|
||||
@@ -60,14 +60,14 @@ void PrerenderedTexture::bindFramebuffer() {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
if (fbo_depth == 0) {
|
||||
if (fboDepth == 0) {
|
||||
// Create depth buffer
|
||||
glGenRenderbuffers(1, &fbo_depth);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fbo_depth);
|
||||
if (gl::is_packed_depth_stencil_supported) {
|
||||
glGenRenderbuffers(1, &fboDepth);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fboDepth);
|
||||
if (gl::isPackedDepthStencilSupported) {
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, properties.size, properties.size);
|
||||
} else {
|
||||
if (gl::is_depth24_supported) {
|
||||
if (gl::isDepth24Supported) {
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, properties.size, properties.size);
|
||||
} else {
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, properties.size, properties.size);
|
||||
@@ -77,10 +77,10 @@ void PrerenderedTexture::bindFramebuffer() {
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
if (!gl::is_packed_depth_stencil_supported && (fbo_stencil == 0)) {
|
||||
if (!gl::isPackedDepthStencilSupported && (fboStencil == 0)) {
|
||||
// Create stencil buffer
|
||||
glGenRenderbuffers(1, &fbo_stencil);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fbo_stencil);
|
||||
glGenRenderbuffers(1, &fboStencil);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fboStencil);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, properties.size, properties.size);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
@@ -91,16 +91,16 @@ void PrerenderedTexture::bindFramebuffer() {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
|
||||
|
||||
if (gl::is_packed_depth_stencil_supported) {
|
||||
if (gl::isPackedDepthStencilSupported) {
|
||||
#ifdef GL_ES_VERSION_2_0
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo_depth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo_depth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fboDepth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fboDepth);
|
||||
#else
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo_depth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fboDepth);
|
||||
#endif
|
||||
} else {
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo_depth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo_stencil);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fboDepth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fboStencil);
|
||||
}
|
||||
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
@@ -125,7 +125,7 @@ void PrerenderedTexture::bindFramebuffer() {
|
||||
}
|
||||
|
||||
void PrerenderedTexture::unbindFramebuffer() {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, previous_fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
|
||||
|
||||
if (fbo != 0) {
|
||||
glDeleteFramebuffers(1, &fbo);
|
||||
@@ -134,12 +134,12 @@ void PrerenderedTexture::unbindFramebuffer() {
|
||||
}
|
||||
|
||||
void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
|
||||
const GLuint original_texture = texture;
|
||||
const GLuint originalTexture = texture;
|
||||
|
||||
// Create a secondary texture
|
||||
GLuint secondary_texture;
|
||||
glGenTextures(1, &secondary_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, secondary_texture);
|
||||
GLuint secondaryTexture;
|
||||
glGenTextures(1, &secondaryTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, secondaryTexture);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
@@ -155,7 +155,7 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
|
||||
|
||||
for (int i = 0; i < passes; i++) {
|
||||
// Render horizontal
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, secondary_texture, 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, secondaryTexture, 0);
|
||||
#if GL_EXT_discard_framebuffer && !__ANDROID__
|
||||
const GLenum discards[] = { GL_COLOR_ATTACHMENT0 };
|
||||
glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards);
|
||||
@@ -163,24 +163,24 @@ void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
painter.gaussianShader->u_offset = {{ 1.0f / float(properties.size), 0 }};
|
||||
glBindTexture(GL_TEXTURE_2D, original_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, originalTexture);
|
||||
painter.coveringGaussianArray.bind(*painter.gaussianShader, painter.tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)painter.tileStencilBuffer.index());
|
||||
|
||||
|
||||
|
||||
// Render vertical
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, original_texture, 0);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, originalTexture, 0);
|
||||
#if GL_EXT_discard_framebuffer && !__ANDROID__
|
||||
glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards);
|
||||
#endif
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
painter.gaussianShader->u_offset = {{ 0, 1.0f / float(properties.size) }};
|
||||
glBindTexture(GL_TEXTURE_2D, secondary_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, secondaryTexture);
|
||||
painter.coveringGaussianArray.bind(*painter.gaussianShader, painter.tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
glDrawArrays(GL_TRIANGLES, 0, (GLsizei)painter.tileStencilBuffer.index());
|
||||
}
|
||||
|
||||
glDeleteTextures(1, &secondary_texture);
|
||||
glDeleteTextures(1, &secondaryTexture);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user