Fix Implementation of J2D::DrawLine2D & J3D::DrawLine3D

This commit is contained in:
2024-02-20 00:30:38 -05:00
parent 29a64160e9
commit 2a98857bab
6 changed files with 82 additions and 23 deletions

View File

@@ -12,8 +12,7 @@
// OpenGL Wrapper for rendering 2D graphics primitives in both a 2D and 3D context
namespace JGL {
// All functions accept coordinates in pixel-screen space [0, 600]
// and are internally transformed to OpenGL clip space [-1, +1]
struct RGBTuple {
int r; int g; int b;
};
@@ -250,7 +249,8 @@ namespace JGL {
bool InitTextEngine();
// TODO: implement correct coloring
void RenderText(std::string text, float x, float y, float scale);
using J3ML::u32;
void RenderText(std::string text, float x, float y, float scale, u32 size = 16);
namespace J2D {
void DrawPixel2D(const Color3& color, const Vector2 &coordinates);

View File

@@ -0,0 +1,23 @@
#pragma once
namespace {
// Texture2D is able to store and configure a texture in OpenGL
// It also hosts utility functions for easy management.
class Texture2D {
public:
unsigned int ID; // ID of the texture object
unsigned int Width, Height;
unsigned int InternalFormat;
unsigned int ImageFormat;
unsigned int WrapS;
unsigned int WrapT;
unsigned int Filter_Min;
unsigned int Filter_Max;
Texture2D();
void Generate(unsigned int width, unsigned int height, unsigned char *data);
void Bind() const;
};
}