PDA

View Full Version : a question about "the official guide to opengl ver1.2" on texture3d



wusheng
10-12-2004, 05:20 PM
There is an example on texture3d named "texture3d.c" (example 9-4) in that "Red Book".That example describes how to use the 3d texture.However, when I changed the array of texture to the format of RGBA,instead of the RGB in the example, and at the same time, set the alpha to zero, the image still displayed on the framebuffer.Why? I am puzzled...

CrazyButcher
10-12-2004, 10:49 PM
did you enable blending ? like

glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)

that will make your alpha values transparent

however if you just want to have full opaque/ full transparent, use

glEnable(GL_ALPHATEST)
glAlphaFunc(GL_GREATER, 0)

then only fragments with alpha greater zero will pass, and this is faster than blending. Also wont require a depth sort as blend would

Dol AI with 3D Bone system
10-12-2004, 11:20 PM
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...