Currently Fucked

This commit is contained in:
2024-02-16 13:58:51 -05:00
parent 7a7e73a829
commit f676ef5332
4 changed files with 29 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
# Goals
* Provide single-function-calls to render various graphics primitives in 2D and 3D.
* Integrated directly with our other toolkits (ReWindow, J3ML)
* Quick Rendering of Debug Text, Geometric Widgets, Textures, and so forth.
# Non-Goals
* Full Rendering Engine

View File

@@ -229,7 +229,7 @@ namespace JGL {
{
Vector2 A;
Vector2 B;
Vector3 C;
Vector2 C;
};
struct Triangle3D
@@ -261,7 +261,7 @@ namespace JGL {
void OutlineCircle2D(const Color3& color, const Vector2& center, float radius, int subdivisions, float thickness = 1);
void FillCircle2D(const Color3& color, const Vector2& center, float radius, int subdivisions);
void OutlineTriangle2D();
void FillTriangle2D();
void FillTriangle2D(const Color3& color, const Triangle2D& tri);
void FillTexturedTriangle2D();
void FillTexturedPolygon2D();
void DrawSprite2D();

View File

@@ -80,8 +80,18 @@ public:
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
JGL::RenderText("WHATS BOPPIN muth ~~~ niger ~~~ aphuqqa____?", 0.f, -100.f, 3.f);
JGL::RenderText("CHINESE CHARCTERS DONT WORK", 0.f, -100.f, 1.f);
//JGL::RenderText("WHATS BOPPIN muth ~~~ niger ~~~ aphuqqa____?", 0.f, -100.f, 2.f);
JGL::RenderText("Chinese characters don't work", 0.f, -120.f, 1.f);
JGL::Triangle2D tri
{
{10, -200},
{105, 10},
{-105, 10}
};
JGL::J2D::FillTriangle2D(JGL::Colors::Yellow, tri);
JGL::J2D::FillRect2D(JGL::Colors::Yellow, {32, 32}, {100.5, 100.5});
//glFlush();
}
void OnRefresh(float elapsed) override

View File

@@ -118,8 +118,8 @@ namespace JGL
namespace J2D
{
void FillRect2D(const Color3 &color, const Vector2 &pos, const Vector2 &size) {
auto vp_pos = ScreenToViewport(pos);
auto vp_size = ScreenToViewport(size);
auto vp_pos = pos;//ScreenToViewport(pos);
auto vp_size = size;//ScreenToViewport(size);
glBegin(GL_QUADS);
glColor3f(color.r/255.f, color.g/255.f, color.b/255.f);
glVertex2f(vp_pos.x, vp_pos.y);
@@ -130,8 +130,8 @@ namespace JGL
}
void OutlineRect2D(const Color3 &color, const Vector2 &pos, const Vector2 &size, float thickness) {
auto vp_pos = ScreenToViewport(pos);
auto vp_size = ScreenToViewport(size);
auto vp_pos = pos;//ScreenToViewport(pos);
auto vp_size = size;//ScreenToViewport(size);
glBegin(GL_LINE_LOOP);
glLineWidth(thickness);
glColor3f(color.r, color.g, color.b);
@@ -203,6 +203,16 @@ namespace JGL
}
glEnd();
}
void FillTriangle2D(const Color3& color, const Triangle2D& tri)
{
glBegin(GL_LINE_LOOP);
glColor3f(color.r/255.f, color.g/255.f, color.b/255.f);
glVertex2f(tri.A.x, tri.A.y);
glVertex2f(tri.B.x, tri.B.y);
glVertex2f(tri.C.x, tri.C.y);
glEnd();
}
}