/*
NanoGUI was developed by Wenzel Jakob <wenzel.jakob@epfl.ch>.
The widget drawing code is based on the NanoVG demo application
by Mikko Mononen.
All rights reserved. Use of this source code is governed by a
BSD-style license that can be found in the LICENSE.txt file.
*/
#pragma once
#include <iostream>
#include <nanogui/widget.h>
#include <nanogui/opengl.h>
#include <nanogui/glutil.h>
NAMESPACE_BEGIN(nanogui)
class NANOGUI_EXPORT GLCanvas : public Widget {
public:
GLCanvas(Widget *parent);
const Color &backgroundColor() const { return mBackgroundColor; }
void setBackgroundColor(const Color &backgroundColor) { mBackgroundColor = backgroundColor; }
void setDrawBorder(const bool bDrawBorder) { mDrawBorder = bDrawBorder; }
const bool &drawBorder() const { return mDrawBorder; }
virtual void draw(NVGcontext *ctx) override;
virtual void drawGL() {}
virtual void save(Serializer &s) const override;
virtual bool load(Serializer &s) override;
protected:
void drawWidgetBorder(NVGcontext* ctx) const;
protected:
Color mBackgroundColor;
bool mDrawBorder;
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
NAMESPACE_END(nanogui)