PDA

View Full Version : I problem with blending HELP ME PLEASE!



Dol AI with 3D Bone system
10-13-2004, 04:19 AM
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...

dvm
10-13-2004, 05:37 AM
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);

KraftDinner
10-13-2004, 07:42 AM
did you glEnable(BL_BLEND); ?

Dol AI with 3D Bone system
10-13-2004, 07:44 AM
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...

Dol AI with 3D Bone system
10-13-2004, 07:47 AM
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();

chowe6685
10-13-2004, 11:57 AM
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

Dol AI with 3D Bone system
10-13-2004, 07:24 PM
Hi 'Chowe6685' How are you today?

I use glDepthMask(0); in InitOGL

Dol AI with 3D Bone system
10-13-2004, 07:34 PM
What problem about glDepthMask(0);?
Please answer to me dude...

Dol AI with 3D Bone system
10-13-2004, 10:34 PM
Who have idea about this please help me.

Thanks

Dol :)

chowe6685
10-14-2004, 04:09 AM
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);

Dol AI with 3D Bone system
10-14-2004, 04:27 AM
Thank a lot dude...

:) I will try this

Dol...

Dol AI with 3D Bone system
10-14-2004, 04:34 AM
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

Dol AI with 3D Bone system
10-14-2004, 06:40 AM
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 :)