C++ Cross Platform Image Loader for OpenGL - image

I have tried everything from SDL to DevIL, and they have all failed for various reasons.
SDL segfaults for various reasons, and DevIL is having some weird problem where even after i include IL/ilut.h and linking everything, and including the other headers, it is not defining the functions i need to load images into opengl textures (something about USE_OPEN_GL not being defined). I am asking for any other lib out there for loading bitmaps or png's into a format i can easily convert to opengl, or a solution to the devil problem.
thanks

Both libpng and libjpeg can be rather daunting to build & use -- no wonder there are all sorts of wrapper libraries for both.
A very simple and minimal no-nonsense loader for jpg/png (and some other stuff aswell) without dependencies in a single C file is Sean Barrett's stb_image.c, if you just want to load some image files it adds absolutely minimal overhead to your program and is straightforward to use:
http://nothings.org/stb_image.c

As Adam suggests, I would also recommend to use libpng and libjpeg. You are not specifying if you write in C or C++, but if in C++, then I'd suggest to take a look at two handy thin wrappers on the both libraries: pngxx and jpegxx

LodePNG is a highly compact PNG Loader with no dependencies.
Comment on your experience with DevIL - it works flawlessly for me and many others. Why not try again to resolve your build problems? - shouldn't be too hard)

You can also try FreeImage library. It supports loading different image types and is functionally similar to DevIL, may work out of the box for you.
And about your problem with DevIL, you do not have to build ilu or ilut libraries to make DevIL functional. I would recommend you manage the OpenGL texture objects yourself, including uploading image data to OpenGL side.

SOIL is a decent lightweight one I've used before. It's actually specialized for loading OpenGL textures too.
http://lonesock.net/soil.html

you dont need ILUT to do what you want. you can simply use ilGetData() and glTexImage2d()

Loading bitmaps (.bmp) and netpbm images (.pbm, pgm, .pnm) is fairly trivial, since they store images uncompressed. For loading PNGs, use libpng. For loading JPEGs, use libjpeg. For other image types, use an appropriate library. There's a good change that slapping on 'lib' to the beginning of the image name will give you such a library, e.g. libtiff, libtga, etc.
Once you've loaded and uncompressed the raw image data, loading it into an OpenGL texture is just a matter of calling glTexImage2D() with the right parameters, and a couple of other GL state changes (e.g. how to do mipmapping).

Image Magick with either the C or C++ bindings?
http://www.imagemagick.org/script/index.php

Young but yet great enough SFML could be the one you're searching for. I've used it for numerous projects and all of 'em worked well on all my platforms (Win7 and Ubuntu).

Related

How to read and write to a file in OpenGL ES

How does one read or write files (png, txt, jpg...) in OpenGL ES? Target is Android through Visual Studio.
Unfortunately it's not as simple as placing the assets in the same directory as the main program and then referencing them using fstream.h or stdio.h like with the Opengl equivalent. I've tried creating folders like res/raw and using android/asset_manager.h and similar libraries. Is it even possible through this IDE? I'll be done in Unity by the time this gets resolved...
You don't. OpenGL is an API concerned with transforming vertices, and drawing pixels on a screen. File formats are outside the definition of OpenGL. In other words, if you want to use a *.png as an input/output format, you'll need to find a 3rd party library that supports that file format (e.g. libPNG), and use that to transfer the pixel data to OpenGL.
The raw file stream classes (e.g. ifstream) have zero concept of a file format. Again, another reason why you use a 3rd party library.
Unity is a full fledged game engine, and as such has spent time building support for various file formats (e.g. PNG, obj, etc). OpenGL is far lower level that that. A good place to start for image data, is a lib such as DevIL (which itself includes other 3rd party libraries such as libPNG, libJPEG, etc).

Direct3D 11 issues in Windows 10(D3DX11_IMAGE_LOAD_INFO is removed)

As i catch it structure D3DX11_IMAGE_LOAD_INFO is deprecated in DX 11 for Windows 8.1 and up, what kind of structure can i use for replacement for this structure.
D3DX11_IMAGE_LOAD_INFO is part of the D3DX11 utility library from the DirectX SDK.
D3DX9, D3DX10, and D3DX11 are all deprecated along with the legacy DirectX SDK. See MSDN for the full details here.
Depending on what exactly you were wanting to do with D3DX11 here, there are a number of different options (all of which are open source under the MIT license).
The DirectXTex library provides the functionality in D3DX for loading bitmaps, resizing and converting them, generating mipmaps, compressing, and then writing them out as .DDS files. This is usually overkill for most applications to do at run-time, and not a particularly good use of end-user's time anyhow, but it's great for writing custom content tool pipelines for texture processing. The DirectXTex package includes a 'sample' which is the venerable texconv command-line tool written to use DirectXTex instead of D3DX.
The DDSTextureLoader module is intended to handle efficient loading of .DDS files and creating Direct3D 11 resources from them. It does not perform any runtime conversions, so some legacy files with pixel formats that do not directly map to a DXGI format will fail to load and in some cases the DXGI format of the file is not supported by the device and will also fail to load. For these cases, you will want to use DirectXTex to convert them offline to something that you can rely on being able to load on your target machine. This code supports the full range of Direct3D 11 resources including 1D, 2D, 3D, cubemaps, and texture arrays with mipmaps. The DDSTextureLoader module is included in both the DirectXTK library and in the DirectXTex package.
For very simple cases, there is also a WICTextureLoader module which can load standard bitmap files, does some runtime conversions and resizing, and then creates a Direct3D 11 texture 2D from it. It can optionally enable the 'auto-gen mipmaps' feature of Direct3D 11 to provide some basic mipmap support as well (standard bitmap files can't store mipmaps with the base image the way a .DDS file can). This makes use of the Windows Imaging Component (WIC), but is much more 'heavyweight' than DDSTextureLoader. This gives you less control over the quality of the filtering (particularly mipmaps), and does not support complex textures like volume maps, cubemaps, or texture arrays. The WICTextureLoader module is also included in both the DirectXTK library and in the DirectXTex package.
The ScreenGrab module is intended as a light-weight texture saver for creating 'screen shot' bitmap files from render target textures. The ScreenGrab module is included in the DirectXTK library and DirectXTex package.
-- excerpt from this post
For a complete catalog of replacements for legacy D3DX, see this post. There are similar posts for samples, tools, and the DirectX components.
Since you've marked this question with the VS 2013 tag, I'm assuming you are using Visual Studio 2013. You should read about the Windows 8.1 SDK that comes with it. There's a NuGet package for DirectX Tool Kit that works with VS 2013 Update 5, as well as a "Direct3D Game" template package for VS 2013 that you might want to check out.

Is there some easy use image processing/editing library for Cocoa?

Like OpenCV
I hope the library can do several simple image edit operation, like DrawLine(UiImage, startPoint, endPoint), or ConvertToGray(UiImage)
CoreImage is the built-in image manipulation library in Cocoa.
For example: What is the best Core Image filter to produce black and white effects?
I'd suggest using OpenCV , which is a great algorithms and image processing library.
Choosing Opencv would give you more future option.
Try this
OpenCV is not meant for image editing. You can do that, but it's like buying a big track to carry your groceries from the market.
The best way to do it is to look into some already integrated image editing libraries. And as I know, in Cocoa there are several of them. CoreImage, mentioned by Dor, is one of them.
And there are some specialized image editing / UI toolkits that may help you better than OpenCV. You may check whether ImageMagik or QT are available for Mac/iOS

Can FDT deal with .fla files or not?

I'm trying to find an all-in-one IDE for flash, one that can deal with various flash related files.
I just read this answer and it recommends fdt, but seems fdt can only deal with scripts but not .fla ones.
Which IDE should I use so that I can use it to develop various files involved in flash developing?
I am fairly certain it can not. Is there any particular reason you need this? Most developers code in external .as files. This way code is in one location and not buried in the timeline. Also the code can be placed in source control.
For an all in one solution, Adobe Flash CS5 is probably your best bet. They have somewhat improved the IDE and added things like autocomplete.
Flash Builder 4 and Adobe Flash CS5 have finally solved this problem - you can now create an FLA in Flash and then use the wizard to easily create a Flash Builder project around the .fla. All of your classes have access to library exports etc, and you can set it up so that when you click to edit a Class file in Flash it automatically opens the file in Flash Builder.
I really like it.

How to make Boost::GIL work with PNG & JPEG IO?

Boost::GIL has almost perfect tutorial and manual. I find it troublesome to lack guide on building and using Boost::GIL work with PNG & JPEG IO. Does anyone have experience or have successfully did that? Please kindly advise! Thanks!
EDIT:
Answer lies here: http://opensource.adobe.com/wiki/display/gil/Downloads
I have used GIL successfully with JPEG.
I assume that you have downloaded and included the boost::gil headers.
The jpeg library is NOT included in the boost library.
The simplest thing is to include and link to one of the many copies of the jpeg library that are distributed. I use the one with wxWidgets ( wxWidgets-2.8.10\src\jpeg ). If you search your disk for the file jconfig.h, you should find a configured and built jpeg library that will work for you.
You can download the jpeg library source from http://www.ijg.org/ but then you will have to configure it for your platform and build it.

Resources