gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Missing alpha blended vectors

Open midzer opened this issue 1 year ago • 3 comments

Hi all,

I am in the process of porting https://github.com/mdsteele/azimuth for the web using Emscripten. The game uses OpenGL 2.1 functions, so I need gl4es as translation library.

I've replaced

#include <SDL_opengl.h>

with

#include <GL/gl.h>

and loaded initialize_gl4es() early on.

The compile runs fine, but there are certain (later destructable) alpha blended wall structures which are not visible in the port. In the native build those wall structures are visible.

I already tried to tweak some environment variables via https://github.com/ptitSeb/gl4es/blob/master/USAGE.md without success.

Thanks for your support and have a nice week midzer

midzer avatar Oct 09 '24 17:10 midzer

Do you have any idea what kind of drawing those wall are doing?

ptitSeb avatar Oct 09 '24 18:10 ptitSeb

Without deep OpenGL knowledge, I guess it has to be somewhere around https://github.com/mdsteele/azimuth/blob/050f838b35d19ffdc738f33178abaf9d69d834ec/src/azimuth/view/wall.c#L492, assuming it's a AZ_WALL_DESTRUCTIBLE_CHARGED wall.

midzer avatar Oct 09 '24 18:10 midzer

The original author answered https://github.com/mdsteele/azimuth/issues/25#issuecomment-2405183156

midzer avatar Oct 10 '24 15:10 midzer

This error is also thrown after level is loaded where those walls are opaque:

GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call

midzer avatar Dec 02 '24 11:12 midzer

By replacing GL_QUADS with GL_TRIANGLE_STRIPS I could fix the issue.

midzer avatar Apr 25 '25 08:04 midzer

Still strange it didn't worked with GL_QUADS, as internaly, they are replaced with GL_TRIANGLE_STRIP anyway.

ptitSeb avatar Apr 25 '25 08:04 ptitSeb

In addition I had to exchange 3rd <-> 4th vertex.

midzer avatar Apr 25 '25 08:04 midzer

Yeah, gl4es transformation quads->strip should be correct. But I guess there is an attribute somehow that got lost in the transformation.

ptitSeb avatar Apr 25 '25 08:04 ptitSeb

Don't know.

Here are all the changes https://github.com/midzer/azimuth/tree/replaceQuads

midzer avatar Apr 25 '25 08:04 midzer