Drop Shadow 2D OpenGL - Game Development
文章推薦指數: 80 %
Hi, I want to create a simple drop shadow effect for the OpenGL GUI I am working on. Basically I want a drop shadow behind my rectangles.
Search:
AdvancedForumSearch
Forums
Programming
WebDevelopment
Computers
Tutorials
Snippets
DevBlogs
Jobs
Lounge
Login
Join!
Today'sTopics
Dream.In.Code>ProgrammingHelp
>GameDevelopment
DropShadow2DOpenGL
Page1of1
NewTopic/Question
Reply
6Replies-17009Views-LastPost:21August2010-09:09PM
RateTopic:
#1
Tom9729
Segmentationfault
Reputation:181
Posts:
2,642
Joined:
30-December07
DropShadow2DOpenGL
Posted19August2010-08:48PM
Hi,
IwanttocreateasimpledropshadoweffectfortheOpenGLGUIIamworkingon.BasicallyIwantadropshadowbehindmyrectangles.
EverythingIfindseemstosuggestthatIcouldjustdrawablackboxanduseaGaussianfilteronit.
I'dliketodothisontheGPUifpossiblebutI'veneverdoneanythingwithshadersbeforesoIjustwanttoseeifanyoneelsethinksthiswillworkbeforeIspendalotoftimeonit.
Thanks
IsThisAGoodQuestion/Topic?
0
Backtotop
MultiQuote
Quote+Reply
RepliesTo:DropShadow2DOpenGL
#2
stayscrisp
フカユ
Reputation:1040
Posts:
4,326
Joined:
14-February08
Re:DropShadow2DOpenGL
Posted20August2010-04:19AM
Yesthisisdefinitelypossiblewithshaders.Youcouldpossiblyuse2passes,onetodrawthedropshadowandthenonetodrawthemodelitself.
InfactIfoundawaytodotoonshadingwhichstartsoffbydrawingaslightlylargercopyofthemeshfortheoutline,thiscouldprobablybeadaptedandsimplifiedtodrawashadow.Wouldyouwantittodynamicallyadjustforthelightdirection/source?
I'lltrytodigoutsomeinfoonthattoonshaderifyourinterested?wouldyoubeusingGLSL?
WasThisPostHelpful?
1
Backtotop
MultiQuote
Quote+Reply
#3
Tom9729
Segmentationfault
Reputation:181
Posts:
2,642
Joined:
30-December07
Re:DropShadow2DOpenGL
Posted20August2010-04:47AM
Nolightsources,justgoingforasimpleeffectlikethis.
IwasthinkingaboutusingCg,butGLSLwouldbefineaswell.
WasThisPostHelpful?
0
Backtotop
MultiQuote
Quote+Reply
#4
stayscrisp
フカユ
Reputation:1040
Posts:
4,326
Joined:
14-February08
Re:DropShadow2DOpenGL
Posted20August2010-10:37AM
Ahright.WellwhatIsuggestedmightbeoverkillthen.ThisisdefinitelypossibleIjustdon'tknowhowtodoitotherthanwhatIalreadyposted.
WasThisPostHelpful?
0
Backtotop
MultiQuote
Quote+Reply
#5
Tom9729
Segmentationfault
Reputation:181
Posts:
2,642
Joined:
30-December07
Re:DropShadow2DOpenGL
Posted21August2010-08:42PM
Woot,gotitworking(withoutshaders).
Mysolutionwastodrawtherectangleseveraltimesandplaywiththedimensionsandopacity.
CodeusesmygraphicslibrarybutisfairlyselfexplanatoryIthink...
if(shadowRadius>0.0)
{
push();
constintredraw=10;
constfloatposX=rect.getX();
constfloatposY=rect.getY();
constfloatwidth=rect.getWidth();
constfloatheight=rect.getHeight();
constfloatdestAlpha=0.1;
for(inti=0;i
延伸文章資訊
- 110 Graphic Design Mistakes You May Not Know You're Making (and how ...
- 2Drop Shadow 2D OpenGL - Game Development
Hi, I want to create a simple drop shadow effect for the OpenGL GUI I am working on. Basically I ...
- 3Shadow Mapping - LearnOpenGL
comparrison of shadows in a scene with and without in OpenGL ... Imagine a floor section with a l...
- 4[OpenGL] Shadow Map 陰影 - 程式人生
圖:隨著鍵盤控制點光源位置移動,陰影發生實時的變換... box_shadow div陰影效果. div內陰影box-shadow: 0px 0px 10px 5px # ...
- 5OpenGL 3D Game Tutorial 38: Shadow Mapping (1/2)