aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-04-02 12:29:50 +0200
committerDan Gudmundsson <[email protected]>2015-04-13 09:28:54 +0200
commitec794a22a3d5837c0dca35badf8af7bf841130ba (patch)
tree1f5c707c8f36857dbd1c69dbcdebee0a2bf0e583
parent6e3e48d39a77aa18b92fb048d6a910baa71badf3 (diff)
downloadotp-ec794a22a3d5837c0dca35badf8af7bf841130ba.tar.gz
otp-ec794a22a3d5837c0dca35badf8af7bf841130ba.tar.bz2
otp-ec794a22a3d5837c0dca35badf8af7bf841130ba.zip
wx: Optimize OpenGL invocations
-rw-r--r--lib/wx/c_src/wxe_gl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/wx/c_src/wxe_gl.cpp b/lib/wx/c_src/wxe_gl.cpp
index a9feb23831..26b45d219e 100644
--- a/lib/wx/c_src/wxe_gl.cpp
+++ b/lib/wx/c_src/wxe_gl.cpp
@@ -135,8 +135,12 @@ void deleteActiveGL(wxGLCanvas *canvas)
void gl_dispatch(int op, char *bp,ErlDrvTermData caller,WXEBinRef *bins[]){
if(caller != gl_active) {
wxGLCanvas * current = glc[caller];
- if(current) { gl_active = caller; current->SetCurrent();}
- else {
+ if(current) {
+ if(current != glc[gl_active]) {
+ gl_active = caller;
+ current->SetCurrent();
+ }
+ } else {
ErlDrvTermData rt[] = // Error msg
{ERL_DRV_ATOM, driver_mk_atom((char *) "_egl_error_"),
ERL_DRV_INT, (ErlDrvTermData) op,