PDA

View Full Version : Transparent Textures



Azazel
01-07-2004, 06:03 AM
I have to switch off acceleration when I wanto use transparent texture if graphic card on the computer is lower than GeForce4. What the...

ZbuffeR
01-07-2004, 06:17 AM
No problem for me (GF3). Can you be more specific about your problem please ?

Obli
01-07-2004, 10:50 AM
Originally posted by Azazel:
[B]I have to switch off acceleration[B]
I don't even understand where the problem is but this should make it even slower. What a strange thing!

Azazel
01-12-2004, 02:16 AM
Well, more specific... When i learned OGL, i used computer without accelerator. I created RGBA textures with partial transparency on different areas. When I launched my apps on computers with accelerators textures appeared solid! If accelerator was older than GeForce4 only way to get pretty transparent textures was to switch off acceleration...

ZbuffeR
01-12-2004, 03:53 AM
Such a difference between software and hardware rendering is strange. Transparent additive/substractive texture have been succesfully used in any hardware I can think of, even the very first 3DFX.

Might be a side effect of not programming it 'correctly'. How do you display your textures ?

Azazel
01-13-2004, 03:29 AM
Oh yes, I am a lamer. I use Delphi. It is much easer. For example I dont have to fill out all PixelFormatDescriptor fields. All I have to setup is dwFlags. Do you think it is a problem? WITHOUT ACCELERATOR IT WORKS FINE!!!
How I use transparent texture:
1) Turn on blending:
2) Array that contains tex image has 4 bytes per textel instead of 3. Fourth byte is for alpha and contains different values.
3) In glTexImage2D direcive I use GL_RGBA const instead of GL_RGB
...finaly) I setup RGBA colorfilter glColor4f(1,1,1,1);

Any old accelerator does not seems to have transparent texture ability...

Azazel
01-13-2004, 03:32 AM
Argh!... I can get transparent texture by changing colorfilter glColor4f, but I cant get textels to be differently transparent!!! Alpha channel... Common way to get holes and round edges... How then sprites can be made???

[This message has been edited by Azazel (edited 01-13-2004).]

ZbuffeR
01-13-2004, 08:14 AM
Oh yes, I am a lamer. I use Delphi.
Wait ! Nobody said that ! I do use a toolkit to avoid messing with PFD and the like http://www.opengl.org/discussion_boards/ubb/smile.gif




1) Turn on blending:
2) Array that contains tex image has 4 bytes per textel instead of 3. Fourth byte is for alpha and contains different values.
3) In glTexImage2D direcive I use GL_RGBA const instead of GL_RGB
...finaly) I setup RGBA colorfilter glColor4f(1,1,1,1);

Maybe you forgot to specify blending function ? That would explain why it is different accross implementations.
Try :
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA),
It should do the trick.

Azazel
01-14-2004, 01:29 AM
Oh god, no! I set up blending function! I did everything! I still think the problem is in those ****ty accelerators. Most of them arent naturally OpenGL compliant, especially S3. Also I saw this problem on the RivaTNT2. If certain games shows textures partially transparent them either use ****ing DirectX or some OpenGL extentisions. Also, I heard, programming OGL from C++ MAKES coder to use them anyway. Under Delphi I use none! That is the problem!

PanzerSchreck
01-14-2004, 01:50 AM
I've been OpenGL coding Delphi since some years and have been through different HW-Configs that included a KyroII (*ugs*), a GeForce2, a GeForce4 and now a Radeon9700 and I never stumbeld across a single problem with transparency, so I can't really tell you what you're doing wrong.
Are you using up-to-date OpenGL-Headers?

Azazel
01-14-2004, 02:37 AM
I think Delphi OpenGL headers has not changed since 1993. But even if there were changes, I dont think that there were better results. Files opengl32.dll and glu32.dll have not been modified since 1995 when according Windows version came.

PanzerSchreck
01-14-2004, 02:51 AM
No, there are no new headers from Borland. But Borland's header's (those with delphi) have always contained some faults and were missing functions. So grab a newer one, for example the OpenGL 1.5-Header were I was involved : http://www.delphigl.com/do_download.php?f=12000

Azazel
01-15-2004, 12:14 AM
Thanks. Ill try it. But as I heard Microsoft OpenGL is providing just version 1.1 compatiblity. All newer versions' exts are available only via accelerator drivers. And also 'semiaccelerators' like S3 Savage support efects including transparency not in general way. Why then in games you have to select accelerator you have? DirectX have driver for each card - OpenGL hasnt. Those ICD are never normal. I wanna know how to programm all this in lower level.

nexusone
01-15-2004, 06:35 AM
I know at one time video cards used to have hardware sprites, which is one way sprites got around the screen. For example your curser is a sprite, note that when the screen get's scrambled sometimes, your curser stays visible.

The other option for sprites is to just do your own transpartency routines.

In old style 2D you would draw in layers, first would be ground level images. Then place masking images to create holes in which to place your sprite, then draw the sprite in the transpartent spot.

Another example would be wolfenstien 3D in which you assign a color to be transparent, and then when the sprite was drawn the routine would not draw any part of the sprite that had a transparent color. This way only the non-transparent parts of the sprite are drawn over the background image.

Azazel
01-16-2004, 12:23 AM
Hey, I have solved the problem! Now I have sprites on every accelerator! That was because I use display lists. It has to be GL_COMPILE_AND_EXECUTE when creating list, not just GL_COMPILE! Allthrough this is strange too... Whats the use of setting texture, if in frame rendering this is done also...
OK, can everyone say if there is some algorythm to face sprites to the camera? I use gluLookAt command. Do I realy must take dX, dY, dZ between sprite and camera and calculate sins?

[This message has been edited by Azazel (edited 01-16-2004).]