thnx vincoof for guadence, tried your method but the result i got was not the one i expected.
this made the whole quad transparent(see through), but i want only a specified portion to show this.
i''ve tried to understand the code and i think it must work. i dont know what is wrong with it. might be you can work out the thing?
any ways thanx for your help.
looking for more.
i still have to try the stencil method and the one discussed by Roming22.
lets hope for the best.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
need help, polygon cutting
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
It will not give the expected results, but just for the test you could try that texture initialization instead :
GLuint init_texture(void){ static GLubyte texture_data[16] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; GLuint texture_id; glGenTextures(1, &texture_id); glBindTexture(GL_TEXTURE_2D, texture_id); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 4, 4, 0, GL_ALPHA, GL_UNSIGNED_BYTE); /* new */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); /* new */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); /* new */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); return texture_id;}
ya i tried this.
there is a parameter error also in the function "glTexImage2D"
i fixed dat also.
tried some other changes as well.
but not seemed to be working accordingly.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
there is a parameter error also in the function "glTexImage2D"
i fixed dat also.
tried some other changes as well.
but not seemed to be working accordingly.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
vincoof nd Roming22, both of you whatever discussed, is working with equal speed,benefit and with the same bug.
ya the fear of z-fighting mentioned by Romming22.
and for both cases i am unable to fix it.
cutting is exactly done as i wanted. perfect results for cutting but whatever is drawn behind the cutting is not visible in both methods. every thing behind the cutting is vanished and all i see is ground, and the walls(that have cuttings).
trying hard to fix it up and i thank you in advance if you also help me fixing this.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
ya the fear of z-fighting mentioned by Romming22.
and for both cases i am unable to fix it.
cutting is exactly done as i wanted. perfect results for cutting but whatever is drawn behind the cutting is not visible in both methods. every thing behind the cutting is vanished and all i see is ground, and the walls(that have cuttings).
trying hard to fix it up and i thank you in advance if you also help me fixing this.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
thanx every body who participated in this thread and tried to help me any way.
after all my problem is solved.
thanx especially to Roming22,Riptorn and vincoof.
wish you all the best of GL.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
[edited by - pagal2k2 on January 14, 2003 6:28:32 PM]
after all my problem is solved.
thanx especially to Roming22,Riptorn and vincoof.
wish you all the best of GL.
Ahmed: having a mad soul...<<-TAG: 3-D Architecture Guide->>
[edited by - pagal2k2 on January 14, 2003 6:28:32 PM]
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
Hi there, abd I hope there''s still somebody who can help me!
I have the same problem of pagal2k2 and I try to use the function renderDepth but it doesn t work :S
In my example, I want to render 2quads :
one foreground (green) -> lower_left : -1,-1,0 and upper_right : 1,1,0
one background (blue) -> lower_left : -2,-2,-2 and upper_right : 2,2,-2
the cutting region -> lower_left : -0.5,-0.5,-0 and upper_right : 0.5,0.5,0
Here s my code :
GLuint init_texture(void)
{
static GLubyte texture_data[16] =
{
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
GLuint texture_id;
glGenTextures(1, &texture_id);
glBindTexture(GL_TEXTURE_2D, texture_id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 4, 4, 1, GL_ALPHA, GL_UNSIGNED_BYTE,&texture_data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
return texture_id;
}
void solve_linear(GLdouble wall_min,
GLdouble wall_max,
GLdouble door_min,
GLdouble door_max,
GLdouble *texcoord_min,
GLdouble *texcoord_max)
{
GLdouble a = 1.f / (door_max - door_min);
GLdouble b = -a * door_min;
*texcoord_min = a * wall_min + b;
*texcoord_max = a * wall_max + b;
}
void compute_texcoord(GLdouble lower_left_wall[3],
GLdouble upper_right_wall[3],
GLdouble lower_left_door[3],
GLdouble upper_right_door[3],
GLdouble lower_left_texcoord[2],
GLdouble upper_right_texcoord[2])
{
solve_linear(lower_left_wall[2],
upper_right_wall[2],
lower_left_door[2],
upper_right_door[2],
&lower_left_texcoord[1],
&upper_right_texcoord[1]);
if (fabs(upper_right_wall[0]-lower_left_wall[0]) > fabs(upper_right_wall[1]-lower_left_wall[1]))
solve_linear(lower_left_wall[0],
upper_right_wall[0],
lower_left_door[0],
upper_right_door[0],
&lower_left_texcoord[0],
&upper_right_texcoord[0]);
else
solve_linear(lower_left_wall[1],
upper_right_wall[1],
lower_left_door[1],
upper_right_door[1],
&lower_left_texcoord[0],
&upper_right_texcoord[0]);
}
void render_depth(GLuint texture_id,
GLdouble lower_left_wall[3],
GLdouble upper_right_wall[3],
GLdouble lower_left_door[3],
GLdouble upper_right_door[3])
{
GLdouble lower_left_texcoord[2];
GLdouble upper_right_texcoord[2];
glBindTexture(GL_TEXTURE_2D, texture_id);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_NOTEQUAL, 0);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glColor3d(1.f, 1.f, 1.f);
compute_texcoord(lower_left_wall,
upper_right_wall,
lower_left_door,
upper_right_door,
lower_left_texcoord,
upper_right_texcoord);
glBegin(GL_QUADS);
glTexCoord2dv(lower_left_texcoord);
glVertex3dv(lower_left_wall);
glTexCoord2d(upper_right_texcoord[0], lower_left_texcoord[1]);
glVertex3d(upper_right_wall[0], upper_right_wall[1], lower_left_wall[2]);
glTexCoord2dv(upper_right_texcoord);
glVertex3dv(upper_right_wall);
glTexCoord2d(lower_left_texcoord[0], upper_right_texcoord[1]);
glVertex3d(lower_left_wall[0], lower_left_wall[1], upper_right_wall[2]);
glEnd();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDisable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D);
}
void InitGL()
{
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glShadeModel(GL_SMOOTH);
glClearColor(1.0,1.0,1.0, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
void Reshape(int width, int height)
{
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,(float)width/(float)height,1,10000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void Draw(void)
{
double lower_left_wall [] = {-1.0,-1.0,0.0};
double upper_right_wall [] = {1.0,1.0,0.0};
double lower_left_door [] = {-0.5,-0.5,0.0};
double upper_right_door [] = {0.5,0.5,0.0};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0,0.0,-10.0);
glRotated(rotateY,0.0,1.0,0.0);
static GLuint alpha_id = init_texture();
render_depth(alpha_id, lower_left_wall, upper_right_wall, lower_left_door, upper_right_door);
glDepthFunc(GL_EQUAL);
glBegin(GL_QUADS);
glColor3f (0.0,1.0,0.0);
glVertex3f (-1.0,-1.0,0.0);
glVertex3f (1.0,-1.0,0.0);
glVertex3f (1.0,1.0,0.0);
glVertex3f (-1.0,1.0,0.0);
glEnd();
glDepthFunc(GL_LESS);
glBegin(GL_QUADS);
glColor3f (0.0,0.0,1.0);
glVertex3f (-2.0,-2.0,-2.0);
glVertex3f (2.0,-2.0,-2.0);
glVertex3f (2.0,2.0,-2.0);
glVertex3f (-2.0,2.0,-2.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
But only the back quads is rendered...
plz help
thx
khem
I have the same problem of pagal2k2 and I try to use the function renderDepth but it doesn t work :S
In my example, I want to render 2quads :
one foreground (green) -> lower_left : -1,-1,0 and upper_right : 1,1,0
one background (blue) -> lower_left : -2,-2,-2 and upper_right : 2,2,-2
the cutting region -> lower_left : -0.5,-0.5,-0 and upper_right : 0.5,0.5,0
Here s my code :
GLuint init_texture(void)
{
static GLubyte texture_data[16] =
{
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
GLuint texture_id;
glGenTextures(1, &texture_id);
glBindTexture(GL_TEXTURE_2D, texture_id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 4, 4, 1, GL_ALPHA, GL_UNSIGNED_BYTE,&texture_data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
return texture_id;
}
void solve_linear(GLdouble wall_min,
GLdouble wall_max,
GLdouble door_min,
GLdouble door_max,
GLdouble *texcoord_min,
GLdouble *texcoord_max)
{
GLdouble a = 1.f / (door_max - door_min);
GLdouble b = -a * door_min;
*texcoord_min = a * wall_min + b;
*texcoord_max = a * wall_max + b;
}
void compute_texcoord(GLdouble lower_left_wall[3],
GLdouble upper_right_wall[3],
GLdouble lower_left_door[3],
GLdouble upper_right_door[3],
GLdouble lower_left_texcoord[2],
GLdouble upper_right_texcoord[2])
{
solve_linear(lower_left_wall[2],
upper_right_wall[2],
lower_left_door[2],
upper_right_door[2],
&lower_left_texcoord[1],
&upper_right_texcoord[1]);
if (fabs(upper_right_wall[0]-lower_left_wall[0]) > fabs(upper_right_wall[1]-lower_left_wall[1]))
solve_linear(lower_left_wall[0],
upper_right_wall[0],
lower_left_door[0],
upper_right_door[0],
&lower_left_texcoord[0],
&upper_right_texcoord[0]);
else
solve_linear(lower_left_wall[1],
upper_right_wall[1],
lower_left_door[1],
upper_right_door[1],
&lower_left_texcoord[0],
&upper_right_texcoord[0]);
}
void render_depth(GLuint texture_id,
GLdouble lower_left_wall[3],
GLdouble upper_right_wall[3],
GLdouble lower_left_door[3],
GLdouble upper_right_door[3])
{
GLdouble lower_left_texcoord[2];
GLdouble upper_right_texcoord[2];
glBindTexture(GL_TEXTURE_2D, texture_id);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_NOTEQUAL, 0);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glColor3d(1.f, 1.f, 1.f);
compute_texcoord(lower_left_wall,
upper_right_wall,
lower_left_door,
upper_right_door,
lower_left_texcoord,
upper_right_texcoord);
glBegin(GL_QUADS);
glTexCoord2dv(lower_left_texcoord);
glVertex3dv(lower_left_wall);
glTexCoord2d(upper_right_texcoord[0], lower_left_texcoord[1]);
glVertex3d(upper_right_wall[0], upper_right_wall[1], lower_left_wall[2]);
glTexCoord2dv(upper_right_texcoord);
glVertex3dv(upper_right_wall);
glTexCoord2d(lower_left_texcoord[0], upper_right_texcoord[1]);
glVertex3d(lower_left_wall[0], lower_left_wall[1], upper_right_wall[2]);
glEnd();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDisable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D);
}
void InitGL()
{
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glShadeModel(GL_SMOOTH);
glClearColor(1.0,1.0,1.0, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
void Reshape(int width, int height)
{
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,(float)width/(float)height,1,10000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void Draw(void)
{
double lower_left_wall [] = {-1.0,-1.0,0.0};
double upper_right_wall [] = {1.0,1.0,0.0};
double lower_left_door [] = {-0.5,-0.5,0.0};
double upper_right_door [] = {0.5,0.5,0.0};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0,0.0,-10.0);
glRotated(rotateY,0.0,1.0,0.0);
static GLuint alpha_id = init_texture();
render_depth(alpha_id, lower_left_wall, upper_right_wall, lower_left_door, upper_right_door);
glDepthFunc(GL_EQUAL);
glBegin(GL_QUADS);
glColor3f (0.0,1.0,0.0);
glVertex3f (-1.0,-1.0,0.0);
glVertex3f (1.0,-1.0,0.0);
glVertex3f (1.0,1.0,0.0);
glVertex3f (-1.0,1.0,0.0);
glEnd();
glDepthFunc(GL_LESS);
glBegin(GL_QUADS);
glColor3f (0.0,0.0,1.0);
glVertex3f (-2.0,-2.0,-2.0);
glVertex3f (2.0,-2.0,-2.0);
glVertex3f (2.0,2.0,-2.0);
glVertex3f (-2.0,2.0,-2.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
But only the back quads is rendered...
plz help

thx
khem
We are a Football Tribe!
killerkhem, read last 2 replies of vincoof. this is the same method that i used. one and only one difference that i made was my rendering sequence. it was as follows.
1. draw woteva u want to be visible through your cutting but donot draw the polygon which is going to have the cutting in it.
2. draw the alpha textured polygon using the technique described by vincoof but make it slightly befor(near on z-axis) the polygon which has the cutting, but still dont draw that polygon which has the cutting.
3. now draw the original polygon on its original z-axis.
wot happens is, u draw every thing that u want to view from cutting. then u draw ur cutting(alpha tex), then u draw the area which has the cutting in it. this area, being blend with the cutting region(because it is drawn befor the polygon), reveals a cutting inside it as u want.
but in the end, i didnt find this a better way(just my experience). so for my project, i used to decompose the polygon using maths. i divide a polygon in sub polygons in such a wey that the cutting region is removed from them.
well, both works.
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
1. draw woteva u want to be visible through your cutting but donot draw the polygon which is going to have the cutting in it.
2. draw the alpha textured polygon using the technique described by vincoof but make it slightly befor(near on z-axis) the polygon which has the cutting, but still dont draw that polygon which has the cutting.
3. now draw the original polygon on its original z-axis.
wot happens is, u draw every thing that u want to view from cutting. then u draw ur cutting(alpha tex), then u draw the area which has the cutting in it. this area, being blend with the cutting region(because it is drawn befor the polygon), reveals a cutting inside it as u want.
but in the end, i didnt find this a better way(just my experience). so for my project, i used to decompose the polygon using maths. i divide a polygon in sub polygons in such a wey that the cutting region is removed from them.
well, both works.
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
Hi pagal2k2 and thanks for your answer! 
I try to use your method but it still don''t work. Here s the code of my method "Draw" with the modifications I made :
void Draw(void)
{
//here I defined the arrays to build the alpha textured polygon
//with the vincoof technique
//z is fixed at 0.1, the polygon which has cutting has z fixed at 0
double lower_left_wall [] = {-1.0,-1.0,0.1};
double upper_right_wall [] = {1.0,1.0,0.1};
double lower_left_door [] = {-0.5,-0.5,0.1};
double upper_right_door [] = {0.5,0.5,0.1};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0,0.0,-10.0);
glRotated(rotateY,0.0,1.0,0.0);
//here I draw the quad which is visible to the cut
glBegin(GL_QUADS);
glColor3f (0.0,0.0,1.0);
glVertex3f (-2.0,-2.0,-2.0);
glVertex3f (2.0,-2.0,-2.0);
glVertex3f (2.0,2.0,-2.0);
glVertex3f (-2.0,2.0,-2.0);
glEnd();
//here I draw the alpha textured polygon
static GLuint alpha_id = init_texture();
render_depth(alpha_id, lower_left_wall, upper_right_wall, lower_left_door, upper_right_door);
glDepthFunc(GL_EQUAL);
//here I draw the polygon which has the cutting
glBegin(GL_QUADS);
glColor3f (0.0,1.0,0.0);
glVertex3f (-1.0,-1.0,0.0);
glVertex3f (1.0,-1.0,0.0);
glVertex3f (1.0,1.0,0.0);
glVertex3f (-1.0,1.0,0.0);
glEnd();
glDepthFunc(GL_LESS);
glPopMatrix();
glutSwapBuffers();
}
The polygon which has cutting is not rendered, I see only the blue quad. If I remove the line "glDepthFunc(GL_EQUAL)" I see the green quads but it isn t cutting
I hope u can tell me where the problem is. If my exemple is very bad, can u give me a simple source code that could illustrated your technique plz?
thx in advance
Khem

I try to use your method but it still don''t work. Here s the code of my method "Draw" with the modifications I made :
void Draw(void)
{
//here I defined the arrays to build the alpha textured polygon
//with the vincoof technique
//z is fixed at 0.1, the polygon which has cutting has z fixed at 0
double lower_left_wall [] = {-1.0,-1.0,0.1};
double upper_right_wall [] = {1.0,1.0,0.1};
double lower_left_door [] = {-0.5,-0.5,0.1};
double upper_right_door [] = {0.5,0.5,0.1};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0,0.0,-10.0);
glRotated(rotateY,0.0,1.0,0.0);
//here I draw the quad which is visible to the cut
glBegin(GL_QUADS);
glColor3f (0.0,0.0,1.0);
glVertex3f (-2.0,-2.0,-2.0);
glVertex3f (2.0,-2.0,-2.0);
glVertex3f (2.0,2.0,-2.0);
glVertex3f (-2.0,2.0,-2.0);
glEnd();
//here I draw the alpha textured polygon
static GLuint alpha_id = init_texture();
render_depth(alpha_id, lower_left_wall, upper_right_wall, lower_left_door, upper_right_door);
glDepthFunc(GL_EQUAL);
//here I draw the polygon which has the cutting
glBegin(GL_QUADS);
glColor3f (0.0,1.0,0.0);
glVertex3f (-1.0,-1.0,0.0);
glVertex3f (1.0,-1.0,0.0);
glVertex3f (1.0,1.0,0.0);
glVertex3f (-1.0,1.0,0.0);
glEnd();
glDepthFunc(GL_LESS);
glPopMatrix();
glutSwapBuffers();
}
The polygon which has cutting is not rendered, I see only the blue quad. If I remove the line "glDepthFunc(GL_EQUAL)" I see the green quads but it isn t cutting

I hope u can tell me where the problem is. If my exemple is very bad, can u give me a simple source code that could illustrated your technique plz?
thx in advance

Khem
We are a Football Tribe!
try a very little alteration.
which is.
make the
lower_left_wall = lower_left_door
and
upper_right_wall = upper_right_door.
I guess ur problem will be solved.
if you are too curious to know the reason for this alteration, simply study the mathematical logic defined in code carefully. u''ll find nothing more than a bug.
and if even now, ur problem is un-solved. contact Vincoof or RipTorn or any expert. i m nothing when we talk about them.
otherwise i''d never be mentioning their names on the splash screen of my project... .
any wayz, too much extra discussion. get back to ur problem.
wish ya best of luck.
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
which is.
make the
lower_left_wall = lower_left_door
and
upper_right_wall = upper_right_door.
I guess ur problem will be solved.
if you are too curious to know the reason for this alteration, simply study the mathematical logic defined in code carefully. u''ll find nothing more than a bug.
and if even now, ur problem is un-solved. contact Vincoof or RipTorn or any expert. i m nothing when we talk about them.
otherwise i''d never be mentioning their names on the splash screen of my project... .
any wayz, too much extra discussion. get back to ur problem.
wish ya best of luck.
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
Ahmed: having a mad soul...
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
<<-TAG: 3-D Architecture Guide (Sourceforge)->>
Hi pagal2k2,
I tried to do your technik but it doesn t work too
Here s my code :
//here I made lower_left_wall = lower_left_door
//and upper_right_wall = upper_right_door.
double lower_left_wall [] = {-0.5,-0.5,0.02};
double upper_right_wall [] = {0.5,0.5,0.02};
double lower_left_door [] = {-0.5,-0.5,0.02};
double upper_right_door [] = {0.5,0.5,0.02};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0,0.0,-10.0);
glRotated(rotateY,0.0,1.0,0.0);
//here I draw the quad which is visible to the cut
glBegin(GL_QUADS);
glColor4f (0.0,0.0,1.0,1.0);
glVertex3f (-2.0,-2.0,-2.0);
glVertex3f (2.0,-2.0,-2.0);
glVertex3f (2.0,2.0,-2.0);
glVertex3f (-2.0,2.0,-2.0);
glEnd();
//here I draw the alpha textured polygon
static GLuint alpha_id = init_texture();
render_depth(alpha_id, lower_left_wall, upper_right_wall, lower_left_door, upper_right_door);
//here I draw the polygon which has the cutting
glDepthFunc(GL_EQUAL);
glBegin(GL_QUADS);
glColor4f (0.0,1.0,0.0,0.5);
glVertex3f (-1.0,-1.0,0.0);
glVertex3f (1.0,-1.0,0.0);
glVertex3f (1.0,1.0,0.0);
glVertex3f (-1.0,1.0,0.0);
glEnd();
glDepthFunc(GL_LESS);
glPopMatrix();
glutSwapBuffers();
I always only see the quads blue but not the polygon which has the cutting...
Can u post some code? I m so despaired!
Anyway, thx for your help! :D
bye
khem
I tried to do your technik but it doesn t work too

Here s my code :
//here I made lower_left_wall = lower_left_door
//and upper_right_wall = upper_right_door.
double lower_left_wall [] = {-0.5,-0.5,0.02};
double upper_right_wall [] = {0.5,0.5,0.02};
double lower_left_door [] = {-0.5,-0.5,0.02};
double upper_right_door [] = {0.5,0.5,0.02};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0,0.0,-10.0);
glRotated(rotateY,0.0,1.0,0.0);
//here I draw the quad which is visible to the cut
glBegin(GL_QUADS);
glColor4f (0.0,0.0,1.0,1.0);
glVertex3f (-2.0,-2.0,-2.0);
glVertex3f (2.0,-2.0,-2.0);
glVertex3f (2.0,2.0,-2.0);
glVertex3f (-2.0,2.0,-2.0);
glEnd();
//here I draw the alpha textured polygon
static GLuint alpha_id = init_texture();
render_depth(alpha_id, lower_left_wall, upper_right_wall, lower_left_door, upper_right_door);
//here I draw the polygon which has the cutting
glDepthFunc(GL_EQUAL);
glBegin(GL_QUADS);
glColor4f (0.0,1.0,0.0,0.5);
glVertex3f (-1.0,-1.0,0.0);
glVertex3f (1.0,-1.0,0.0);
glVertex3f (1.0,1.0,0.0);
glVertex3f (-1.0,1.0,0.0);
glEnd();
glDepthFunc(GL_LESS);
glPopMatrix();
glutSwapBuffers();
I always only see the quads blue but not the polygon which has the cutting...
Can u post some code? I m so despaired!

Anyway, thx for your help! :D
bye
khem
We are a Football Tribe!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement