ptitSeb / gl4es

GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, Emscripten and AmigaOS4.
http://ptitseb.github.io/gl4es/
MIT License
711 stars 160 forks source link

definition of glRect #200

Closed kevodwyer closed 4 years ago

kevodwyer commented 4 years ago

I might be on the wrong track here... But while using gl4es with an OpenGL program I was getting an error. I fixed it by changing the param on glRect to match declaration on: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glRect.xml

gl4es.h From void gl4es_glRect##suffix##v(const type v); to void gl4es_glRect##suffix##v(const type v1, const type *v2);

gl4eswraps.c From void gl4es_glRect##suffix##v(const type v) { \ gl4es_glRect##suffix(v[0], v[1], v[2], v[3]); \ } to void gl4es_glRect##suffix##v(const type v1, const type *v2) { \ gl4es_glRect##suffix(v1[0], v1[1], v2[0], v2[1]); \ }

And void glRect##suffix##v(const type *v)AliasExport("gl4es_glRect" #suffix "v");

To void glRect##suffix##v(const type v1, const type v2)AliasExport("gl4es_glRect" #suffix "v");

I am not a OpenGL dev, so please close if I'm wrong!

ptitSeb commented 4 years ago

Oh yes, you are right, the signature of the "v" variant is wrong. Your fix looks good to me.

I'll push it to the repo.

kevodwyer commented 4 years ago

Nice! I also found I needed to add the following defines to GL/gl.h in my case.

typedef GLint GLfixed;

define GL_TRANSLATE_X_NV 0x908E

define GL_TRANSLATE_Y_NV 0x908F

define GL_TRANSLATE_2D_NV 0x9090

define GL_TRANSLATE_3D_NV 0x9091

define GL_AFFINE_2D_NV 0x9092

define GL_AFFINE_3D_NV 0x9094

define GL_TRANSPOSE_AFFINE_2D_NV 0x9096

define GL_TRANSPOSE_AFFINE_3D_NV 0x9098

define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6

You can see the use of gl4es and emscripten/WASM here: https://kevodwyer.github.io/boxedwine-gles/boxedwine.html I haven't got textures to work yet. More debugging to do...

I see: WebGL: INVALID_OPERATION: texParameter: no texture bound to target _emscripten_glTexParameteri @ boxedwine.js:1 15WebGL: INVALID_OPERATION: texImage2D: no texture bound to target 240[.WebGL-0x7fd533e7b800]RENDER WARNING: there is no texture bound to the unit 0

ptitSeb commented 4 years ago

Looks good, but, that "boxedwine", what it is? Is it wine for WASM architecture or is it running with an x86 emulator?

kevodwyer commented 4 years ago

enough fo a x86 emulator to run WINE. I help where i can, but it is mostly james' work (he wrote jdosbox, i did a js port of it as jsdosbox many years ago) https://sourceforge.net/projects/boxedwine/ Getting it to work with opengles has been a dream for a long time. Thanks for gl4es. BTW i have a Pandora from way back so i'm grateful for the work you have done there also.

kevodwyer commented 4 years ago

A good place to follow along James' progress is on vogons: https://www.vogons.org/viewtopic.php?f=9&t=58414

ptitSeb commented 4 years ago

Nice.

I'm currently working on getting "box86" compatible with WINE (and gl4es too). Funy how all project converge to similar objectives. I didn't knew that project, looks interresting.

kevodwyer commented 4 years ago

I am getting a rasberry PI soon so i can play with box86!

ptitSeb commented 4 years ago

From what I see, Boxedwine seems to be working, and probably as advanced, maybe more, as box86. And there is an android version. But again, I never heard of this project, that's a shame.

kevodwyer commented 4 years ago

Android port needs some work. James' has it on his todo list. I think the first commit for boxedwinewas back in 2014 (memory is a bit hazy...). First in java, then C and now C++. The ARMv7 core is very recent. I am able to help out with emscripten, but that is it.

One question if you have a quick answer: When I run Wglinfo from: https://github.com/gkv311/wglinfo/releases

I see the following output: boxedwine-shell.js:957 boxedwine-shell.js:957 [WGL] OpenGL vendor string: ptitSeb boxedwine-shell.js:957 [WGL] OpenGL renderer string: GL4ES wrapper boxedwine-shell.js:957 [WGL] OpenGL version string: 2.1 gl4es wrapper 1.1.4 boxedwine-shell.js:957 [WGL] OpenGL shading language version string: 1.20 via gl4es

WebGL: INVALID_ENUM: getParameter: invalid parameter name Unknown pname for get: 34811 WebGL: INVALID_ENUM: getParameter: invalid parameter name Unknown pname for get: 36935

Does that mean anything to you?

kevodwyer commented 4 years ago

There is a forum and more demos on: http://www.boxedwine.org/

ptitSeb commented 4 years ago

WebGL: INVALID_ENUM: getParameter: invalid parameter name Unknown pname for get: 34811 WebGL: INVALID_ENUM: getParameter: invalid parameter name Unknown pname for get: 36935

Those are param that are not handled by gl4es (because I don't know them), that I just passthrough to gles hardware. First one 34811 seems to be GL_VBO_FREE_MEMORY_ATI 0x87FB but I don't know what the second is.

ptitSeb commented 4 years ago

On my Pandora, I get a performance result for MDK of 8 using box86+wine. I see on Vogon forum he gets 21 on a PI4. so dynarec seems fine. (I see many cycle spent on my side with emulation of "FS:" segment, I need to optimize that thing).

kevodwyer commented 4 years ago

That's interesting. Feel free to reach out on the above vogon's thread, on the sourceforge repo or via email. It would be great if we can collaborate some way. Keep up the great work!

ptitSeb commented 4 years ago

Ah, I tried MDK on my Pi4, and with a 20.2 (or is it 20.1?) mesa driver, I get "247" as performances indicator (not sure what is slowing it down on the Pandora, as I don't think the performance difference is that big)