mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-11 22:03:53 -06:00
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:
parent
957ee5c935
commit
30c577b406
6 changed files with 72 additions and 0 deletions
21
bazaar/GLCanvas_demo/GLCanvas_demo.h
Normal file
21
bazaar/GLCanvas_demo/GLCanvas_demo.h
Normal 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
|
||||
7
bazaar/GLCanvas_demo/GLCanvas_demo.lay
Normal file
7
bazaar/GLCanvas_demo/GLCanvas_demo.lay
Normal 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
|
||||
|
||||
12
bazaar/GLCanvas_demo/GLCanvas_demo.upp
Normal file
12
bazaar/GLCanvas_demo/GLCanvas_demo.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
GLCanvas;
|
||||
|
||||
file
|
||||
main.cpp,
|
||||
GLCanvas_demo.h,
|
||||
GLCanvas_demo.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
3
bazaar/GLCanvas_demo/LICENSE.txt
Normal file
3
bazaar/GLCanvas_demo/LICENSE.txt
Normal 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/
|
||||
|
||||
BIN
bazaar/GLCanvas_demo/Stanford_Bunny_sample.stl
Normal file
BIN
bazaar/GLCanvas_demo/Stanford_Bunny_sample.stl
Normal file
Binary file not shown.
29
bazaar/GLCanvas_demo/main.cpp
Normal file
29
bazaar/GLCanvas_demo/main.cpp
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue