PDA

View Full Version : Generate mesh object



Manel Goucha
12-28-2010, 02:59 PM
Hi,

I'm trying to generate a plane using 100 x 100 planes, and tesselate then on a big plane so that I can change its own texture, but I must generate the same mesh everytime I want to send it to glVertex, so sending 100 x 100 vertices everytime is very slow, is there nay other way to generate the texture only once and the send it everytime?

this is what I'm using:



DrawMultiRect2D(X, Y, Width, Height: Double);
var
X2,
Y2: Double;
x2, y2: Integer;
begin
X1 = Width / 2;
Y1 = Height / 2;

glEnable(GL_TEXTURE_2D);

for y2 = -50 to 50 do
for x2 = -50 to 50 do
begin
glBindTexture(GL_TEXTURE_2D, 1);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f((x2)*X1, (y2)*Y1);
glTexCoord2f(1, 0); glVertex2f((x2)*X1 + X1, (y2)*Y1);
glTexCoord2f(1, 1); glVertex2f((x2)*X1 + X1, (y2)*Y1 + Y1);
glTexCoord2f(0, 1); glVertex2f((x2)*X1, (y2)*Y1 + Y1);
glEnd();
end;

glDisable(GL_TEXTURE_2D);
end;

is there any other way?

carsten neumann
12-28-2010, 03:12 PM
Please don't post the same question in multiple forums. I've answered in your other thread (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=288439#Post2884 39).