diff --git a/uppsrc/CtrlLib/TreeCtrl.cpp b/uppsrc/CtrlLib/TreeCtrl.cpp index 5774aab13..dc40bd4af 100644 --- a/uppsrc/CtrlLib/TreeCtrl.cpp +++ b/uppsrc/CtrlLib/TreeCtrl.cpp @@ -293,9 +293,12 @@ bool TreeCtrl::IsValid(int id) const void TreeCtrl::SetNode(int id, const TreeCtrl::Node& n) { - (TreeCtrl::Node&)item[id] = n; + TreeCtrl::Node& m = item[id]; + m = n; Dirty(id); SetOption(id); + if(m.ctrl) + AddChildBefore(m.ctrl, GetLastChild()); } void TreeCtrl::RemoveChildren(int id) diff --git a/uppsrc/GLDraw/GLDraw.cpp b/uppsrc/GLDraw/GLDraw.cpp index 3067d6488..3015d06af 100644 --- a/uppsrc/GLDraw/GLDraw.cpp +++ b/uppsrc/GLDraw/GLDraw.cpp @@ -1,6 +1,6 @@ #include "GLDraw.h" -#define LLOG(x) LOG(x) +#define LLOG(x) // LOG(x) #ifndef GL_BGRA // Win32 missing these #define GL_BGRA 0x80E1 @@ -66,13 +66,12 @@ struct ImageGLDataMaker : LRUCache >::Maker virtual int Make(ImageGLData& object) const { object.Init(img); return img.GetLength(); } }; - void GLDraw::PutImage(Point p, const Image& img, const Rect& src) { if(img.GetLength() == 0) return; - LLOG("PutImage " << img.GetSerialId() << ' ' << p.x << ", " << p.y << ", "<< img.GetSize()); + DLOG("PutImage " << img.GetSerialId() << ' ' << p.x << ", " << p.y << ", "<< img.GetSize()); LLOG("SysImage cache pixels " << sTextureCache.GetSize() << ", count " << sTextureCache.GetCount()); ImageGLDataMaker m; m.img = img; @@ -132,7 +131,7 @@ void GLDraw::SetColor(Color c) void GLDraw::PutRect(const Rect& r, Color color) { - LLOG("PutRect " << r << " " << color); + DLOG("PutRect " << r << " " << color); bool inv = color == InvertColor(); if(inv) glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); @@ -170,6 +169,25 @@ void GLDraw::Init(Size sz, uint64 context_) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + LOG("=============================================================================="); +/* + glGenBuffers(1, &vbo); + glBindBuffer(GL_ARRAY_BUFFER, triangleVBO); + + glGenBuffers(1, &tbo); + glBindBuffer(GL_ +*/ } -}; +GLDraw::~GLDraw() +{ +#ifdef USE_VBO + if(context) { + glDeleteBuffers(1, &vbo); + glDeleteBuffers(1, &tbo); + } +#endif +} + +} \ No newline at end of file diff --git a/uppsrc/GLDraw/GLDraw.h b/uppsrc/GLDraw/GLDraw.h index bd016e47a..3a27782b8 100644 --- a/uppsrc/GLDraw/GLDraw.h +++ b/uppsrc/GLDraw/GLDraw.h @@ -5,12 +5,19 @@ #include namespace Upp { + +// #define USE_VBO 1 class GLDraw : public SDraw { void SetColor(Color c); uint64 context; +#ifdef USE_VBO + GLuint vbo, tbo; + +#endif + public: virtual void PutImage(Point p, const Image& m, const Rect& src); virtual void PutRect(const Rect& r, Color color); @@ -20,7 +27,9 @@ public: static void ClearCache(); static void ResetCache(); - GLDraw() { context = 0; } + GLDraw() { context = 0; /* vbo = 0; tbo = 0; */ } + + ~GLDraw(); }; }; diff --git a/uppsrc/GLDraw/GLDraw.upp b/uppsrc/GLDraw/GLDraw.upp index c124260fb..36c266531 100644 --- a/uppsrc/GLDraw/GLDraw.upp +++ b/uppsrc/GLDraw/GLDraw.upp @@ -4,5 +4,6 @@ uses file GLDraw.h, - GLDraw.cpp; + GLDraw.cpp, + src.tpp;