Both canvas and webGL are JavaScript APIs. They are pretty much the same regarding integration (binding). They are both supported by a ...
Home
Public
Questions
Tags
Users
Collectives
ExploreCollectives
FindaJob
Jobs
Companies
Teams
StackOverflowforTeams
–Collaborateandshareknowledgewithaprivategroup.
CreateafreeTeam
WhatisTeams?
Teams
CreatefreeTeam
CollectivesonStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
IsthereanyreasonforusingWebGLinsteadof2DCanvasfor2Dgames/apps?
AskQuestion
Asked
8years,1monthago
Active
1monthago
Viewed
97ktimes
143
35
Isthereanyreason,exceptperformance,forusingWebGLinsteadof2D-Canvasfor2Dgames/apps?
Inotherwordwhat2DfunctionalitiesareofferedbyWebGLwhicharenotpossibletoachieveeasilywith2D-Canvas?
htmlhtml5-canvaswebgl
Share
Improvethisquestion
Follow
editedFeb8,2014at12:48
AliShakiba
askedFeb6,2014at12:43
AliShakibaAliShakiba
19.4k1717goldbadges6060silverbadges8787bronzebadges
2
11
Bytheway:Whileyoucan'tusethe2dandthe3dcontextAPIonthesamecanvas,youcanstillcombinethembyusingmultiplecanvases.WebGLcanuse2dcanvasesastexturesand2dcanvasescanuseWebGLcanvasesassourcesfordrawImage.
– Philipp
Feb7,2014at8:26
1
Forafewmoredetailson@Philipp'scommentseethisQ/A.
– bluenote10
Jun13,2021at20:04
Addacomment
|
9Answers
9
Sortedby:
HighestScore(default)
Datemodified(newestfirst)
Datecreated(oldestfirst)
119
Lookingatthisquestionfromanotherside:
howdoesadeveloperchooseonetechnologyoveranother?
integratesbetterintheiralreadybuiltsystem
iseasiertouse
isfaster
hasmorecapabilitiesorbettersuitstheirneeds
cost
moreplatfrom-independant
SoI'lldiscussthedifferencesbetweencanvasandwebGLAPIsregardingthesequalities.
BothcanvasandwebGLareJavaScriptAPIs.Theyareprettymuchthesameregardingintegration(binding).Theyarebothsupportedbyanumberoflibrariesthatcouldspeedupyourcoding.Differentlibrariesgiveyoudifferentwaystoorganizeyourcode,solibrarychoicedictateshowyourdrawingAPIsarestructured,butit'sstillprettymuchthesamething(howtherestofthecodebindstogetherwithit).Ifyouuselibrary,theeaseofwritingcodedependsonthelibraryitself.
Ifyouwritecodefromzero,thecanvasAPIismucheasiertolearnandunderstand.Itrequiresminimalmathknowledge,anddevelopmentisfastandstraightforward.
WorkingwiththeWebGLAPIrequiresstrongmathskillsandafullunderstandingoftherenderingpipeline.Peoplewiththeseskillsarehardertofind,productionisslower(duetothesizeandcomplexityofsuchacodebase),andthereforeitcostsmore.
WebGLisfasterandithasmorecapabilities.Nodoubtaboutthat.It'sanative3DAPIthatgivesyoufullaccesstotherenderingpipeline,codeandeffectsareexecutedfasterandaremore'tweakable'.WithwebGLtherereallyisnolimit.
BothcanvasandwebGLarehtml5goodies.Usuallythedevicesthatsupportonewillsupportandtheother.
So,tosumup:
mergingthedrawingAPIcodeandtherest(integration):similar
easeofuse:
(withlibrary)canvas=webGL
(fromscratch)webGL<