cirosantilli/cpp-cheat

License ?

ebachard opened this issue · 2 comments

Hello,

Thanks a lot for all the code sample you share. Just wondering : under which license is everything ? (more precisely : opengl/glfw_webcam_image_process.c file).

To tell you more, I played with opengl/glfw_webcam_image_process.c to horizontaly flip the captured image and I was wondering how to proceed in the case you are interested with the changes. Of course, I can attach a diff , but the code looks not that clean, sorry.

  • Originaly : I remember the code was not compiling (Linux x86_64 for me), and the gpu shader didn't work (imho) as expected
  • Now : I modified some coordinates in the fragment shader -program2- and I implemented some uniform value, and now, hit the F key allows to flip/unflip horizontaly in real time what the webcam provides. Just a toy as you can see, but the idea was to show the cpu overload is close to 0%, eating only 22 MB of RAM (640 x 480 at 30fps, GPU , e.g. using Logitech C920). Last but not least, I got other ideas, but I probably will reimplement verything using another code base (SDL2 + ImGui for me)
  • More information about the renderer : OpenGL version: 4.5 (Core Profile) Mesa 18.0.5; GLSL version: 4.50, Vendor: Intel Open Source Technology Center, Renderer: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2)

Thanks in advance!

--
ericb

Hey Eric,

I've added a GPLv3 LICENSE file.

To tell you more, I played with opengl/glfw_webcam_image_process.c to horizontaly flip the captured image and I was wondering how to proceed in the case you are interested with the changes. Of course, I can attach a diff , but the code looks not that clean, sorry.

flip/unflip horizontaly in real time what the webcam provides. Just a toy as you can see, but the idea was to show the cpu overload is close to 0%, eating only 22 MB of RAM (640 x 480 at 30fps, GPU , e.g. using Logitech C920)

Are you also measuring RAM / CPU usage inside the program itself, or just through an external system monitor?

I would be interested in the following types of changes to glfw_webcam_image_process.c:

  • add a the flip shader to:
    /*"// Multi-me.\n"*/
  • interactively switch between CPU / GPU and between different shaders, which currently can only be done on CLI
  • RAM / CPU resource usage inside program itself

If you think your code does not fit into those, just push it somewhere and post link to it, I'm still curious.

Originaly : I remember the code was not compiling (Linux x86_64 for me), and the gpu shader didn't work (imho) as expected

I tried it out and it seems to work. How did it not work for you more precisely (error message / what is your OS / what did you see on bad shader).

Hi,

License is often a problem, and GPL is not good for me (I would have prefered LGPL at least, or better MIT), but nevermind, I'll rewrite everything I need.

Waiting, and since you are interested, I'll attach the diff (don't forget to add -lGLEW in the makefile, at least on Linux), under MIT License, so you can reuse whatever you want in your code.

The main changes are:

  • using glew : I'm using Linux, and that's one simple way to use extension (and more recent than 130 glsl)
  • I corrected the array of vertices, because everything was flipped before (just played with the values, as a game, and found a working solution, that could be wrong ...)
  • same change in the fragment shader, and the fix gave my the idea to flip in real time
  • added an uniform value, modified using the keyboard (thus the callback I've added)

Please notice : the attached file has .txt extension, because github does not accept .diff directly. Don't forget to rename it.

I forgot : I'm simply measuring the RAM / CPU load using an external monitor. No clear idea how to measure the GPU load yet ...

Thanks again for your fast answer !

Regards,
ericb

Below, the diff:

webcam_diff.diff.txt