Skip to content

Commit

Permalink
try to fix transparency GLX bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Oct 20, 2024
1 parent 2c77557 commit d21cdbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 4 additions & 7 deletions RGFW.h
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ void RGFW_updateLockState(RGFW_window* win, b8 capital, b8 numlock) {

size_t index = (sizeof(attribs) / sizeof(attribs[0])) - 13;

#define RGFW_GL_ADD_ATTRIB(attrib, attVal) \
#define RGFW_GL_ADD_ATTRIB(attrib, attVal) \
if (attVal) { \
attribs[index] = attrib;\
attribs[index + 1] = attVal;\
Expand Down Expand Up @@ -2532,7 +2532,9 @@ Start of Linux / Unix defines
glXGetFBConfigAttrib((Display*) win->src.display, fbc[i], GLX_SAMPLE_BUFFERS, &samp_buf);
glXGetFBConfigAttrib((Display*) win->src.display, fbc[i], GLX_SAMPLES, &samples);

if ((best_fbc < 0 || samp_buf) && (samples == RGFW_SAMPLES || best_fbc == -1)) {
//printf("%i\n", vi->depth);
if ((!(args & RGFW_TRANSPARENT_WINDOW) || vi->depth == 32) &&
(best_fbc < 0 || samp_buf) && (samples == RGFW_SAMPLES || best_fbc == -1)) {
best_fbc = i;
}
}
Expand All @@ -2548,11 +2550,6 @@ Start of Linux / Unix defines
XVisualInfo* vi = glXGetVisualFromFBConfig((Display*) win->src.display, bestFbc);

XFree(fbc);

if (args & RGFW_TRANSPARENT_WINDOW) {
XMatchVisualInfo((Display*) win->src.display, DefaultScreen((Display*) win->src.display), 32, TrueColor, vi); /*!< for RGBA backgrounds*/
}

#else
XVisualInfo viNorm;

Expand Down
7 changes: 2 additions & 5 deletions webasm/webgpu.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h1>RGFW WebASM Example &nbsp;&nbsp;&nbsp;&nbsp;
</canvas>
</div>

<script type='text/javascript'>
<script type='text/javascript'>
var Module = {
print: (function() {
return (text) => {console.log(text);
Expand Down Expand Up @@ -113,10 +113,7 @@ <h1>RGFW WebASM Example &nbsp;&nbsp;&nbsp;&nbsp;
}

initWebGPU();
</script>
{{{ SCRIPT }}}


</script>

<script async src="../examples/webgpu/webgpu.js"> </script>
<script>
Expand Down

0 comments on commit d21cdbc

Please sign in to comment.