Revert "Merge remote-tracking branch 'origin/master'"
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m20s
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m20s
This reverts commit240fa7ddbc
, reversing changes made tod89f79e70e
.
This commit is contained in:
@@ -31,14 +31,14 @@ namespace JGL {
|
||||
|
||||
|
||||
void J2D::Begin() {
|
||||
glViewport(0, 0, wS.x, wS.y);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(0, wS.x, wS.y, 0, -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
//Get what the draw color was before we did anything.
|
||||
glGetFloatv(GL_CURRENT_COLOR, oldColor);
|
||||
glColor4f(baseColor[0], baseColor[1], baseColor[2], baseColor[3]);
|
||||
|
@@ -5,7 +5,7 @@ using namespace ReTexture;
|
||||
|
||||
namespace JGL
|
||||
{
|
||||
Texture::Texture(const std::string& file, const ReTexture::TextureFlag& flags, TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode)
|
||||
Texture::Texture(const std::string &file, const ReTexture::TextureFlag &flags, TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode)
|
||||
{
|
||||
auto *t = new ReTexture::SoftwareTexture(file, flags);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace JGL
|
||||
delete t;
|
||||
}
|
||||
|
||||
Texture::Texture(const std::string& file, TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode) {
|
||||
Texture::Texture(const std::string &file, TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode) {
|
||||
auto *t = new SoftwareTexture(file);
|
||||
|
||||
load(t, {(float) t->getWidth(), (float) t->getHeight()}, t->getTextureFormat(), filtering_mode,
|
||||
@@ -27,9 +27,9 @@ namespace JGL
|
||||
delete t;
|
||||
}
|
||||
|
||||
void Texture::load(SoftwareTexture *software_texture, const Vector2& size, const TextureFormat& format,
|
||||
void Texture::load(SoftwareTexture *software_texture, const Vector2 &size, const TextureFormat &format,
|
||||
TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode) {
|
||||
glGenTextures(1,& texture_handle);
|
||||
glGenTextures(1, &texture_handle);
|
||||
glBindTexture(GL_TEXTURE_2D, texture_handle);
|
||||
|
||||
if (format == TextureFormat::RGBA)
|
||||
@@ -119,7 +119,6 @@ namespace JGL
|
||||
|
||||
if (texture_format == TextureFormat::RGBA) {
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, result.data());
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -127,9 +126,8 @@ namespace JGL
|
||||
std::vector<Color3> color3((size_t) (texture_size.x * texture_size.y));
|
||||
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, color3.data());
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
for (const auto& c: color3)
|
||||
for (const auto &c: color3)
|
||||
result.emplace_back(c);
|
||||
|
||||
return result;
|
||||
@@ -137,7 +135,7 @@ namespace JGL
|
||||
|
||||
void Texture::Erase() {
|
||||
if (texture_handle != 0)
|
||||
glDeleteTextures(1,& texture_handle);
|
||||
glDeleteTextures(1, &texture_handle);
|
||||
}
|
||||
|
||||
GLuint Texture::GetGLTextureHandle() const {
|
||||
@@ -160,18 +158,4 @@ namespace JGL
|
||||
return texture_filtering_mode;
|
||||
}
|
||||
|
||||
TextureWrappingMode Texture::GetWrappingMode() const {
|
||||
return texture_wrapping_mode;
|
||||
}
|
||||
|
||||
SoftwareTexture Texture::GetSoftwareTexture() const {
|
||||
std::vector<unsigned char> software_pixel_data((GetDimensions().x * GetDimensions().y) * 4);
|
||||
|
||||
memcpy(software_pixel_data.data(), GetPixelData().data(), (GetDimensions().x * GetDimensions().y) * 4);
|
||||
return {software_pixel_data, TextureFormat::RGBA, static_cast<unsigned int>(GetDimensions().x), static_cast<unsigned int>(GetDimensions().y)};
|
||||
}
|
||||
|
||||
Texture::Texture(SoftwareTexture* software_texture, TextureFilteringMode filtering_mode, TextureWrappingMode wrapping_mode) {
|
||||
load(software_texture, {static_cast<float>(software_texture->getWidth()), static_cast<float>(software_texture->getHeight())}, software_texture->getTextureFormat(), filtering_mode, wrapping_mode);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user