Skip to main content
gamedev.net
🔒 Locked

Blending problem Lesson 8

Started by Alex Finlayson Dec 20, 2001 at 12:40 AM 1 replies 300+ views
Original Post
Alex Finlayson
Alex Finlayson
Hi I finally got some time away from my studies , and I have been reading the tutorials and have found them quite interesting. I''m on the Tutorial 8 and I''m having problems using the blending option , what I doing was making one of the objects opague while the rest at the regular transparency. My question to you people is how do you have the opague object not be on the forground all the time. I''m I missing something? Whats happening is the 1 opague side is not viewed through BUT when rotated to the other side it is not seen through the transparent objects it is just seen as it was originally heres the code // I took the left face out of the other glBegin to make it //opague ... glEnd(); glLoadIdentity(); glTranslatef(0.0f,0.0f,z); glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); glBindTexture(GL_TEXTURE_2D, texture[filter]); glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glBegin(GL_QUADS); glColor4f(1.0f,1.0f,0.0f,1.0f); //Left Face glNormal3f(-1.0f, 0.0f, 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glEnd(); ... Thanks All Alex Finlayson alex35@home.com
zealouselixir
zealouselixir
If you read the lovely fuschia text on that tutorial, you'll notice the answer to your problem. Imagine this: you have a light source located at <0,0,5>. You are located at <0,0,2>. There is a translucent plane located at <0, 0, 0> and an opaque plane at <0, 0, -2>. Imagine the strain it would put on the processor to bother with calculting light passing through the translucent surface and colliding with the opaque plane. Now add 3 more lights and 3 more surfaces. It's impossible. The most common solution is just what the fuschia text says: you must draw your primitives with alpha < 1.0f AFTER everything else, otherwise, they are treated (and treat other polies) like opaque objects.

Later,
ZE.

EDITED...that example is just weird, but it kinda works.

Edited by - ZealousElixir on December 20, 2001 2:06:13 AM
[twitter]warrenm[/twitter]
Eber Kain
Eber Kain
Here is some good reading material.


http://www.sjbaker.org/steve/omniv/alpha_sorting.html
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.