Here's a short version, it's a bit of a mess really :)

- FreeGLUT seems to treat the Delete key as a special key, while GLUT 
treats it as a "normal" ASCII key 
- FreeGLUT has a GLUT_KEY_DELETE define for the Delete special key, BUT 
only in the freeglut_ext.h header, which emscripten doesn't ship with 
(which makes sense freeglut_ext.h has a lot of extra stuff which shouldn't 
be in emscripten)
- Backspace seems to be a normal ASCII key both in GLUT and in FreeGLUT, 
but the current emscripten implementation returns it as a special key, not 
as ASCII

Cleaning this up is hard without breaking existing behaviour (at least the 
backspace key should go from the special key callback over to the ASCII key 
callback).

I'll see if I can write a little native+emscripten test on the weekend and 
open a pull-request for further discussion.

I now tend towards going with FreeGLUT behaviour, since this is the header 
emscripten ships with...

Cheers,
-Floh.

Am Donnerstag, 9. Januar 2014 01:34:03 UTC+1 schrieb azakai:
>
> Not sure I followed all those details (I hardly know anything about glut 
> ;), but I think we should make a testcase that works when built natively 
> using our headers and the relevant native library, and then fix things so 
> it works when compiled by emscripten as well.
>
> Or is the issue that there is no clear native library to use, it can be 
> either GLUT or FreeGLUT, and the code that works is different among those 
> two? If so, is one of those two overwhelmingly more commonly used?
>
> - Alon
>
>
>
> On Tue, Jan 7, 2014 at 4:04 AM, Floh <[email protected] <javascript:>>wrote:
>
>> Hi,
>>
>> I've stumbled across something which looks like a bug to me in the 
>> library_glut.js input code, but it could also be a misunderstanding on my 
>> side resulting from the many GLUT versions floating around (GLUT, FreeGlut, 
>> OpenGlut, ...):
>>
>> In this commit the backspace and delete keys had been added as special 
>> keys: 
>>
>>
>> https://github.com/prenaux/emscripten/commit/c4b07c9d429603e492657992f77ad982577d72d9
>>
>> The delete key returns the special key code 111 (0x6F) and 120 (0x78).
>>
>> But there are missing GLUT_KEY_xxx definitions for these in 
>> GL/freeglut_std.h , now the "official" GLUT doc states that these keys are 
>> not returned as special keys, but as ASCII code in the normal keyboard 
>> callback function:
>>
>> http://www.opengl.org/documentation/specs/glut/spec3/node54.html
>>
>> at the end it states:
>>
>> "Note that the escape, backspace, and delete keys are generated as an 
>> ASCII character."
>>
>> The latest freeglut_ext.h (downloaded from here: 
>> http://sourceforge.net/projects/freeglut/) has one definition for the 
>> delete key at 0x6F, but none for 0x78 (which would be backspace):
>>
>> #define GLUT_KEY_DELETE 0x006F
>>
>>
>> So long story short:
>>
>>
>> 1) it looks like GLUT and FreeGLUT don't agree on how to handle the Delete 
>> key :/
>>
>> 2) the Delete key in FreeGLUT is only defined in the freeglut_ext.h header 
>> which we don't ship with
>>
>> 3) FreeGLUT doesn't define a special key code for Backspace anywhere, but  
>> library_glut.js returns it as a special key code
>>
>>
>> I see 2 possible solutions:
>>
>>
>> 1) go with the GLUT standard, remove Delete and Backspace as special keys, 
>> and return them as ASCII code (I would prefer this solution, but it breaks 
>> prenaux' change)
>>
>> 2) add the 2 more GLUT_KEY definitions to freeglut_std.h, GLUT_KEY_DELETE 
>> (normally defined in freeglut_ext.h, but we can't include this because 99% 
>> of the stuff in there isn't implemented in library_glut.js), and 
>> GLUT_KEY_BACKSPACE, which would be totally non-standard (neither GLUT nor 
>> FreeGLUT).
>>
>>
>> Advice? :)
>>
>> -Floh
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to