Browse Source

Remove examples

gh-pages
falkTX 9 years ago
parent
commit
d17a8706cc
14 changed files with 0 additions and 8011 deletions
  1. +0
    -4
      .gitignore
  2. +0
    -67
      examples/Makefile
  3. +0
    -3
      examples/README
  4. +0
    -43
      examples/dgl-app.cpp
  5. +0
    -149
      examples/dgl-color.cpp
  6. +0
    -213
      examples/dgl-images.cpp
  7. +0
    -3
      examples/dgl-images_src/CREDITS.txt
  8. +0
    -7083
      examples/dgl-images_src/CatPics.cpp
  9. +0
    -25
      examples/dgl-images_src/CatPics.hpp
  10. BIN
      examples/dgl-images_src/cat1.png
  11. BIN
      examples/dgl-images_src/cat2.png
  12. BIN
      examples/dgl-images_src/cat3.png
  13. +0
    -213
      examples/tests/cairo.cpp
  14. +0
    -208
      examples/tests/text.cpp

+ 0
- 4
.gitignore View File

@@ -10,7 +10,3 @@
.kdev4/

utils/lv2_ttl_generator

examples/dgl-app
examples/dgl-color
examples/dgl-images

+ 0
- 67
examples/Makefile View File

@@ -1,67 +0,0 @@
#!/usr/bin/make -f
# Makefile for DPT examples #
# ------------------------- #
# Created by falkTX
#

include ../dgl/Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += -I../dgl
LINK_FLAGS += -L.. -ldgl $(DGL_LIBS)

# --------------------------------------------------------------

ifeq ($(WIN32),true)
TARGETS = dgl-app.exe dgl-color.exe dgl-images.exe
else
TARGETS = dgl-app dgl-color dgl-images
endif

# --------------------------------------------------------------

all: ../libdgl.a $(TARGETS)

clean:
$(MAKE) -C ../dgl clean
$(RM) $(TARGETS)

debug:
$(MAKE) DEBUG=true

# --------------------------------------------------------------

%.exe: %
rm -f $*.exe
mv $* $*.exe
ln -sf $*.exe $*

../libdgl.a: .FORCE
$(MAKE) -C ../dgl

# --------------------------------------------------------------

dgl-app: dgl-app.cpp ../dgl/*
$(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

dgl-color: dgl-color.cpp ../dgl/*
$(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

dgl-images: dgl-images.cpp dgl-images_src/* ../dgl/*
$(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

# --------------------------------------------------------------

dgl-cairo: dgl-cairo.cpp ../dgl/*
$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags --libs cairo) $(LINK_FLAGS) -o $@

dgl-text: dgl-text.cpp ../dgl/*
$(CXX) $< $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

# --------------------------------------------------------------

.FORCE:
.PHONY: .FORCE

# --------------------------------------------------------------

+ 0
- 3
examples/README View File

@@ -1,3 +0,0 @@
Examples for DGL, the OpenGL mini-toolkit used in DPF.

There are no plugin examples here, only test applications of OpenGL Stuff.

+ 0
- 43
examples/dgl-app.cpp View File

@@ -1,43 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

// ------------------------------------------------------
// DGL Stuff

#include "App.hpp"
#include "Window.hpp"

// ------------------------------------------------------
// use namespace

using namespace DGL;

// ------------------------------------------------------
// main entry point

int main()
{
App app;
Window win(app);

win.setTitle("App");
win.show();
app.exec();

return 0;
}

// ------------------------------------------------------

+ 0
- 149
examples/dgl-color.cpp View File

@@ -1,149 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

// ------------------------------------------------------
// DGL Stuff

#include "App.hpp"
#include "Window.hpp"
#include "Widget.hpp"

// ------------------------------------------------------
// use namespace

using namespace DGL;

// ------------------------------------------------------
// Single color widget

class ColorWidget : public Widget,
public IdleCallback
{
public:
ColorWidget(Window& parent)
: Widget(parent),
cur('r'),
reverse(false),
r(0), g(0), b(0)
{
parent.addIdleCallback(this);
}

private:
void idleCallback() override
{
switch (cur)
{
case 'r':
if (reverse)
{
if (--r == 0)
cur = 'g';
}
else
{
if (++r == 100)
cur = 'g';
}
break;

case 'g':
if (reverse)
{
if (--g == 0)
cur = 'b';
}
else
{
if (++g == 100)
cur = 'b';
}
break;

case 'b':
if (reverse)
{
if (--b == 0)
{
cur = 'r';
reverse = false;
}
}
else
{
if (++b == 100)
{
cur = 'r';
reverse = true;
}
}
break;
}

repaint();
}

void onDisplay() override
{
// paint bg color (in full size)
glColor3b(r, g, b);
bgFull.draw();

// paint inverted color (in 2/3 size)
glColor3b(100-r, 100-g, 100-b);
bgSmall.draw();
}

void onReshape(int width, int height) override
{
// full bg
bgFull = Rectangle<int>(0, 0, width, height);

// small bg, centered 2/3 size
bgSmall = Rectangle<int>(width/6, height/6, width*2/3, height*2/3);

// make widget same size as window
setSize(width, height);

// default reshape implementation
Widget::onReshape(width, height);
}

char cur;
bool reverse;
int r, g, b;

Rectangle<int> bgFull, bgSmall;
};

// ------------------------------------------------------
// main entry point

int main()
{
App app;
Window win(app);
ColorWidget color(win);

win.setSize(300, 300);
win.setTitle("Color");
win.show();
app.exec();

return 0;
}

// ------------------------------------------------------

+ 0
- 213
examples/dgl-images.cpp View File

@@ -1,213 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

// ------------------------------------------------------
// Pics

#include "dgl-images_src/CatPics.cpp"

// ------------------------------------------------------
// DGL Stuff

#include "Image.hpp"
#include "Widget.hpp"
#include "StandaloneWindow.hpp"

// ------------------------------------------------------
// use namespace

using namespace DGL;

// ------------------------------------------------------
// our widget

class ExampleImagesWidget : public Widget,
public IdleCallback
{
public:
static const int kImg1y = 0;
static const int kImg2y = 500/2-CatPics::cat2Height/2;
static const int kImg3x = 400/3-CatPics::cat3Width/3;

static const int kImg1max = 500-CatPics::cat1Width;
static const int kImg2max = 500-CatPics::cat2Width;
static const int kImg3max = 400-CatPics::cat3Height;

ExampleImagesWidget(Window& win)
: Widget(win),
fImgTop1st(1),
fImgTop2nd(2),
fImgTop3rd(3),
fImg1x(0),
fImg2x(kImg2max),
fImg3y(kImg3max),
fImg1rev(false),
fImg2rev(true),
fImg3rev(true),
fImg1(CatPics::cat1Data, CatPics::cat1Width, CatPics::cat1Height, GL_BGR),
fImg2(CatPics::cat2Data, CatPics::cat2Width, CatPics::cat2Height, GL_BGR),
fImg3(CatPics::cat3Data, CatPics::cat3Width, CatPics::cat3Height, GL_BGR)
{
win.addIdleCallback(this);
}

private:
void idleCallback() override
{
if (fImg1rev)
{
fImg1x -= 2;
if (fImg1x <= -50)
{
fImg1rev = false;
setNewTopImg(1);
}
}
else
{
fImg1x += 2;
if (fImg1x >= kImg1max+50)
{
fImg1rev = true;
setNewTopImg(1);
}
}

if (fImg2rev)
{
fImg2x -= 1;
if (fImg2x <= -50)
{
fImg2rev = false;
setNewTopImg(2);
}
}
else
{
fImg2x += 4;
if (fImg2x >= kImg2max+50)
{
fImg2rev = true;
setNewTopImg(2);
}
}

if (fImg3rev)
{
fImg3y -= 3;
if (fImg3y <= -50)
{
fImg3rev = false;
setNewTopImg(3);
}
}
else
{
fImg3y += 3;
if (fImg3y >= kImg3max+50)
{
fImg3rev = true;
setNewTopImg(3);
}
}

repaint();
}

void onDisplay() override
{
switch (fImgTop3rd)
{
case 1:
fImg1.drawAt(fImg1x, kImg1y);
break;
case 2:
fImg2.drawAt(fImg2x, kImg2y);
break;
case 3:
fImg3.drawAt(kImg3x, fImg3y);
break;
};

switch (fImgTop2nd)
{
case 1:
fImg1.drawAt(fImg1x, kImg1y);
break;
case 2:
fImg2.drawAt(fImg2x, kImg2y);
break;
case 3:
fImg3.drawAt(kImg3x, fImg3y);
break;
};

switch (fImgTop1st)
{
case 1:
fImg1.drawAt(fImg1x, kImg1y);
break;
case 2:
fImg2.drawAt(fImg2x, kImg2y);
break;
case 3:
fImg3.drawAt(kImg3x, fImg3y);
break;
};
}

void setNewTopImg(const int imgId)
{
if (fImgTop1st == imgId)
return;

if (fImgTop2nd == imgId)
{
fImgTop2nd = fImgTop1st;
fImgTop1st = imgId;
return;
}

fImgTop3rd = fImgTop2nd;
fImgTop2nd = fImgTop1st;
fImgTop1st = imgId;
}

int fImgTop1st, fImgTop2nd, fImgTop3rd;
int fImg1x, fImg2x, fImg3y;
bool fImg1rev, fImg2rev, fImg3rev;
Image fImg1, fImg2, fImg3;
};

// ------------------------------------------------------
// main entry point

int main()
{
App app;
Window win(app);
ExampleImagesWidget images(win);

win.setResizable(false);
win.setSize(500, 400);
win.setTitle("Images");
win.show();
app.exec();

return 0;
}

// ------------------------------------------------------

+ 0
- 3
examples/dgl-images_src/CREDITS.txt View File

@@ -1,3 +0,0 @@
cat1.png: http://www.flickr.com/photos/tomitapio/4305303148/
cat2.png: http://www.flickr.com/photos/aigle_dore/6672148713/
cat3.png: http://www.flickr.com/photos/aigle_dore/5889008066/

+ 0
- 7083
examples/dgl-images_src/CatPics.cpp
File diff suppressed because it is too large
View File


+ 0
- 25
examples/dgl-images_src/CatPics.hpp View File

@@ -1,25 +0,0 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_CATPICS_HPP
#define BINARY_CATPICS_HPP

namespace CatPics
{
extern const char* cat1Data;
const unsigned int cat1DataSize = 216090;
const unsigned int cat1Width = 294;
const unsigned int cat1Height = 245;

extern const char* cat2Data;
const unsigned int cat2DataSize = 117600;
const unsigned int cat2Width = 245;
const unsigned int cat2Height = 160;

extern const char* cat3Data;
const unsigned int cat3DataSize = 111600;
const unsigned int cat3Width = 248;
const unsigned int cat3Height = 150;
}

#endif // BINARY_CATPICS_HPP


BIN
examples/dgl-images_src/cat1.png View File

Before After
Width: 294  |  Height: 245  |  Size: 119KB

BIN
examples/dgl-images_src/cat2.png View File

Before After
Width: 245  |  Height: 160  |  Size: 69KB

BIN
examples/dgl-images_src/cat3.png View File

Before After
Width: 248  |  Height: 150  |  Size: 63KB

+ 0
- 213
examples/tests/cairo.cpp View File

@@ -1,213 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

// ------------------------------------------------------
// DGL Stuff

#include "App.hpp"
#include "CairoWidget.hpp"
#include "Window.hpp"

#include <cstdio>

// ------------------------------------------------------
// use namespace

using namespace DGL;

// ------------------------------------------------------
// Background widget (cairo will be painted on top)

class BackgroundWidget : public Widget
{
public:
BackgroundWidget(Window& parent)
: Widget(parent)
{
}

private:
void onDisplay() override
{
int x = 0;
int y = 0;
int width = getWidth();
int height = getHeight();

// paint bg color (in full size)
glColor3b(20, 80, 20);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(x, y);

glTexCoord2f(1.0f, 0.0f);
glVertex2i(x+width, y);

glTexCoord2f(1.0f, 1.0f);
glVertex2i(x+width, y+height);

glTexCoord2f(0.0f, 1.0f);
glVertex2i(x, y+height);
glEnd();
}

void onReshape(int width, int height) override
{
// make this widget same size as window
setSize(width, height);
Widget::onReshape(width, height);
}
};

// ------------------------------------------------------
// Custom Cairo Widget

class CustomCairoWidget : public CairoWidget,
public IdleCallback
{
public:
CustomCairoWidget(Window& parent)
: CairoWidget(parent),
value(0.0f),
pressed(false)
{
setSize(100, 100);
}

private:
void idleCallback() override
{
value += 0.001f;

if (value > 1.0f)
value = 0;

repaint();
}

void cairoDisplay(cairo_t* const context) override
{
const int w = getWidth();
const int h = getHeight();

float radius = 40.0f;

// * 0.9 for line width to remain inside redraw area
if (w > h)
radius = (h / 2.0f)*0.9f;
else
radius = (w / 2.0f)*0.9f;

cairo_save(context);

cairo_rectangle(context, 0, 0, w, h );
cairo_set_source_rgba(context, 1.1, 0.1, 0.1, 0 );
cairo_fill(context);

cairo_set_line_join(context, CAIRO_LINE_JOIN_ROUND);
cairo_set_line_cap(context, CAIRO_LINE_CAP_ROUND);

cairo_set_line_width(context, 5-0.2);
cairo_move_to(context, w/2, h/2);
cairo_line_to(context, w/2, h/2);
cairo_set_source_rgba(context, 0.1, 0.1, 0.1, 0 );
cairo_stroke(context);

cairo_arc(context, w/2, h/2, radius, 2.46, 0.75 );
cairo_set_source_rgb(context, 0.1, 0.1, 0.1 );
cairo_stroke(context);

float angle = 2.46 + ( 4.54 * value );
cairo_set_line_width(context, 5);
cairo_arc(context, w/2, h/2, radius, 2.46, angle );
cairo_line_to(context, w/2, h/2);
cairo_set_source_rgba(context, 1.0, 0.48, 0, 0.8);
cairo_stroke(context);

cairo_restore(context);
}

bool onMouse(int button, bool press, int x, int y)
{
if (button == 1)
{
pressed = press;

if (press)
{
setX(x-100/2);
setY(y-100/2);
}

return true;
}

return false;
}

bool onMotion(int x, int y)
{
if (pressed)
{
setX(x-100/2);
setY(y-100/2);
return true;
}

return false;
}

float value;
bool pressed;
};

// ------------------------------------------------------
// Custom window, with bg + cairo + image

class CustomWindow : public Window
{
public:
CustomWindow(App& app)
: Window(app),
bg(*this),
cairo(*this)
{
addIdleCallback(&cairo);
}

private:
BackgroundWidget bg;
CustomCairoWidget cairo;
};

// ------------------------------------------------------
// main entry point

int main()
{
App app;
CustomWindow win(app);

win.setSize(300, 300);
win.setTitle("Cairo");
win.show();
app.exec();

return 0;
}

// ------------------------------------------------------

+ 0
- 208
examples/tests/text.cpp View File

@@ -1,208 +0,0 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

// ------------------------------------------------------
// DGL Stuff

#define GL_GLEXT_PROTOTYPES

#include "App.hpp"
#include "Window.hpp"
#include "Widget.hpp"

#include "src/freetype-gl/text-buffer.h"
#include "src/freetype-gl/mat4.h"

#include <GL/glext.h>

#include <cstdio>
#include <cwchar>

// ------------------------------------------------------
extern "C" {

int z_verbose = 0;

void z_error (char* message)
{
d_stderr2(message);
}

}

// ------------------------------------------------------
// use namespace

using namespace DGL;

// ------------------------------------------------------
// Single color widget

class TextWidget : public Widget
{
public:
TextWidget(Window& parent)
: Widget(parent),
#if 1
atlas(nullptr),
fontmgr(nullptr),
font(nullptr),
#endif
textbuf(nullptr)
{
vec2 pen = {{20, 200}};

vec4 black = {{0.0, 0.0, 0.0, 1.0}};
vec4 white = {{1.0, 1.0, 1.0, 1.0}};
vec4 none = {{1.0, 1.0, 1.0, 0.0}};

markup_t markup = {
"normal",
24.0f, 0, 0,
0.0, 0.0, 2.0f,
white, none,
0, white,
0, white,
0, white,
0, white,
0
};

wchar_t* text = L"A Quick Brown Fox Jumps Over The Lazy Dog 0123456789";

#if 1
atlas = texture_atlas_new(600, 300, 1);
DISTRHO_SAFE_ASSERT_RETURN(atlas != nullptr,);

//fontmgr = font_manager_new(600, 200, 2);
//DISTRHO_SAFE_ASSERT_RETURN(fontmgr != nullptr,);

//font = font_manager_get_from_filename(fontmgr, "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", 12.0f);
//DISTRHO_SAFE_ASSERT_RETURN(font != nullptr,);

font = texture_font_new_from_file(atlas, 12.0f, "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
DISTRHO_SAFE_ASSERT_RETURN(font != nullptr,);
#endif

textbuf = text_buffer_new(LCD_FILTERING_OFF);
DISTRHO_SAFE_ASSERT_RETURN(textbuf != nullptr,);

textbuf->base_color = black;

//markup.family = "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf";
markup.font = font;

text_buffer_printf(textbuf, &pen,
&markup, text, nullptr);

text_buffer_add_text(textbuf, &pen, &markup, text, std::wcslen(text));

mat4_set_identity(&projection);
mat4_set_identity(&model);
mat4_set_identity(&view);
}

~TextWidget()
{
if (textbuf != nullptr)
{
text_buffer_delete(textbuf);
textbuf = nullptr;
}

#if 1
if (font != nullptr)
{
texture_font_delete(font);
font = nullptr;
}

if (fontmgr != nullptr)
{
font_manager_delete(fontmgr);
fontmgr = nullptr;
}

if (atlas != nullptr)
{
texture_atlas_delete(atlas);
atlas = nullptr;
}
#endif
}

private:
void onDisplay() override
{
DISTRHO_SAFE_ASSERT_RETURN(textbuf != nullptr,);

glClearColor(0.4f, 0.4f, 0.45f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

glUseProgram(textbuf->shader);
{
glUniformMatrix4fv(glGetUniformLocation(textbuf->shader, "model"), 1, 0, model.data);
glUniformMatrix4fv(glGetUniformLocation(textbuf->shader, "view"), 1, 0, view.data);
glUniformMatrix4fv(glGetUniformLocation(textbuf->shader, "projection"), 1, 0, projection.data);

text_buffer_render(textbuf);
}
}

void onReshape(int width, int height) override
{
// make widget same size as window
setSize(width, height);
//Widget::onReshape(width, height);

//mat4_set_identity(&projection);
//mat4_set_identity(&model);
//mat4_set_identity(&view);

glViewport(0, 0, width, height);
//mat4_set_orthographic(&projection, 0, width, 0, height, width, height);
mat4_set_orthographic(&projection, 0, width, 0, height, -1, 1);
}

texture_atlas_t* atlas;
font_manager_t* fontmgr;
texture_font_t* font;

text_buffer_t* textbuf;

mat4 model, view, projection;
};

// ------------------------------------------------------
// main entry point

int main()
{
App app;
Window win(app);
TextWidget color(win);

win.setSize(600, 300);
win.setTitle("Text");
win.show();
app.exec();

return 0;
}

// ------------------------------------------------------

Loading…
Cancel
Save