PDA

View Full Version : Walls, windows, and doors?



mikeleblanc
12-15-2008, 01:23 PM
Hello,

I got this code that draws a textured wall of a brick house

glBegin(GL_QUADS);
glTexCoord2f(0.0, 1.0); glVertex3f(x,y,z); // TL
glTexCoord2f(0.0, 0.0); glVertex3f(x,y,z); // BL
glTexCoord2f(1.0, 0.0); glVertex3f(x,y,z); // BR
glTexCoord2f(1.0, 1.0); glVertex3f(x,y,z); // TR
glEnd();

If I want to put a window or door in that wall defined by GL_QUADS, what woudl be the best way to do it. Another GL_QUADS,glScissor, or alpha testing?

Thanks

trinitrotoluene
12-15-2008, 02:41 PM
Maybe you can do something similar of this:



Example with a door

(x,y) = texture coord

(0,1) (1,1)
__________________
|\ 2 / |
| \(x1,y1) (x2,y2)|
| \ ______ / |
| | | |
| | | |
| 1 | d | 3 |
| | | |
| | | |
|_____|______|_____|
(0,0) (x1,0) (x2,0) (1,0)

d = door
1,2,3 => quad