Fixed issue with screens not at 0, 0 not rendering. Also cleaned up.

This commit is contained in:
Hynak 2022-02-25 14:56:17 -05:00
parent e56f128592
commit a10a994da5
3 changed files with 9 additions and 11 deletions

View File

@ -89,8 +89,6 @@ void CContext::render ()
if (this->m_viewports.empty () == false)
{
static Display* display = XOpenDisplay (nullptr);
bool firstFrame = true;
bool renderFrame = true;
auto cur = this->m_viewports.begin ();
auto end = this->m_viewports.end ();
@ -103,7 +101,7 @@ void CContext::render ()
GC gc = XCreateGC(display, pm, 0, NULL);
XFillRectangle(display, pm, gc, 0, 0, fullWidth, fullHeight);
char* image_data = this->m_wallpaper->renderImage (*cur, renderFrame, firstFrame);
char* image_data = this->m_wallpaper->renderImage ();
XImage* image = XCreateImage(display, CopyFromParent, 24, ZPixmap, 0, (char *)image_data, windowWidth, windowHeight, 32, 0);
for (; cur != end; cur ++)
{

View File

@ -287,13 +287,14 @@ void CWallpaper::render (glm::vec4 viewport, bool renderFrame, bool newFrame)
glDrawArrays (GL_TRIANGLES, 0, 6);
}
char* CWallpaper::renderImage (glm::vec4 viewport, bool renderFrame, bool newFrame)
char* CWallpaper::renderImage ()
{
if (renderFrame == true)
this->renderFrame (viewport);
int windowWidth = 1920;
int windowHeight = 1080;
glm::vec4 viewport = {0, 0, windowWidth, windowHeight};
this->renderFrame (viewport);
if (this->getWallpaperData ()->is <WallpaperEngine::Core::CScene> ())
{
@ -380,8 +381,7 @@ char* CWallpaper::renderImage (glm::vec4 viewport, bool renderFrame, bool newFra
glBindFramebuffer (GL_FRAMEBUFFER, screen_fbo->getFramebuffer());
if (newFrame == true)
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable (GL_BLEND);
glDisable (GL_DEPTH_TEST);
// do not use any shader

View File

@ -36,8 +36,8 @@ namespace WallpaperEngine::Render
/**
* Performs a render pass of the wallpaper and returns the char* of the image
*/
char* renderImage (glm::vec4 viewport, bool renderFrame = true, bool newFrame = true);
char* renderImage ();
/**
* @return The container to resolve files for this wallpaper
*/