Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Are there any C++ (LGPL or LGPL-like) sound libraries which allow me to play a sound by purely specifying stuff like frequency and volume etc?
My target platform is Linux/Ubuntu and I don't really care about cross-platform.
It would be nice if I could send an array of sound and it would be able to compress it into a common sound file like for example mp3.
I'm looking for something OpenGL-like where you can just 'draw' the sound and it'll be played.
I have heard about OpenAL but that only seems to be a library for loading and playing sounds.
Most simple and low-level audio libraries (e.g OpenAL, SDL, etc.) can play PCM waveforms quite easily. You fill a buffer with the wave you want to play, and play it. To make a waveform from stuff like frequency and volume and whatnot, you need to write a bit of code (probably a couple of lines for simple waves) and need to know basic trigonometry.
OpenAL is a cross-platform API targeted towards 3D games. Its interface is philosophically similar to OpenGL and provides functions to manage audio sources in a virtual 3D environment (position, speed, etc.) and provides some sound and environment effects (reverb, etc.) I know that it can decode some compressed formats (MP3, Vorbis,...) using extensions, but I'm not sure whether it has any encoding functionality.
SDL (or Simple Direct-media Layer) is also cross-platform and game-oriented, but it offers much more than audio. But any functionality that it does offer is very basic and this is intentional and by design. SDL is a platform abstraction layer. It's audio capabilities are similarly very basic and low-level; providing only playing and recording PCM waves. Of course, there are extention libraries (e.g. SDL_mixer) that have more functionality.
References:
OpenAL on Wikipedia
OpenAL homepage (seems down, as of Aug 5th, 2013)
OpenAL Soft, a fork of the OpenAL library available from Creative Labs
SDL homepage
SDL_mixer
As far as I know, both projects ship documentation and examples along with their source code, so you might want to get their source code and start experimenting.
If I've understood what you want to do correctly, either of these libraries can do what you want rather easily, but in my personal opinion, SDL is simpler and easier to use (unless you want 3D positional audio and effects.)
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
We are a small company with only 2 programmers. We currently make small 2D and 3D games for desktop and mobile using Adobe Flash/Air. We want to stop using that framework and start learning and developing on C++ because there are much more and better libraries and frameworks available on C++.
I'm not sure about the libraries to use for rendering. I know that Ogre3D is a great rendering engine for 3D content but sometimes we need to make 2D games or "2.5D" games, sometimes with video playback, and all that need to be mixed with 3D scenes.
I know there are 2D frameworks like cocos2D-x and smfl that works with OpenGL (I don't know much about OpenGL) and can do all the 2D things I need, but can those frameworks be combined with Ogre3D? And can it be done without the need of knowing how all the Ogre3D internal stuff or OpenGL works?
If Ogre3D can be combined with any 2D engine, what do I need to learn to merge the frameworks?
Given that you have been using flash, I am guessing you are not porting old C++ code.
Also, since you don't want to know about how the internals of the framework you're using or how OpenGL actually works, you don't need a low level language like C++.
An abundance of open source libraries is not a very good reason to program your game in C++ either.
Unity3D has a free basic license, and provides everything you need out of the box.
For now, you can use planes with textures to do your 2D work, but Unity will also be coming out with a set of Native 2D Tools in the near future. Also, a new GUI system is being created.
For any C++ library you think you may need, there is probably something already built into unity that does what you want. If there isn't, there is probably a .NET port that you can use. And if all else fails, you can write a C interface for any library you need, and use it as a plugin in Unity.
One big problem with Unity though, is that you need Unity Pro to use plugins. Unity licenses are per-platform, So if you decide to use plugins, and release your game for multiple platforms, you could end up paying a lot of money in licensing fees.
Finally, it's not just an application framework you'll need. You'll also need a level editor. Building a 3D level editor is not a trivial task, and given that your team consists of only two people, this fact alone should be enough to seriously consider using Unity.
So unless you are porting old code, need low level access to hardware, or have specific needs for native code, my advice is don't use C++, just use Unity.
Yes, Ogre3D can handle such "2D tasks" as playing a video. Simply a plane in 3D space that it gets projected onto. However for pure 2D projects an 3D rendering engine such as Ogre3D is usually overkill. If you are talking about 2,5D though, you are back in play with Ogre3D.
Regarding integrations: Not completely sure, but I guess those other 2D frameworks need an OpenGL rendering context that you can get from Ogre.
EDIT: Same question has been asked in the official Ogre3D forums.
We are another small team working on game development.
We tried many rendering engines and finally settled down with Irrlicht Rendering engine. Irrlicht is no way better than Ogre 3D or am not trying to prove that. We felt Irrlicht more flexible for our need. It also supports 2D rendering and it is quite fast with batching. Irrlicht can be easily ported to other platforms, It took us a week to port it to Google Chrome NaCl.
Irrlicht is a very basic rendering system that supports OpenGL and OpenGL ES, so its easy for your to go mobile. You can add any advanced features without much effort. Some of our games are available for iOS, Android, Windows PC, Mac OSX, Linux and Google Chrome Native Client.
This question already has answers here:
Rendering Vector Graphics in OpenGL? [duplicate]
(5 answers)
Closed 5 years ago.
I want to use Vector graphics in an OpenGL game. I want to use vector graphics because they can be scaled cheaply without loss of quality.
Of course, the drawing should be hardware accelerated, so I do not want to draw in software to a texture.
Now I am wondering if a library doing this already exists. Is there a library, that can load some vector graphic format and display it using OpenGL?
I would not bother with anything OpenVG, not even with MonkVG, which is probably the most modern, albeit incomplete implementation. The OpenVG committee has folded in 2011 and most if not all implementations are abandonware or at best legacy software.
Since 2011, the state of the art is Mark Kilgard's baby, NV_path_rendering, which is currently only a vendor (Nvidia) extension as you might have guessed already from its name. There are a lot of materials on that:
https://developer.nvidia.com/nv-path-rendering Nvidia hub, but some material on the landing page is not the most up-to-date
http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/opengl/gpupathrender.pdf Siggraph 2012 paper
http://on-demand.gputechconf.com/gtc/2014/presentations/S4810-accelerating-vector-graphics-mobile-web.pdf GTC 2014 presentation
http://www.opengl.org/registry/specs/NV/path_rendering.txt official extension doc
NV_path_rendering is now used by Google's Skia library behind the scenes, when available. (Nvidia contributed the code in late 2013 and 2014.)
And to answer a more specific point raised in the comments, you can mix path rendering with other OpenGL (3D) stuff, as demoed at:
https://www.youtube.com/watch?v=FVYl4o1rgIs
https://www.youtube.com/watch?v=yZBXGLlmg2U
You can of course load SVGs and such https://www.youtube.com/watch?v=bCrohG6PJQE. They also support the PostScript syntax for paths.
An upstart having even less (or downright no) vendor support or academic glitz is NanoVG, which is currently developed and maintained. (https://github.com/memononen/nanovg) Given the number of 2D libraries over OpenGL that have come and gone over time, you're taking a big bet using something not supported by a major vendor, in my humble opinion.
Take a look at OpenVG.
Lots of discussion in this Slashdot post about renderers for SVG. I don't know which of them using OpenGL, if any.
This SO question also has several suggestions, including sauvage which is done in Python. Cairo is also apparently a possibility.
There are several powerful libraries that render SVG without OpenGL. I wonder if it's not really that necessary: maybe drawing lines is already accelerated enough on most systems' graphics cards.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
coming from Windows (MSVC++ 2005):
What SDK or alike do you recommend to port an C++ application (DirectShow+Direct3D) to Linux playing video file + using fragment shaders?
is there any reason you need a fragment shader at all? (are you doing post processing on the video images?). You don't need to do any shader coding to get a video playing with OpenGL.
I would use ffmpeg (libavcodec actually) to do the video decoding. Displaying a frame just requires an OpenGL texture and a call to glTexSubImage2D each frame to do the update.
Using FFMPEG in C/C++
You need to use OpenGL instead.
Some tip for the implementation:
- To achieve a good performance you
need to make sure a good video card
driver is installed.
- If you are not familiar with OpenGL
start it with the 'Red book' - OpenGL
Programming Guide
- You may need to download the latest extension header from here
http://www.opengl.org/registry/
- The library GLEW may help you in
identifying the available
extension.
- Include the GL/gl.h and the glext.h file in your project
- Link to the driver's opengl dynamic library: /usr/lib64/libGL.so or simmilar
i would also check the gstreamer framework on linux if you need to port a more complicated directshow application. it also has some sort of graph for media playback to build. it is totally different, but if you have experience and the need for complicated directshow, then you will see some analogy.
and gstreamer also has an opengl plugin for image effects and shaders, ....
http://www.gstreamer.net/
http://www.gstreamer.net/releases/gst-plugins-gl/0.10.1.html
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Trying to decide on a library for creating a window and capturing user input for my OpenGL app, but there are just way too many choices:
GLUT (win32)
FreeGLUT
OpenGLUT
SFML
GLFW
SDL
FLTK
OGLWFW
Clutter
Qt
Others?
GLUT is simply outdated. I liked GLFW but it seems you can't set the window position before displaying it (I wanted it centered, is that so much to ask?) so you see it appear and then shift over, which bothers me. Plus development seems to have stopped on it too. SFML has some nice features, but it uses event polling rather than callbacks which I prefer for decoupling. I don't think I need all the GUI features of FLTK. SDL is slow (doesn't seem to take advantage of the GPU). And the other 3 I don't know much about (FreeGLUT, OpenGLUT, OGLWFW). So which is the lesser of the evils? Are there others I haven't heard about?
I'm just trying to make a simple 2D game. I'm familiar enough with OpenGL that I don't really need drawing routines, but I probably wouldn't complain about other functions that might be useful if they are implemented properly.
SDL allows you to create an OpenGL context that is accelerated (depending on drivers / hardware support).
I know you tagged as C++, however pygame (python) is a great library for creating 2D games, which also supports an OpenGL context. Pygame is built on SDL.
Clutter is a new OpenGL based GUI library with bindings for Perl, Python, C#, C++, Vala and Ruby. I haven't used it myself. From the website:
Clutter uses OpenGL (and optionally
OpenGL ES for use on Mobile and
embedded platforms) for rendering but
with an API which hides the underlying
GL complexity from the developer. The
Clutter API is intended to be easy to
use, efficient and flexible.
GLUT and the other GLUT alternatives should not be used in any sort of production application. They are good for putting together a quick demo application or to try something out, but not for much more than that.
If you're trying to make an OpenGL game, I'd recommend SDL. It focuses more on gaming needs. It most definitely can be used with OpenGL. A brief google for "SDL OpenGL" turned up this link on how to initialize OpenGL with SDL. Enabling OpenGL should also enable hardware rendering with the GPU.
Qt is a reasonable alternative, but it's better if you want to embed OpenGL within a larger, desktop application (think 3D modeling, CAD/CAM, medical visualization, etc) where you need access to standard OS widgets for the UI.
I'd go for Qt. Nice general purpose library + opengl support
IF "learning c++ part of what you're trying to achieve":
then
IF "you only want to learn OpenGL with a fullscreen mode":
USE GLUT //Because it's VERY VERY simple. You can get set up VERY quick
ELSE:
USE QT //Great library, has many many things that will help you. It is portable, it has a nice API
ENDIF
IF "you don't need C++":
then
USE Python //I recommend it, it is fast, no long link times, good api, omg I love this language
Background:
I also tried to make simple 2D games once, I started with C++ and NeHe. I knew nothing about OpenGL and C++ (had Java background). The language overrun me, so did OpenGL. So it was a very hard learning curve.
I don't recommend going that way, since you can get faster results by using a dynamic language (such as Python). So I started learning some years later with python. I could get the "rotating cubes" working much faster.
We have had rather good experiences with ClanLib 0.8 in 2008 and ClanLib 2.1 in 2009 on our C++ course. The productivity of the students (as measured by the quality of their project works) has greatly increased since switching over from SDL. However, it needs to be noted that 2.1 is still very incomplete and one will certainly run into features that are simply not implemented yet.
A couple of groups used Irrlicht (3D engine) with good results.
SFML looks promising, but I haven't had a chance to try it yet.
As others have stated, GLUT is not really suitable for anything serious. The rest of the libraries mentioned are something more of GUI toolkits than game development libraries.
Per recent corespondance with the author, development on OGLWFW has stopped.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm interested in learning to use OpenGL and I had the idea of writing a music visualizer. Can anyone give me some pointers of what elements I'll need and how I should go about learning to do this?
If you use C++/CLI, here's an example that uses WPF four (fourier that is;) display.
He references this site (archived) that has considerable information about what your asking, here's anoutline from the specific page;
How do we split sound into
frequencies? Our ears do it by
mechanical means, mathematicians do it
using Fourier transforms, and
computers do it using FFT.
The Physics of Sound
Harmonic Oscillator
Sampling Sounds
Fourier Analysis
Complex Numbers
Digital Fourier Transform
FFT
Ahhh, I found this (archived) a few minutes later, it's a native C++ analyzer. Code included, that should get you off and running.
My approach for creating BeatHarness (http://www.beatharness.com) :
record audio in real time
have a thread that runs an FFT on the audio to get the frequency intensities
calculate audio-volume for left and right channel
filter the frequencies in bands (bass, midtones, treble)
now you have some nice variables to use in your graphics display.
For example, show a picture where the size is multiplied by the bass - this will give you a picture that'll zoom in on the beat.
From there on it's your own imagination ! :)
Are you trying to write your own audio/music player? Perhaps you should try writing a plugin for an existing player so you can focus on graphics rather than the minutia of codecs, dsp, and audio output devices.
I know WinAMP and Foobar have APIs for visualization plugins. I'm sure Windows Media Player and iTunes also have them. Just pick a media player and start reading. Some of them may even have existing OpenGL plugins from which you can start so you can focus on pure OpenGL.
If you're just after some basic 3D or accelerated 2D then I'd recommend purchasing a copy of Dave Astle's "Beginning OpenGL Game Programming" which covers the basics of OpenGL in C++.
For the music analysis part, you should study the basis of Fourier series, then pick a free implementation of a DFFT (digital fast fourier transform) algorithm.
You can find implementation of FFT algorithms and other useful informations in Numerical Recipes in C book. The book is free AFAIK. There is also Numerical Recipes in C++ book.
You may want to consider using libvisual's FFT/DCT functions over FFTW; they're much simpler to work with and provide data that's similarly easy to work with for the sake of generating visuals. Several media players and visualization plugins use libvisual to some extent for their visuals. Examples: Totem (player), GOOM (plugin for Totem and other players), PsyMP3 2.x (player)
From my point of view...check this site:
http://nehe.gamedev.net/
really good Information and Tutorials for using OpenGL
edit:
http://www.opengl.org/code/