emscripten-core / emscripten-core/emscripten

animation / glSwapBuffers

Open
#13,134 2 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The following question was unanswered on discord.com #emscripten for 18 hours, so I am trying github.

I am trying to convert a C++/OpenGL application to javascript using emscripten, in order to make it into a web application. I am using the -s LEGACY_GL_EMULATION=1 since I have not learned OpenGL ES, nor modified the code to be compatible with it, and am trying to view the results with the http://localhost:8000/ option on Gooogle Chrome Version 87.0.4280.88 (Official Build) (64-bit) on Ubuntu 20.04.1 LTS Linux, CPU Intel® Core™2 Duo CPU E8400 @ 3.00GHz × 2, GPU GeForce 9800 GT/PCIe/SSE2. My program responds to keyboard input and prints debugging information about those responses in the output box, but in the graphic box above it, it displays only the initial opened window with the blue background color that I specified, but none of my graphics that should be generated in response to my keyboard input.

I thought that the problem might be related to my use of glutSwapBuffers(), so I looked for this call among the emscripten/tests, and found it in several programs, which I compiled and tested using emcc. The results were as follows: hello_world_gles works OK, showing three gears in the graphics box, and rotates them as a rigid whole in response to the arrow keys, but hello_world_gles_full shows just the black graphics output box, and output from repeated FPS tests, but shows no image. It also had code to respond to the arrow keys, and when I added print statements to it, they did print when I pressed the arrow keys, but still no change in the graphics images, the same symptoms as in my code. hello_world_full_944 also shows just a black graphics square, while continuing to print different FPS results. hello_world_gles_proxy has no code to respond to arrow keys, but does show one frame of the gears. None of these four codes shows animation of the gears rotated individually while keeping their teeth meshed, as I see when I run the standard glxgears from a terminal command line, although in hello_world_gles.c there is code after the comment /* advance rotation for next frame */ in gears_idle(), apparently to do this.

My own code is 4750 lines, so I thought it was better to point out your own tests which seemed to have the same problem with the html animation in my environment, but I have attached a zip file with my own code too, together with a document describing its keyboard user interface (nothing is drawn but the background until the user types some numbers or letters).

Can anyone guess what my problem is, and how to fix it? I am new to github as well as emscripten, so I do not know if github is set to notify me if someone responds, so also please let me know at max@cs.ucdavis.edu if you do respond, at least for the first time.

[tiling.zip](https://github.com/emscripten-core/emscripten/files/5749312/tiling.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.