GLCanvas_demo: GLCanvas demo, including Standford bunny

git-svn-id: svn://ultimatepp.org/upp/trunk@14673 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2020-07-09 13:27:14 +00:00
parent 957ee5c935
commit 30c577b406
6 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#ifndef _GLCanvas_demo_GLCanvas_demo_h
#define _GLCanvas_demo_GLCanvas_demo_h
#include <CtrlLib/CtrlLib.h>
#include <GLCanvas/GLCanvas.h>
using namespace Upp;
#define LAYOUTFILE <GLCanvas_demo/GLCanvas_demo.lay>
#include <CtrlCore/lay.h>
class GLCanvas_demo : public WithGLCanvas_demoLayout<TopWindow> {
public:
typedef GLCanvas_demo CLASSNAME;
GLCanvas_demo();
private:
Surface surf;
};
#endif

View file

@ -0,0 +1,7 @@
LAYOUT(GLCanvas_demoLayout, 480, 372)
ITEM(GLCanvas, canvas, SetFrame(ThinInsetFrame()).HSizePosZ(4, 4).VSizePosZ(24, 4))
ITEM(Label, dv___1, SetLabel(t_("File (.stl):")).LeftPosZ(8, 52).TopPosZ(4, 19))
ITEM(EditString, filename, HSizePosZ(60, 52).TopPosZ(4, 19))
ITEM(Button, butOpen, SetLabel(t_("Open")).RightPosZ(4, 44).TopPosZ(4, 20))
END_LAYOUT

View file

@ -0,0 +1,12 @@
uses
CtrlLib,
GLCanvas;
file
main.cpp,
GLCanvas_demo.h,
GLCanvas_demo.lay;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,3 @@
Stanford Bunny (https://www.thingiverse.com/thing:3731) by phooky is licensed under the Creative Commons - Public Domain Dedication license.
http://creativecommons.org/publicdomain/zero/1.0/

Binary file not shown.

View file

@ -0,0 +1,29 @@
#include "GLCanvas_demo.h"
GLCanvas_demo::GLCanvas_demo()
{
CtrlLayout(*this, "GLCanvas demo. STL viewer");
butOpen.WhenAction = [&] {
try {
bool isText;
String header;
LoadStl(~filename, surf, isText, header);
surf.GetLimits();
canvas.SetEnv(surf.env);
} catch (Exc e) {
Exclamation(DeQtf(e));
}
};
canvas.WhenPaint = [&] {
canvas.PaintSurface(surf, Green(), true, false);
};
Sizeable().Zoomable();
}
GUI_APP_MAIN
{
GLCanvas_demo().Run();
}