Transparent Textures

I have to switch off acceleration when I wanto use transparent texture if graphic card on the computer is lower than GeForce4. What the…

No problem for me (GF3). Can you be more specific about your problem please ?

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!

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…

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 ?

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…

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).]

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

  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 :
It should do the trick.

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!

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?

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.

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 :

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.

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.

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).]