|
大侠好
Geomertry* g = new Geometry();
vec3array* vert = new vec3array();
vert->push_back(vec3(0,0,0);
vert->push_back(vec3(0,1,0);
vert->push_back(vec3(1,1,0);
vert->push_back(vec3(1,0,0);
g->setVertexArray(vert);
DrawElementUShort * drawElement1 = new DrawElementUShort (PrimitiveSet::TRIANGLES);
drawElement1->push_back(0);
drawElement1->push_back(1);
drawElement1->push_back(2);
g->addPrimitiveSet(drawElement1);
DrawElementUShort * drawElement2 = new DrawElementUShort (PrimitiveSet::TRIANGLES);
drawElement2->push_back(0);
drawElement2->push_back(2);
drawElement2->push_back(3);
g->addPrimitiveSet(drawElement2);
我用DrawElements来分别画左右两边的两个三角形,现在我想让两个DrawElement里面的每个顶点分别绑定到不同的纹理坐标上去(因为他们对应两张不同的png图片),也就是
vec2array* tex1 = new vec2array();
tex1->push_back(vec2(0,0));
tex1->push_back(vec2(0,1));
tex1->push_back(vec2(1,1));
vec2array* tex2 = new vec2array();
tex2->push_back(vec2(0,0));
tex2->push_back(vec2(0.5,1));
tex2->push_back(vec2(0.5,0.5));
将tex1,绑定到drawElement1上,tex2绑定到drawElement2上。由于两个面共点,而一个点的纹理坐标又不相同,请问在osg里面有办法弄吗?
|
|