PDA

View Full Version : textures + DLs



mithun_daa
12-15-2003, 08:43 PM
is it possible to map a texture on a portio of a DL. i have a huge terrain DL. now i want to map an image onto the terrain, but not the whole terrain, just a part of it. is it possible or do i have to skip using DLs in this case?
thank u.

PanzerSchreck
12-16-2003, 12:26 AM
Split up your displaylist into several glBegin...glEnd-Blocks like this :


glNewList(MyList, GL_COMPILE);
glBindTexture(TexA);
glBegin(PrimitiveType)
...
glEnd;

glBindTexture(TexB);
glBegin(PrimitiveType)
...
glEnd;
glEndList

Relic
12-16-2003, 12:39 AM
If you have a texture which should only be mapped once, you can change the outmost pixel rows and columns to have an alpha == 0 (fully transparent) and use GL_CLAMP_TO_EDGE so that texcoord outside the 0 to 1 range sample the edge pixels only.
Figure out the correct texenv mode (formula) which results in transparent texels and you can place that texture on any place on your terrain by adjusting the texcoords only. BTW, this also works for a single quad if you want to map only a part of it.

If that is done in a display list and it will never change dynamically it's better to split the geometry and texture only the one you want.

mithun_daa
12-16-2003, 06:32 AM
is it not possible to make it dynamic. i want the user to choose a texture and put it anywher he/she wants it. if i have to break up the DL into smaller parts, it would still restrict the user to a certain degree.
thank u.

PanzerSchreck
12-16-2003, 06:41 AM
Then compile the DL everytime the user changes the texture or don't use one at all and go for VAs or better VBOs instead.

Relic
12-16-2003, 07:05 AM
Right, sounds like a terrain editor. Just forget display lists for dynamic user interactions on geometry and vertex attributes. Display list are not intended for this.

mithun_daa
12-16-2003, 08:10 AM
Originally posted by Relic:
Right, sounds like a terrain editor. Just forget display lists for dynamic user interactions on geometry and vertex attributes. Display list are not intended for this.

thank u. i have never used VAs or VBOs. any good place to start from?

maximian
12-16-2003, 08:30 AM
Forget var, they are propietray Nvidia, and have been completely supplanted by vertex buffer objects.
http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt

Skim it, at the very end is an example.

Search nvidia, they have a whitepaper on vbo as well.