From 44eddeca8c24c29ad050f92fca1dce99effef1ec Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 7 Jan 2019 15:14:11 +0000 Subject: [PATCH] .developing DrawGL git-svn-id: svn://ultimatepp.org/upp/trunk@12649 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/GLCtrl/GLCtrl.cpp | 2 +- uppsrc/GLDraw/GLPainter.h | 2 +- uppsrc/GLDraw/TDrawGL.cpp | 3 +++ uppsrc/GLDraw/Triangles.cpp | 10 ++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/uppsrc/GLCtrl/GLCtrl.cpp b/uppsrc/GLCtrl/GLCtrl.cpp index 942105408..a53904f43 100644 --- a/uppsrc/GLCtrl/GLCtrl.cpp +++ b/uppsrc/GLCtrl/GLCtrl.cpp @@ -13,7 +13,7 @@ extern void (*restore_gl_viewport__)(); void GLCtrl::DoGLPaint() { glClearDepth(1); - glClearColor(1, 0, 0, 1); + glClearColor(1, 1, 1, 1); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); glEnable(GL_MULTISAMPLE); Size sz = GetSize(); diff --git a/uppsrc/GLDraw/GLPainter.h b/uppsrc/GLDraw/GLPainter.h index a5a97bd1c..4de4cc4c5 100644 --- a/uppsrc/GLDraw/GLPainter.h +++ b/uppsrc/GLDraw/GLPainter.h @@ -21,7 +21,7 @@ struct GLContext2D { // TODO: This should be changed to regular matrix (later) void Set(Size sz) { vs = Sizef(2.0 / sz.cx, -2.0 / sz.cy); } - GLContext2D(Size sz) { Set(vs); } + GLContext2D(Size sz) { Set(sz); } GLContext2D() {} }; diff --git a/uppsrc/GLDraw/TDrawGL.cpp b/uppsrc/GLDraw/TDrawGL.cpp index f3764fa5f..39c613075 100644 --- a/uppsrc/GLDraw/TDrawGL.cpp +++ b/uppsrc/GLDraw/TDrawGL.cpp @@ -14,6 +14,9 @@ void DrawGL::Init(Size sz, double alpha) SyncScissor(); prev = Point(0, 0); path_done = false; + DLOG("DrawGL::Init"); + DDUMP(dd.vs); + DDUMP(dd.off); } DrawGL::~DrawGL() diff --git a/uppsrc/GLDraw/Triangles.cpp b/uppsrc/GLDraw/Triangles.cpp index 9c2d5af55..e6f19d8d1 100644 --- a/uppsrc/GLDraw/Triangles.cpp +++ b/uppsrc/GLDraw/Triangles.cpp @@ -24,6 +24,7 @@ void GLTriangles::Draw(const GLContext2D& dd) void main() { gl_FragColor = v_color; + gl_FragColor = vec4(0, 1, 0, 1); } )"); @@ -35,9 +36,14 @@ void GLTriangles::Draw(const GLContext2D& dd) va.Add(color, 3); va.Index(elements); - glEnable(GL_BLEND); + DDUMP(pos); + DDUMP(color); + DDUMP(elements); + +// glEnable(GL_BLEND); glDisable(GL_CULL_FACE); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); // glDepthFunc(GL_LEQUAL);