SlashOwnsU
JGO Visitor
Java games rock!
|
 |
«
Posted
2004-11-07 16:36:40 » |
|
hello people! I'm making a game resembling parappa the rapper (for those of you who remember) so I got a dude rapping on a stage what I wanna do is create multiple spotlights that light up the stage the spotlights start from the top, spread their light down (in a triangle) and light up the floor with an oval what I do is that I draw a triangle polygon that represents the light...this triangle is semi-transparent and has the "lighting the scene up" effect I also draw a trasparent oval on the floor code looks like [Code]
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, intensity)); Polygon p = new Polygon(); //fromX and fromY are the starting point of the light p.addPoint(fromX, fromY); //atX and atY the center of the oval of light on the floor...radX and radY the radius p.addPoint(atX - radX, atY); p.addPoint(atX + radX, atY); g2.setColor(col); g2.fillPolygon(p); g2.fillOval(atX - radX, atY - radY, radX * 2, radY * 2); //correction light g2.fillArc(atX - radX, atY - radY, radX * 2, radY * 2, 0, -180); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); [/code]
now the problem is that drawing the filled polygon every time is too slow (I'm using bufferStrategy, which is the fastest drawing technique I know so far) it lowers my FPS by like 20 FPS anyone has any alternatives to that method ?
|