What is the easy way to create a GUI and render graphics in C or C++ on Linux? Or is there even an easy way?
I've tried OpenGL and it was too weird. SDL was weird but not as much.
There are also PureBasic and Lazarus. They are not C or C++ but what the heck?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 50
Thread
-
-
SDL2, GLFW (OpenGL) and may be FreeGLUT are the main rendering APIs I can think of.
Creating a GUI should be easy with for example Qt which also has some bindings for opengl. (there also projects out there which help with using SDL2 ant Qt together, but I've never tried those,..)users currently on my ignore list: deadrats, Stears555 -
C/C++ is not easy, period. It's not a high level language, more like a high level assembler. Anyone who says it's easy is a web poser. If you're new to programming you may be better off with something simpler like python or perl.
-
Last edited by Groucho; 3rd Dec 2018 at 10:22.
-
Why must it be compiled? To processor code? To intermediate code?
-
-
Brave statement Groucho... Plain C lacks of many things common in high level language and from programmer perspective it looks more like machine language than high level language... Don't be so tense Groucho.
@OP - BASIC compilers exist and if you are more familiar with BASIC then give a chance to BASIC. Or perhaps you should use something tailored for tasks as yours ( https://gstreamer.freedesktop.org/ ? ) -
I was mainly referring to C++ which is clearly a high level language. The fact that C looks like machine language to some people is just a silly argument.
He, he, I'll do my best. It just pushes my buttons when someone without a frickin' clue spreads FUD. -
Once again C++/C# is different story, C has plenty things common with ASM (operators are practically same as in inline asm).
It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support.
Personally feel ASM easier (condition is understanding of CPU and system architecture) than C but perhaps this is outcome of my youth programming experience where BASIC or ASM was only two practical approaches. Tried so many times to learn something modern but never succeeded. -
Or perhaps you should use something tailored for tasks as yours
I have already mentioned PureBasic and Lazarus. PureBasic is broken - it is not able to compile on Linux (compiles fine on Windows but has the flickering video problem we've been discussing). -
There's .Net Core with System.Drawing.Common which runs on Linux. I have no idea how fast.
https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx -
For example dedicated multimedia framework https://gstreamer.freedesktop.org/ - you can use ffmpeg as plugin and i assume (sorry as i'm not a software guy) you have examples how to use it...
-
Personally feel ASM easier (condition is understanding of CPU and system architecture) than C but perhaps this is outcome of my youth programming experience where BASIC or ASM was only two practical approaches. Tried so many times to learn something modern but never succeeded.
-
Python is an interpreted language. When you have 921,600 (720 x 1080) pixels to manipulate, it's going to be as slow as molasses. Each pixel must have lift, gamma and gain applied, as well as conversions between RGB and YUV.
Vapoursynth uses ffmpeg with all its unpredictability. -
Like I wrote before, Qt is a good frame work when working with C++ (or Java or Python).
Depending on what you want to do there are XY additional libraries that could be used.
-> Assuming you know your way around C++ this is the way I would go.
In the end there are libraries for all mayor languages which allow basic graphic operations, depending on what you want to write yourself you will probably either way have to write OpenCL/OpenGL or Assembler code in case it needs to be fast.
In case you are no experienced programmer, using Python and at least partially using Vapoursynth and libav seems to make the most sense, since it has the lowest learning curve and the existing base operations should all be assembler optimized. (Vapoursynth doesn't have to use libav/ffmpeg at all,..)users currently on my ignore list: deadrats, Stears555 -
I have basically ancient PC (i5 650@3.20GHz) and it can render on screen 10bit UHD camcorder footage with 8 fps with ffms2 source plugin(using Vapoursynth with Python code and opencv to print it on screen or pyqt5 (QT5 libraries for Python), which works even better as gui. Sure you give it something more to process and it slows down. But you said you do not need to play it. Image processing codes work arrays or numpy arrays and access is pretty fast.
Citing from here:
"VapourSynth is an application for video manipulation. Or a plugin. Or a library. It’s hard to tell because it has a core library written in C++ and a Python module to allow video scripts to be created."
So it is not written in Python.
Not commenting about that it uses ffmpeg, because I use Vapoursynth or avisynth just because it is not ffmpeg. You have struggles with input and output color schemes and transfers, but using Vapoursynth you have basically everything under control. Vapoursynth uses source plugin that can or would not read matrix, color primaries, transfer . You can check it. Then you decide if you believe it or not. And now comes the part that you just can select props and set it as you want or use format conversions with your choice, rules are simple and pressed into one function , Vapoursynth plugin Resize. If I look at ffmpeg command lines its all over the place and it sounds complicated, or defaults might be used. -
I just tested the same HEVC clip with the same source plugin, using Vapoursynth editor, which is written in C++ as well, and it gave me just about 2 fps more previewing it (meaning one YUV to RGB conversion was involved). He uses QT for his gui. Python code or Vapoursynth script (its the same) serves as a sort of wrapper but not handling heavy image processing. I would not try to reinvent wheel computing RGB values manually and when encountering a new format yet again looking for formulas. To manipulate YUV values or RGB , Expr can be handy (expressions), lut also. Just look into some py file that consists of filtering or they were ported from avisynth. Like havsfunc.py from HolyWu etc.
NOTE: to preview it on screen for example using QT there is other thing involved like creating pixmap that QT uses to put it on screen, not sure what it is internally what array, but just to get a pictureLast edited by _Al_; 4th Dec 2018 at 17:03.
-
-
-
-
I received my B.S. degree in computer science in the mid-1980s. Both C and C++ were classified as high-level programming languages at that time because they used recognizable words from a human language as instructions and were not tied to any particular processor. I don't know why some people here are claiming that they are low-level languages since the definition of "high-level programming language" has not changed in over 30 years.
Ignore list: hello_hello, tried, TechLord, Snoopy329 -
-
-
C is not a "very high level" language, nor a "big" one, and is not specialized to any particular area of application. But its absence of restrictions and its generality make it more convenient and effective for many tasks than supposedly more powerful languages.C is a relatively "low level" language. This characterization is not pejorative; it simply means that C deals with the same sort of objects that most computers do, namely characters, numbers, and addresses. These may be combined and moved about with the arithmetic and logical operators implemented by real machines.
C provides no operations to deal directly with composite objects such as character strings, sets, lists, or arrays. There are no operations that manipulate an entire array or string, although structures may be copied as a unit. The language does not define any storage allocation facility other than static definition and the stack discipline provided by the local variables of functions;there is
no heap or garbage collection. Finally, C itself provides no input/output facilities; there are no READ or WRITE statements, and no built-in file access methods. All of these higher-level mechanisms must be provided by explicitly called functions. Most C implementations have included a reasonably standard collection of such functions.
Similarly, C offers only straightforward, single-thread control flow: tests, loops, grouping, and sub-programs, but not multiprogramming, parallel operations, synchronization,or coroutines -
I programmed in C for several years and I still have an older edition of "The C Programming Language" on my bookshelf to this day. Note that the authors said C was a "relatively low level language" not that it is a low-level language. What they mean is that C lacks some advanced features that a number of more modern programming languages have built into them and provides some low-level operations that some newer languages don't provide.
The textbook computer science definition for high-level languages states that the language must provide a high level of abstraction, that instructions are likely to be recognizable words from a human language, and the language is not tied to any particular system architecture. C meets all of those requirements. I also programmed in an assembly language for a few years, which met none of those requirements and was a true low-level language.Ignore list: hello_hello, tried, TechLord, Snoopy329 -
you load a clip choosing a source plugin, in example it is lsmas.LWLibavSource for mp4, and for example lowering luma by 10 you can use Expr:
Code:from Vapoursynth import core import vapoursynth as vs file=r'F:\ma\path\to\file\my.mp4' clip = core.lsmas.LWLibavSource(file) #checking what color space file is, if you do not know if clip.format.color_family == vs.ColorFamily.YUV: space = 'YUV' #there is also RGB, GRAY, YCOCG and COMPAT value = 10 Y_expr = 'x {value} -'.format(value=value) U_expr = '' V_expr = '' clip = core.std.Expr(clip, expr = [Y_expr,U_expr,V_expr]) #clip is YUV , so you need to get it on screen as RGB 8bit, assuming input is BT709: if space == 'YUV': rgb = core.resize.Bicubic(clip , matrix_in_s = '709', format = vs.RGB24, range ='limited') #to get a frame from your rgb, for example first frame(0 , pyhon indexes from 0), but it could be any frame : rgbFrame = rgb.get_frame(0) #now you have RGB24 image that most gui's can put on screen, you just need to know what array and how arranged it has to be, so it is gui specific further #to get it out thru vspipe.exe (encoding, piping it somewhere) you specify output: clip.set_otput()
Last edited by _Al_; 6th Dec 2018 at 13:44.
-
Tried to close this OT discussion providing statement from C creators. It is quite obvious that C is NOT assembler but high level language - it provide sufficient abstraction layer and ISA independence/portability - that's all - anyway it is closer to machine (with sufficient abstraction layer that provide portability) than any other high level language known to me.
btw - assemblers use words (or they abbreviation) from natural human language - MOVE, MULU, NOP on MC68k .
It is even worse - Some CPU can use high level language directly for example FORTH has at least few silicone implementations where CPU directly perform FORTH so high level language act as machine code.Last edited by pandy; 6th Dec 2018 at 13:26.
-
Here is the output of your Python demo:
>>>
Traceback (most recent call last):
File "C:\Archive\Python\test2.py", line 1, in <module>
from Vapoursynth import core
ImportError: No module named 'Vapoursynth'
>>>
Similar Threads
-
MPC-BE and integrated graphics
By Seeker01 in forum Software PlayingReplies: 4Last Post: 11th Sep 2018, 10:03 -
Minimum 4K graphics card
By kyrcy in forum ComputerReplies: 17Last Post: 14th Jan 2018, 14:04 -
Budget 4K graphics card
By kyrcy in forum ComputerReplies: 8Last Post: 24th Dec 2017, 17:04 -
New graphics card suggestion
By kyrcy in forum ComputerReplies: 9Last Post: 14th Dec 2016, 14:41 -
How much is the graphics card used in video encoding?
By justinrye in forum Newbie / General discussionsReplies: 11Last Post: 8th Nov 2014, 17:36