News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Using TextureQuad to Scale Images

Started by kevin, July 22, 2007, 03:09:37 PM

Previous topic - Next topic

kevin

 This tidbit creates a 320*240 FX screen,  draws a bunch of alpha additive circles on it, then renders(scales) the FXscreen to the PB screen.  


PlayBASIC Code: [Select]
   W=320
h=240

OpenScreen 640,480,32,2

FXScreen=NewFXImage(w,h)



Do

RenderToIMage FXScreen

BackDrop()

inkmode 1+64

y=h*0.25

radius=w/4
For Angle#=0 to 359 step 3
BaseX#=(w/2)+Cos(BaseAngle#+Angle#)*Radius
BaseY#=(h/2)+Sin(BaseAngle#+Angle#)*Radius
Circlec BaseX#,Basey#,40+(angle#*0.25),true,rgb(2,3,4)
next

BaseAngle#=wrapangle(BaseAngle#,1)

ShowImage(FXScreen)

FXs$ =str$(W)+"*"+str$(h)
Ds$ =str$(GetScreenWidth())+"*"+str$(GetScreenHeight())
Text 10,10,"FX Screen:" +FXS$
Text 10,20," Display:" +Ds$
text 10,40,Fps()

Sync
loop



Function ShowIMage(Img)
rendertoScreen

SW=getScreenWidth()
SH=getScreenHeight()

iw=getImageWidth(img)
ih=getImageHeight(img)

TextureQuad img,0,0,0,0,_
sw,0,iw,0,_
sw,sh,iw,ih,_
0,sh,0,ih,false

EndFunction




function BackDrop()
Static baseangle#
c1=RGBFade($ff0000,SinNewValue(50,baseangle#,50))
c2=RGBFade($ffff00,CosNewValue(50,baseangle#,50))

c3=RGBFade($ff00f0,SinNewValue(50,baseangle#*2,50))
c4=RGBFade($1234,CosNewValue(50,baseangle#*2,50))

ShadeBox 0,0,GetSurfaceWidth(),GetSurfaceHeight(),c1,c2,c3,c4
baseangle#=Mod(baseangle#+1,360)
EndFunction






Draco9898

Hey thats a crazy cool background effect :) nuts if I'll ever figure it out though. I get how the scaling works though
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin