matus-chochlik / oglplus

OGLplus is a collection of open-source, cross-platform libraries which implement an object-oriented facade over the OpenGL® (version 3 and higher) and also OpenAL® (version 1.1) and EGL (version 1.4) C-language APIs. It provides wrappers which automate resource and object management and make the use of these libraries in C++ safer and more convenient.
http://oglplus.org/
Boost Software License 1.0
494 stars 71 forks source link

Is there a util to load images in the API? #43

Closed sasmaster closed 10 years ago

sasmaster commented 10 years ago

I found load.hpp in /image ? Can it load anything or just what is embedded into the API?

Thanks,

sasmaster commented 10 years ago

I also found png.hpp but its impl file throws "can not find png.hpp" smth like that....

matus-chochlik commented 10 years ago

Could you post the error message ? To use the png loader you need to have libpng installed.

sasmaster commented 10 years ago

Well, yeah I guessed so... So I added libpng stuff into oglplus-site.props but still the same error.

Error 2 error C1083: Cannot open include file: 'png.hpp': No such file or directory c:\users\michael\documents\opengl_stuff\oglplus_git\oglplus\implement\oglplus\images\png.ipp 15 1 001_triangle_glut_glew

matus-chochlik commented 10 years ago

That's strange because line 15: includes 'png.h' not png.hpp. Anyway, you need to reconfigure oglplus, so that it knows where to find the libpng's headers. To do that you need to add --include-dir C:\path\to\png\header\dir --library-dir C:\path\to\png\lib\dir when running configure. Manually editing site-config won't work.

In case you are building your own application you also need to specify the include and library dirs to the compiler.

sasmaster commented 10 years ago

Hmm.. That's a kind of problem.I don't run any config...I just have edited site-config.Can I config the VS solution included with OGLPlus manually ?

sasmaster commented 10 years ago

Btw, now I recall why I hadn't used configure.bat eventually on windows.It doesn't work.It returns :"@echo:command not found, ::: command not found "

sasmaster commented 10 years ago

$ configure.bat ./configure.bat: line 1: @echo: command not found ./configure.bat: line 2: ::: command not found ./configure.bat: line 3: syntax error near unexpected token (' ./configure.bat: line 3::: Software License, Version 1.0. (See accompanying fi le'

matus-chochlik commented 10 years ago

That's strange I usually test configure.bat on two machines with windows 7 before release and it works there. Sorry if this is a stupid question but aren't you by any chance running configure.bat from the bash shell coming with the windows install of GIT ? If so, you need to run it from the windows command-line.

But to get libpng going you can do one of two things:

A) copy png.h (and any other headers coming with libpng) to MSVC's include directory, copy. png.lib file to the MSVC's lib directory, and copy png.dll to system32 (you'll need admin rights to do this)

or

B) If you have the lib installed somewhere else and you don't want to do A)

You can edit the $OGLPLUS/etc/msvc11/OGLplus/OGLplus-site.props and do the following:

1) There are some identifiers with trailing underscores like OGLPLUS_DEP_INCLUDEDIRS, etc., for every occurrence remove the last underscore in all such identifiers in this file.

2) there are 4 XML elements like [OGLPLUS_DEP_INCLUDEDIRS]...[/OGLPLUS_DEP_INCLUDEDIRS] containing some example paths, replace these paths with real paths to the include and library dirs, etc.

sasmaster commented 10 years ago

The answer to your first question is : YES/ (thought it should do no difference . Other ways:

A) still didn't try. B) That is what I am doing currently and it doesn't help.The impl doesn't detected the png.hpp header which I think is the OGLplus png.hpp and not libpng.h

matus-chochlik commented 10 years ago

bash cannot interpret windows batch files so you need cmd.exe to run configure.bat. b.t.w. you can use the --for-msvc 10 or --for-msvc 11 command line option to force configure to use the MSVC generators.

Anyway, if you look here: https://github.com/matus-chochlik/oglplus/blob/develop/implement/oglplus/images/png.ipp

line 15 includes png.h not png.hpp. So if you have there #include "png.hpp" then that's an error. Pull the latest version and try again.

sasmaster commented 10 years ago

OK....That's what I did.I changed to png.h .It started complaining about zlib.So I also added zlib header and lib.Then in zconf.h it started complaining about include .Fixed it by wrapping with #if HAVE_UNISTD_H instead of #if 1 ..... Now seems to be working :))) .Any plans to add a built in image loader? Unofficial OpenGL framework has something like that.

Thanks for help.

matus-chochlik commented 10 years ago

No problem,

as for the loader, what exactly do you mean ? There is the images::Load function that loads the images::Image class that can be used directly with Texture::Image*. It currently supports PNG's and (some) XPM's. I have somewhere a PNG, BMP and TGA loader that I wrote a decade or so ago which I could probably use to get rid of the libpng dependency but, it was not very robust :P

sasmaster commented 10 years ago

Well,if it was just dependent on passing in libpng it would be tolerable but once the user is asked to link also vs zlib and configure it ,for many people it may become a pain in the ass :) Probably some header only stuff would be nice,I think GLM creator also has something like this

On Fri, Jan 10, 2014 at 8:12 PM, Matus Chochlik notifications@github.comwrote:

No problem,

as for the loader, what exactly do you mean ? There is the images::Load function that loads the images::Image class that can be used directly with Texture::Image*. It currently supports PNG's and (some) XPM's. I have somewhere a PNG, BMP and TGA loader that I wrote a decade or so ago which I could probably use to get rid of the libpng dependency but, it was not very robust :P

— Reply to this email directly or view it on GitHubhttps://github.com/matus-chochlik/oglplus/issues/43#issuecomment-32050916 .

Michael Ivanov Independent Pixel Commander onlygraphix.com Tel:+972 54 4962254