Jung Lee wrote:
> Dear OpenSG Users,
>
> First of all, I appreciate always for your great answers. I have two
> questions related to texture-mapped polygons:
>
> Q1. What is the maximum number of texture references in OpenSG? I am
> trying to load more than 100 images and map those texture onto simple
> plane polygons(made by makePlane()). Do you think that is possible?
> if not, is there any way to show 100 images at one single scene?
That should be possible. OpenGL certainly allows a 100 textures (if
there is enough memory on the system), so OpenSG should not hinder you.
I don't think there is a specific max number. It's implementation defined.
If you find that you have a lot of small textures (a common problem),
try combining them to a big one and use texture coordinates to select
the correct part. (But do be aware of mip-mapping issues.)
> Q2. When I make a simple texture mapped plane polygon, I can use the
> following code to construct a texture mapped plane. Then, should I
> repeat this same code with different pointer names in one hudred
> times? My code is going to be over several thousand lines. I feel
> there is another way. at least I would like to use "for" loops to
> construct each textured plane.
Why can't you store the pointers in an array/vector of structs?
I.e. something like this
struct MyPlane {
MyPlane(string datadir, int num) {
/* your load and create code */
}
OSG::ImagePtr m_img:
OSG::NodePtr m_root;
OSG::TransformPtr m_transform;
...
};
void myfunc() {
typedef std::vector<MyPlane> MyPlanes;
const int numImgs = 100;
MyPlanes myplanes;
myplanes.reserve(numImgs);
NodePtr root = ...;
CPEditAll(root);
for (int i = 0; i < 100; ++i) {
myplanes.push_back(datadir, 1);
root->addChild(myplanes.back().m_root);
}
}
Cheers,
/Marcus
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users