I problem with blending HELP ME PLEASE!

Help me!

// 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);

did you glEnable(BL_BLEND); ?

Thank you very much for your answer.

If you have problem I will exchange idea to you.

glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 01);
and
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, @Amb_GirlMat);

Do you think about this?

I use in FormCreate…

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();

I’m not entirely sure what is being asked here, but make sure you call glDepthMask(0) when you draw transparent things and glDepthMask(1) afterward

Hi ‘Chowe6685’ How are you today?

I use glDepthMask(0); in InitOGL

What problem about glDepthMask(0);?
Please answer to me dude…

Who have idea about this please help me.

Thanks

Dol :slight_smile:

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

DrawWorld();
DrawRoom();
DrawGirl();
glEnable(GL_BLEND);
glDepthMask(GL_FALSE);
DrawTransparentPartsofRoom();
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);

Thank a lot dude…

:slight_smile: I will try this

Dol…

Oh Yeah! If I draw transparent room in the final object and use glDepthMask(01); it completely show all object.

Thank a lot ‘Chowe6685’
Dol

Hi all. This code.

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_COLOR); is render greater than glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Dol :slight_smile: