PDA

View Full Version : Weird ghosting effect in textures with some transparency.



dodgyposse
02-26-2002, 12:08 AM
Hi,
I am writing a game, which has some nice
bitmaps of a dashboard over which I display readouts,text etc

Some of the panels have transparent regions,
denoted by rgb (0,0,0), through which I expect to see my main scene.

I have created a 2 colour mask of the dashboard, and this is drawn first ( depth sorting is switched off ),using

glBlendFunc(GL_DST_COLOR,GL_ZERO);

I then draw the color version of the dashboard, using:

glBlendFunc(GL_ONE, GL_ONE);

My problem is that, I can see the edges of my textures, even though I am using colour zero along that edge.
http://www.dodgyposse.com/neil/ghost.jpg

Illustrates what is going on.

Both textures are drawn with exactly the same
coordinates, and depth sorting is switched off when they are drawn.

dd

richardve
02-26-2002, 12:43 AM
Try setting the texture wrap parameters to GL_CLAMP_TO_EDGE_EXT

dodgyposse
02-26-2002, 12:49 AM
Do you mean:

glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE_E XT);

glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE_E XT);

If so, I tried to compile and it didn't recognise GL_CLAMP_TO_EDGE_EXT

I'll investigate further.

dd

richardve
02-26-2002, 01:00 AM
I think you'll need the extension header since it's an extension http://www.opengl.org/discussion_boards/ubb/wink.gif
http://www.nvidia.com/dev_content/nvopenglspecs/GL_EXT_texture_edge_clamp.txt

zeckensack
02-26-2002, 06:42 AM
On a sidenote:
You can also simply use an rgba texture for the overlay where alpha=1 for the visible areas, alpha=0 for the transparent areas and render in a single pass with
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

dodgyposse
02-27-2002, 12:41 AM
Ok,
I have tried a few things out and the code is still drawing these ghost lines.

I don't know about using CLAMP_TO_EDGE_EXT
as that is an opengl 1.2 extension, and my compiler does't seem to know about it. ( VC++ 5.0)

Where would I go, to get this extension?

I remember reading something about texture borders.....could that be it?

dd

richardve
02-27-2002, 01:25 AM
Like I said, your compiler doesn't recognize this constant because you're not including the OGL extensions header (!)

And yes, this extension prevents sampling from the texture border.

Read:
http://www.opengl.org/developers/faqs/technical/extensions.htm#exte0090


[This message has been edited by richardve (edited 02-27-2002).]

richardve
02-27-2002, 01:28 AM
Oh, and in that extra header, it's called GL_CLAMP_TO_EDGE (without the _EXT)

dodgyposse
02-27-2002, 01:46 AM
Apologies....I misunderstood...I thought
that because my card didn't have it, it meant that it couldn't support it at all...

I'll download those headers and give it a go.

Thanks for your patience!

dd

dodgyposse
02-27-2002, 01:49 AM
bugger! Those links to the headers are not responding...

Anyone out there know where I can get

glext.h
wglext.h
glxext.h

other than the oss.sgi website?

dd

Shag
02-27-2002, 02:09 AM
coming via email ...

BTW - how's maverick coming on? I've been watching it's progress for ages now http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by Shag (edited 02-27-2002).]

dodgyposse
02-27-2002, 02:34 AM
Maverick is coming along well..

We are beta testing it and trying to remove the obvious bugs.

This release will be smaller than the last one(!), and will have higher quality textures, as I have ditched bmp's and am reading them as jpegs from a zip file.

The AI is improved, the mission engine is improved, the skyboxes are better, the planets look better, there are more ships,
the user interface is now skinnable, there is an mp3 music manager, and basically the whole thing is just better http://www.opengl.org/discussion_boards/ubb/wink.gif

Me..??? I'm knackered!

The fact that the download is smaller, may mean we get more interest....

At last reckoning, it will be a 7-8 meg download, and I am aiming to have the new version up there by march 2002.

The website is www.dodgyposse.com (http://www.dodgyposse.com) and there are some screenshots up there for those of you who haven't seen it before.

del

dodgyposse
02-27-2002, 03:45 AM
Thanks for the headers!