Stratos: Punto de Encuentro de Desarrolladores

¡Bienvenido a Stratos!

Acceder

Foros





Trouble with OpenGL and Alpha

Iniciado por Saracchini, 14 de Septiembre de 2006, 10:58:57 PM

« anterior - próximo »

Saracchini

I´m new in this forum and i´m learning to use CRM32Pro. It appears easy to use and develop games  !:P

Now i´m making some experiences with the examples provided but i found some problems.

The first problem : The program finishes and register in log this message:

Citar· CRM32Pro successfully initiated.
· [CRM32Pro.SetVideoMode()] Error: could not initialize SDL video system (No available video device).

when i set CRM32Pro.Config.VideoRenderer to RENDER_OPENGL for all VideoAccel modes.

The second problem : CSprite->SetAlpha  does nothing in all video configs... I put before the procedure CSprite->Draw,after then, in the main loop ,but the sprite is rendered with no alpha changes...

Can anyone help me ?

Thanks for the attention !

TheAzazel

Hello Saracchini!

I have already replied to your mail, but also, I will reply here.

1) About RENDER_OPENGL...the problem is mine :roll: , I didnt specify in the docs that is not working yet. Well, this is due for the v5.0 which Im working now but... an unofficial way... since latest v4.95 and only for the VisualStudio library version, it is included but it is not fully tested yet (for example, fades doesnt work at all). So for the moment, is better dont use this renderer, use RENDER_WINDIB instead due to is the most stable.

2) About the sprite alpha problem... in theory, when you create/load a sprite, since you call to .SetAlpha() it should be drawn with that alpha value. Keep in mind that this alpha is per surface, not per pixel. Anyway, tomorrow I will check it again, I will let you know...

Well, that was all for the moment, let see what happend with the sprites...

Ciao!!

Saracchini

Citar1) About RENDER_OPENGL...the problem is mine...
No problem,i dont need this feature now. but Directx is not suitable for use in Linux...

Citar
2) About the sprite alpha problem... in theory, when you create/load a sprite, since you call to .SetAlpha() it should be drawn with that alpha value. Keep in mind that this alpha is per surface, not per pixel. Anyway, tomorrow I will check it again, I will let you know...
.

I will explain my experience... i get the code of "Example09_LogicRenderRates.cpp"  and put "spr1->SetAlpha(50) " before  "spr1->Draw()" and it not works... putting after the load of the sprite resulted in the same thing...

Ah... you can speak Spanish or Portuguese if ou preffer... but my spanish  writing is worse than my english... but i undertand perfectly .

Thanks papito !

TheAzazel

Hi again!

well, in you are going to use Linux...forget windib :), in Linux, right now, you can use X11, fbcon or dga backends.

About the problem with the alpha of that sprite... if you are using LogicRenderRates example, I imagine you are using the original sprite given in that example...well, that sprite has alpha per pixel (it was created from a PNG with alpha per pixel) and when you have it, you can not set alpha per surface. So yes! you can only use one kind of alpha..per pixel or per surface.
Try to load a simple sprite without alpha per pixel and you will see that .SetAlpha() works!

Hope this can help you :)

I will be on holidays until next Tuesday so if you have any other question...please, wait a couple of days :)

Saludos!

Saracchini

Thanks for the help papito !

Using a bmp sprite SetAlpha works normaly... only a question remain... this "issue" is relationed with only with  png´s alpha or with the bit depht ?

Now to finish my Effects library i must implement that geometrical transformations who I asked later (rotate, squew,translate, etc...)   8)

TheAzazel

Hi,

I have finished my little holidays... :( so Im here again!

That issue is with all alpha per pixel(APP) surfaces,casually, the most easy way to get a surface with APP is loading it from a PNG :).

Instead of an issue, it was my way to proceed. When you try to set an alpha per surface(APS) on a surface with APP, it ignores your request just to hold the alpha per pixel information. I could allow it easily.. but it has a few serious troubles...

Saludos!

Saracchini

I found a new problem... if i do it:


spr1 = new CRM32Pro_CSprite();
spr1->Load(GFX_RESOURCE,"raber");
spr1->AutoRestore(0);
spr2 = new CRM32Pro_CSprite();
spr2->Clone(spr1);
spr1->SetAlpha(100);


The program ends (maybe a error ?) when spr2->Draw is called. But if "spr2->Clone(spr1)" is localizaed after "spr1->SetAlpha" the program runs fine. And if I set the colorkey  in spr1 after the clone command the colorkey is set in spr2 too.I think it estrange... :?

And a single question about EditorDPF... how I set the color who is choosen to be the trasparent color ? For any values in the field "ColorKey" the transparent color is aways black...

TheAzazel

Hi,

right now, Im working hard on the CSprite class, cleaning the class, fixing some problems, adding new effects(rotation, scale, flip, mirror...) so tomorrow I will check your code.

I think where is the problem...when you clone a sprite, you are using the surface of the master sprite so that is the reason why changing the colorkey on the master will affect to the cloned sprites. With alpha it should happen the same..but maybe, there is a problem...I have to check it.

For next version, Im updating the docs too and I will add a few schemes to show the behaviour of CSprites, CTiles and the main with its rates system, so right now, you can ask me whatever you want :).

About your EditorDPF doubt...well, on the colorkey input box you have to type the ck in decimal of the desired RGB value, for example, if you want to have the R=0x20 G=0xFF and B=0x00 you can proceed on this way:
- pack it on an 32bits integer... 0x0020FF00
- convert that number on a decimal one: 2162432

I know is a little bit confusing but is the same as before, I will add a basic "how to use EditorDPF", as you can see, not everything is well documented...  :roll: but it will be on a few weeks :)

See you!

Pescado

oh no... bueno, esto explica porque no se hacia transparente mi grafico ^_^  ... pero, que problemas trae el setalpha en graficos png?... yo uso este tipo de graficos porque soporta canales alpha y los graficos se ven suavizados sin el efecto "sierra" en los bordes... con el crm32pro vamos a poder en un futuro hacer un setalpha a un grafico png?
The Toonminator!
http://www.toonminator.com

TheAzazel

Hola,

pues siento comunicarte que no es posible. El "problema" esta en SDL y es que no soporta en una superfice con alpha per pixel(tu imagen en PNG parece tenerlo, de ahi el suavizado evitando los dientes de sierra) activar el alpha per surface(el SetAlpha() vamos). Bueno, en realidad si se podria pero al activar el per surface se cargaria el per pixel... por tanto, en CRM32Pro opte por mantener siempre el per pixel.

En su dia, estuve mirando esto en SDL(poder tener per surface y per pixel) y nadie lo ha hecho hasta el momento y dudo que lo hagan por el engorro que seria(habria que añadir bastante codigo), sin embargo, es posible que en la nueva SDL 1.3/2.0 si lo permitan, en tal caso, y como me pasare a usar esa nueva SDL, problema resuelto.

Por ahora, usando el alpha per pixel puedes emular el alpha per surface, si me dices que estas buscando hacer, te podria dar algunas indicaciones.

Saludos!

Pescado

Era solo para hacer un fade del logo de mi web... nada importante, voy a continuar sin el setalpha... por ahora y para este sudoku no es necesario  :wink:
The Toonminator!
http://www.toonminator.com

TheAzazel

Oye... pero en ese caso nada te impide de hacer lo siguiente:

- Vuelcas tu logo con tu alpha per pixel y despues...
- IScreenFX->FadeToColor(0,0,0,1000);

Con eso te funcionara, ya veras :P

Saludos






Stratos es un servicio gratuito, cuyos costes se cubren en parte con la publicidad.
Por favor, desactiva el bloqueador de anuncios en esta web para ayudar a que siga adelante.
Muchísimas gracias.