dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

SDL error
Goto page Previous  1, 2, 3, 4
 
dev.gamez.lv Forum Index -> OpenGL
View previous topic :: View next topic  
Author Message
SkyD



Joined: 04 Oct 2006
Posts: 67

PostPosted: Wed Apr 11, 2007 6:52 am    Post subject:

Saprotu. Paldies!
Back to top
View user's profile
SkyD



Joined: 04 Oct 2006
Posts: 67

PostPosted: Wed Apr 11, 2007 6:33 pm    Post subject:

Ir kautkur atrodami kautkādi effekti, kuri piemēram lēnām pārlādē no attēla uz citu attēlu? Ja nav, tad kā to panākt?
Back to top
View user's profile
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Wed Apr 11, 2007 6:46 pm    Post subject:

Šis saucās alfa blendings.
Tu maini vērtību alfa no 0 līdz 1 noteiktā laika intervālā (vienkārša lineāra funkcija). Kad alfa=0, tad rādās bilde A, kad alfa=1, tad radās bilde B.
Pieņemot, ka bildes ir viena izmēra, tad katrs ekrāna pikselis pix[x,y] tiek zīmēts ar krāsu A[x,y]*(1-alfa) + B[x,y]*alfa.

Lai nebūtu pašam manuāli jārēķina visu pikseļu vērtības (kas būtu lēni), var izmantot videokartē iebūvētas iespējas. Ja izmanto OpenGL, tad tev jāskatās uz GL_BLEND konstanti un glBlendFunc funkciju. Ja izmanto tīru SDL, tad lasi dokumentāciju: SDL_BlitSurface (tev vajadzīgs panākt to "blit using per-pixel alpha, ignoring any colour key" variantu).
Back to top
View user's profile Send e-mail
SkyD



Joined: 04 Oct 2006
Posts: 67

PostPosted: Wed Apr 11, 2007 8:40 pm    Post subject:

Izmantoju tīru SDL.
Ar SDL_SetAlpha to pa tiešo nevar panākt?
Back to top
View user's profile
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Wed Apr 11, 2007 9:20 pm    Post subject:

Izlasi, ko tā SetAlpha dara. Un izlasi, ko dara BlitSurface. Un tad prasi vēlreiz ;)
Back to top
View user's profile Send e-mail
SkyD



Joined: 04 Oct 2006
Posts: 67

PostPosted: Wed Apr 11, 2007 9:49 pm    Post subject:

Sanāca man ar šādām rindām:
Code:

for (int i=1; i<=64; i++) {
           SDL_SetAlpha(image, SDL_SRCALPHA, i);
           SDL_BlitSurface(image, NULL, screen, NULL);
           SDL_SetAlpha(image, SDL_SRCALPHA, 32+i);
           SDL_Flip(screen);
}
Back to top
View user's profile
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Wed Apr 11, 2007 10:21 pm    Post subject:

Kam šis vajadzīgs: SDL_SetAlpha(image, SDL_SRCALPHA, 32+i); ?
Back to top
View user's profile Send e-mail
SkyD



Joined: 04 Oct 2006
Posts: 67

PostPosted: Wed Apr 11, 2007 10:27 pm    Post subject:

nezinu... Laikam jau, ka nevienam..
Back to top
View user's profile
Display posts from previous:   
dev.gamez.lv Forum Index -> OpenGL All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group