how to use a bitmap Image

Hello,

I have one image like 256x256 pixels and I have multiple little images in there. They are little textures that I will apply on a surface.

What I would like to know if it’s possible with openFramework and VS2010 to work like that? If a texture is 16x16 pixels I would like to take that part of the image from a ressource file in VS2010 and apply it on my Object.

I don’t really know how the ressource files works in VS2010 if anyone know where I could use the info because when I add an ressource I can’t compile anymore.

Thanks

you need to put the image in the application’s bin/data folder and load it, vs2010 doesn’t need to know about it

Take a look at imageLoaderExample that is in the examples/graphics folder

I have one image like 256x256 pixels and I have multiple little images in there. They are little textures that I will apply on a surface.

maybe are you refering to a technique called atlas texturing ? see here: http://en.wikipedia.org/wiki/Texture-atlas

in this case there is no limitation in OF i think . You need specify the tex coord of every little tex inside the big one to the model textured. I think you could use the ofxAssimpModelLoader addon but i never done this with Openframeworks ( it’s used most in the cg game, i used it with ogre engine and neoaxis) .

I don’t really know how the ressource files works in VS2010 if anyone know where I could use the info because when I add an ressource I can’t compile anymore.

as jvcleave says you need put in th bin/data folder of the application your resources files. And you need to change in the code the “name” of the file that you want to load in the application. But i’m not sure to understand why you can’t compile anymore if you add a resource (maybe you are refering to something else?)

anyway @Lorac welcome to the OF forum!

Yes It’s exactly that Texture atlas is there any exemple about it?

I don’t know if there are some ready examples in OF but in the forum i found this http://forum.openframeworks.cc/t/copy-image-into-texture-atlas/3734/0
http://forum.openframeworks.cc/t/part-of-a-texture/5962/0

if you do a search with argument ‘texture atlas’ you can find other topic about. Maybe someone else has some examples that can share it.

maybe this can help you : https://github.com/prisonerjohn/ofxTiledTexture

Is there an easy way to add this “librairy” to my project? Using VS2010

yes of course . Download the addon. Open it, you will see two folders: addons and apps. You have to put the addons/ofxTiledTexture folder in your addons OpenFrameworks folder. Then with ProjectGenerator you can start a new project or update an existing one, choose you type of Project, you can select your addons in the Gui and then start to code.

also you will need to change this at line 29 in ofxTiledTexture.cpp :

if (bUseARBExtention && GLEE_ARB_texture_rectangle){

to

if (bUseARBExtention){

due to the fact that Glee is not included anymore in the Openframeworks core lib.

Thanks one thing tho… When I try to do

#include “ofxTiledTexture.h” he can’t find it :\ I did like you said…

and if I don’t include it I get an error on :
ofxTiledTexture tex;

In the downloaded folder from github go to -> /ofxTiledTexture-master/addons/…copy the ofxTiledTexture folder and paste on the openframeworks addons folder. Open projectgenerator and click to select addons and you will see ofxTiledTexture addon in list,select and generate the new project. See ofxTiledTexture apps addons examples how addon work…

Yes I do all that but I still can’t use the ofxTiledTexture class.

I would like to add it to the project i’m working on right now.