// WORLD MESH
glNewList(WORLD_GLOBE, GL_COMPILE);
WorldObj := gluNewQuadric();
for i := 0 to WORLD_MESH-1 do
begin
glBegin(GL_TRIANGLES);
… // World mesh is here
glEnd();
end;
glEndList();
// ROOM MESH
glNewList(ROOM_GLOBE, GL_COMPILE);
RoomObj := gluNewQuadric();
glEnable(GL_BLEND); // ***TRANSPARENT THE ROOM
for i := 0 to ROOM_MESH-1 do
begin
glBegin(GL_TRIANGLES);
… // Room mesh is here
glEnd();
end;
glDisable(GL_BLEND);
glEndList();
// GIRL MODEL INCLUDE BONE SYSTEM…
glNewList(GIRL_GLOBE, GL_COMPILE);
GirlObj := gluNewQuadric();
for i := 0 to GIRL_MESH-1 do
begin
glBegin(GL_TRIANGLES);
… // GIRL MODEL IS HERE…
glEnd();
end;
glEndList();
The world model is show completed but the girl model is run into the glass room the girl model not show. WHY? WHAT HAPPEN? HELP ME…
I’m not sure I understand but try to draw the transparent object last in the scene. Also be sure to set the blend function. A usual setting for transparency is
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Yes I call glEnable(GL_BLEND); for display list the room :-
// ROOM MESH
glNewList(ROOM_GLOBE, GL_COMPILE);
RoomObj := gluNewQuadric();
glEnable(GL_BLEND); // ***TRANSPARENT THE ROOM
for i := 0 to ROOM_MESH-1 do
begin
glBegin(GL_TRIANGLES);
… // Room mesh is here
glEnd();
end;
glDisable(GL_BLEND);
glEndList();
Ok, because blending is useful for much more than just transparacy, when you draw things you want to be transparent opengl still puts them into the depth buffer. This means that if you are using depth testing, things behind your transparent window will not be drawn. The easiest way to get around this is to disable depth writes by calling glDepthMask(GL_FALSE). Anything that is not transparent should be writing to the depth buffer, call glDepthMask(GL_TRUE).
So your code looks something like