Library to that allows setting of individual pixels within a window - c++

I am running Linux. I am looking for a library that will allow me to set up individual pixels within a window on screen. I am working on an embedded application and it would be a lot easier to develop my algorithms on the computer rather than the project. Im looking for something along the lines of display.setPixel(x, y). Does anybody know of any similar solutions? Im looking for something using C or C++

I suggest you start with SDL:
http://www.libsdl.org/
It also has some nice image loading routines, OpenGL and other stuff you may find useful. It can be used with either C or C++.

Related

PNG Texture OpenGL es 2.0 Android NDK

I'm developing a game, actually my first game, so I'm new in this world, I'm using OpenGL with NDK and C++ for the render part, and I call it from java with JNI. I'm stuck with the textures topic, since I need to use PNG with alpha channel and use TTF for some text.
I can include the libpng, but since I'm using the experimental gradle puglin, I don't know how to add the library and use it, I saw that the library can be precompiled and be added, but from what I saw, only for one architecture, then, I don't know if I'm wrong, but I think if I add the source code of the library and compile it with the program, I think, it will be compiled for the architectures that I need (MIPS, 64-bit ARM, x86, 64-bit x86, ARM), so that is one, I was thinking in pre-convert the png in raw RGBA and use that vector directly with opengl but again, I dont know how to do this.
and with the TTF issue, well I am in blank, if you have any advice for this I would greatly appreciate it.
Thanks for your help.
You can build the whole FreeType engine into your code, or you can just use what's already part of Android: use Canvas to render glyphs to a Bitmap. You can find an example of this in Android Breakout. The game is written in Java rather than C++, but the Java-language GLES code is just a thin wrapper around the native stuff, so it's pretty similar.
There's a pretty good blog post about GLES text on Android here.
On a similar note, you already have a copy of libpng in your app. You can call through the Bitmap API to use it.
If you have as a goal the creation of an entirely self-contained native app, then the approach of calling into Canvas/Bitmap isn't viable. I don't think that's a particularly useful goal, however. You're better off separating the "game engine" from the game logic, e.g. have platform-specific "decode PNG" and "pass this pile of RGBA pixels into glTexImage2D()" functions, and platform-agnostic "use texture N".
Taking that one step further, your best approach is to use an existing graphics engine or game engine, and focus on creating the game rather than writing the engine. Learning about engines by writing one is a worthwhile endeavor, but if your actual goal is to write a game then you should focus on the game itself.

How to draw graphics on screen without using any framework or library?

I want to manually draw the graphics, what that mean is without using any library or frame work like QT, directX , whindow.h .... like giving command to every pixels on the screen to show some specific color at different time. Every body gives tutorials on based on these library or whatever they are called. What i want is to make my own GUI. As far as I could think it is going to be very complicated, hard to learn and to understand, messy and a lot of time consuming, but I am ready for that. I need some resources to understand that.
and Yes i know C++ so it would better if I had to work with this language but I will learn other language if it is required, just i want to know which language i should learn.
In the old days, you could write directly to video memory with no help from the operating system/ROM. Today, on current hardware, you have to go through the operating system in order to write to the screen. That means using a separate library (like Qt) or using the OS features (windows.h). You could use directX or something and get more raw access to video memory, but that is still using a library/framework.
If you want with C++ and native Windows API (without DirectX) , you should use GDI(Microsoft Graphics device interface) + MFC(Microsoft Foundation Classes) this is a classic implementation of Windows GUI, If you want complicated graphics with shaders you need DirectX/OpenGL without hesitation. meanwhile if you want higher programming framework you can use C#(CSHARP) or Java.

How to save graphic to bmp

Need help with an interesting task. I need to write a C++ program that builds the graph and save a graphic file format bmp. I know how to initialize the bmp, but how to build a graph in it , I can`t think up. Necessary practical and theoretical help if there is a link to an article on the subject.
P.S. I apologize for my bad English :I
There are a lot of ways to do graphics in Windows. The lowest level and most fundamental is to use the Win32 APIs that employ the GDI (Graphics Device Interface), which is built in to Windows. With GDI calls you can paint anything to the screen, and the same GDI calls can be used to paint on an in-memory bitmap that is off screen. To get started in this direction search the net for Win32 tutorials.
I recommend FreeImage library (http://freeimage.sourceforge.net/) it's simple and fast lib without additional problems, you can manipulate graphic files dealing with them like 2D array.
And also, they have nice PDF document about API, you don't need tutorials to use it, just read API and you will get it. Also pr0tip: DON'T PUT SPACES BEFORE SPECIAL CHARACTERS LIKE ",!?.".
You might want to take a look at the graphviz package.

C++ Graphic API with a small learning curve - linux

i have to do some very basic drawing in Linux , like joining some points , tracing trajectory of a moving point . I am looking for a graphic library which has a very small learning curve so that i can save my time and avoid getting into things like gtk and opengl since i don't need something complicated .
Edit 1 :Can you provide links to the tutorials for SDL which explains very basic drawing also for any other libraries which you think is relevant .
You want pygame, Allegro, or SDL with SDL_gfx. All of these are available through the most popular package repositories.
Be prepared to get used to dealing with surfaces, graphics primitives, blitting, and the like. The learning curve is not large, but it's still a significant paradigm shift if you've never done graphics before.
I was taught with FLTK, and as the middle aged man says "I turned out OK didn't I?"
You might be also interested in Cocos2dx, it works on many different platforms (linux included).

Animation with C++

is there anyway to build rich animation with C++?
I have been using OpenCV for object detection, and I want to show the detected object with rich animation, Is there any easy way to realize this?
I know flash can be used to easily build rich animation. But can flash be reliably integrated with C++ and How?
Also, Can OpenGL help me with this? To my knowledge, OpenGL is good for 3D rendering. But I am more interested in showing 2D animations in an image. So I am not sure whether this is a right way to go.
Another question, how are those animations in augmented reality realized? What kind of library are they using?
Thank you in advance.
Its difficult to tell if this answer will be relevant, but depending on what sort of application you are creating you may be able to use Simple DirectMedia Layer.
This is a cross-platform 2D and 3D (via OpenGL) media library for C, C++ and many other compatible languages.
It appears to me that you wish to produce an animated demo of your processing results. If I am wrong, let me know.
The simplest way to produce a demo of a vision algorithm is to dump the results to a distinct image file after each processed frame. After the processing session, these individual image files are employed to prepare the video using e.g. mencoder. I employed such procedure to prepare this.
Of course, your program can also produce OpenGL. Many people dealing with 3D reconstruction do that. However, in my opinion that would be an overkill for simple 2D detection. Producing flash would be an even greater overkill.