Skip to content

Instantly share code, notes, and snippets.

@patternspandemic
Created October 13, 2017 18:51
Show Gist options
  • Save patternspandemic/2639840da4bc882aa57a77528efe82ec to your computer and use it in GitHub Desktop.
Save patternspandemic/2639840da4bc882aa57a77528efe82ec to your computer and use it in GitHub Desktop.
Graphics2::fillTriangle Problem
#include "pch.h"
#include <Kore/Graphics4/Graphics.h>
#include <Kore/Graphics2/Graphics.h>
#include <Kore/System.h>
#include <limits>
using namespace Kore;
namespace {
Graphics2::Graphics2* g2;
Graphics4::Texture* texture;
void update() {
Graphics4::begin();
g2->begin();
g2->clear(0xff333333);
// Triangle primitives draw fine if drawn alone.
g2->setColor(0xff00ff00);
g2->fillTriangle(50.0, 25, 590, 25, 320, 10);
g2->drawLine(50.0, 30, 590, 30, 5.0);
// Use of the ImagePainter or TextPainter causes
// fillTriangle calls to NOT draw.
// g2->drawImage(texture, 50, 50); // <------ UNCOMMENT TO SEE fillTriangle NOT DRAW
// If a fillRect is called anywhere, any fillTraingle
// calls DO draw.
// g2->fillRect(25, 25, 20, 20); // <------ UNCOMMENT TO SEE fillTriangle DRAW AGAIN
// Seems to be a problem somewhere within ColoredShaderPainter
// ::drawTriBuffer and ::drawBuffer.
g2->setColor(0xffffffff);
g2->end();
Graphics4::end();
Graphics4::swapBuffers();
}
}
int kore(int argc, char** argv) {
System::init("TextureTest", 640, 480);
System::setCallback(update);
g2 = new Graphics2::Graphics2(640, 480);
texture = new Graphics4::Texture("parrot.png");
System::start();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment