Work at 3ds support and backend upgrades
- Track textures (not sure if this is done tbh) - Add lithium formatters and move TextureID, TextureFormat and TextureFilter to lithium - Only include gl-helper if any glDriver is included - Add Li::Rect for UV stuff - Add Li::Texture as Info holder (still thinking of making them to ptrs - Add Check if textures are still loaded on exit
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <pd/lithium/formatters.hpp>
|
||||
#include <pd_system/gfx_opengl2.hpp>
|
||||
|
||||
#if defined(PD_ENABLE_OPENGL2)
|
||||
@@ -128,9 +129,9 @@ void GfxOpenGL2::SysReset() {
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
TextureID GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
Li::Texture GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
GLuint texID;
|
||||
glGenTextures(1, &texID);
|
||||
glBindTexture(GL_TEXTURE_2D, texID);
|
||||
@@ -152,13 +153,18 @@ TextureID GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
PDLOG("GfxOpenGL2::LoadTexture -> [{}] {}, [{}, {}]", PD::ivec2(w, h), texID,
|
||||
type, filter);
|
||||
return texID;
|
||||
Li::Texture res;
|
||||
res.SetID(texID);
|
||||
res.SetSize(w, h);
|
||||
res.SetUV(0.f, 0.f, 1.f, 1.f);
|
||||
RegisterTexture(res);
|
||||
PDLOG("GfxOpenGL2::LoadTexture -> {{ {} }}, [{}, {}]", res, type, filter);
|
||||
return res;
|
||||
}
|
||||
|
||||
void GfxOpenGL2::DeleteTexture(const TextureID& tex) {
|
||||
GLuint tex_ = tex;
|
||||
void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {
|
||||
UnregisterTexture(tex);
|
||||
GLuint tex_ = tex.GetID();
|
||||
glDeleteTextures(1, &tex_);
|
||||
}
|
||||
} // namespace PD
|
||||
@@ -173,12 +179,12 @@ void GfxOpenGL2::SysDeinit() {}
|
||||
void GfxOpenGL2::Submit(size_t count, size_t start) {}
|
||||
void GfxOpenGL2::BindTexture(TextureID id) {}
|
||||
void GfxOpenGL2::SysReset() {}
|
||||
TextureID GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
return 0;
|
||||
Li::Texture GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
|
||||
int h, TextureFormat type,
|
||||
TextureFilter filter) {
|
||||
return Li::Texture();
|
||||
}
|
||||
void GfxOpenGL2::DeleteTexture(const TextureID& tex) {}
|
||||
void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {}
|
||||
void GfxOpenGL2::pSetupShaderAttribs(u32 shader) {}
|
||||
} // namespace PD
|
||||
#endif
|
||||
Reference in New Issue
Block a user