Go cross-platform OpenGL bindings. | GolangRepo
文章推薦指數: 80 %
Package gl is a Go cross-platform binding for OpenGL, with an OpenGL ES 2-like API. It supports: ... This is a fork of golang.org/x/mobile/gl ... Actualmiddlewares Argo Audio&Music Authentication&OAuth Benchmarks MoreCategories BotBuilding BuildTools Caching CloudComputing CodeAnalysis CommandLine Command-lineOptionParsers Compiler Compression Configuration ConsoleUserInterface ContinuousIntegration Cryptography DataProcessing DataStructures DataVisualization Database DatabaseDrivers Databaseschemamigration. Databasetools DateandTime DependencyInjection DevelopmentTools DevOpsTools DistributedSystems Editor Email EmbeddableScriptingLanguages EncodingsandCharacterSets ErrorHandling FileHandling FileSystem Financial Forms FrameworksandToolkits GameDevelopment GIS Git Goroutines GUIsandWidgetToolkits HTTPClients HTTPmiddlewares Imagestools InstantMessaging IoT(InternetofThings) JobScheduler JSON Key-ValueStore LanguageandLinguistics LearningTutorial Librariesforvalidation LoggingandMonitoring MachineLearning Mathematics Messaging Microservices MicrosoftExcel Miscellaneous NaturalLanguageProcessing Network NetworkingDNS ORM P2PandFileSharing PackageManagement Performance ProjectLayout PublicAPIWrappers QueryLanguage ResourceEmbedding Routers ScienceandDataAnalysis Security Serialization ServerApplications SourceCodeManagement SQLQueryBuilder StorageServer TemplateEngines TestingFrameworks TextProcessing Utilities UUIDLibraries Video VirtualMachinesandLanguages WebApplications WebCrawling WebFrameworks WebAssembly Websockets XMLLibraries PopularRepo LatestRepo Resources All Article News Book Tutorial Overview Issues 9 Releases Star154 Watch15 Fork17 Gocross-platformOpenGLbindings. Lastupdate:Dec6,2021 Relatedtags Imagestools webgl opengl opengl-es Overview gl PackageglisaGocross-platformbindingforOpenGL,withanOpenGLES2-likeAPI. Itsupports: macOS,LinuxandWindowsviaOpenGL2.1backend, iOSandAndroidviaOpenGLES2.0backend, ModernBrowsers(desktopandmobile)viaWebGL1.0backend. Thisisaforkofgolang.org/x/mobile/glpackagewithCL8793mergedinandWindowssupportadded.Thispackageisfullyfunctional,butmayeventuallybecomesupercededbythenewx/mobile/glplan.Itwillexistandbefullysupporteduntilitcanbesafelyreplacedbyabetterpackage. Installation goget-ugithub.com/goxjs/gl/... GOARCH=jsgoget-u-dgithub.com/goxjs/gl/... Usage ThisOpenGLbindinghasaContextWatcher,whichimplementsglfw.ContextWatcherinterface.Recommendedusageiswithgithub.com/goxjs/glfwpackage,whichacceptsaContextWatcherinitsInit,andtakesontheresponsibilityofnotifyingitwhencontextismadecurrentordetached. iferr:=glfw.Init(gl.ContextWatcher);err!=nil{ //Handleerror. } deferglfw.Terminate() Ifyou'renotusingaContextWatcher-awareglfwlibrary,youmustcallmethodsofgl.ContextWatcheryourselfwheneveryoumakeacontextcurrentordetached. window.MakeContextCurrent() gl.ContextWatcher.OnMakeCurrent(nil) glfw.DetachCurrentContext() gl.ContextWatcher.OnDetach() Issues gl.InitcalledwithoutacurrentcontextonWindowsbackend,andfails. IgavetheWindowsbuildatry,andunfortunatelywegetafatalerroronstartupinitializinggl: gl.Init:glActiveTexture Ibelievetheproblemisthatgl.InitmustbecalledafterMakeCurrentContextaswglGetProcAddressrequiresaboundcontext:Whennocurrentrenderingcontextexistsorthefunctionfails,thereturnvalueisNULL. Originallyreportedinhttps://github.com/google/gxui/pull/86#issuecomment-107037914. openedbydmitshur10 UnabletoGetCurrentFrameBufferInWebgl TherearepointswhereIneedtogetthecurrentframebuffer,bindanother,thenbindthefirstonehoweverrightnowitisnotreallypossibletodothatinwebgl.NormallyIwouldcallgl.GetInteger(gl.FRAMEBUFFER_BINDING)butthatalwaysreturns0andwontallowmetobindtoit.Accordingtothishttps://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindFramebufferIwouldneedtocallgetParameteronthecontexttogetthecurrentframebuffer.ItishardtonameasolutiontothissinceaddingaGetCurrentFrameBuffer()methodwouldchangethewholeapi.AlsoIwasthinkingexposingthecontextsoIcancallanyfunctiononitbutagainthatdoesnotworkforauniformAPI. LetmeknowifIhavemissedasolution,thatcouldbepossibleaswell. thinking openedbytanema9 headless anyplanstosupportheadlessgl? enhancement helpwanted openedbyghost8 Suggestion:addbasicexamples. anychanceongettingsomebasicexamples,tohaveabasetoworkfrom? iamquiteexcitedaboutthisprojectandeagertoseehowwellopenglandwebglcanworktogether. enhancement openedbyjoeblew997 JSTexImage2DproducesTypeError TypeError:Argument9ofWebGLRenderingContext.texImage2DdoesnotimplementinterfaceArrayBufferViewOrNullonFirefox42.0andUncaughtTypeError:Failedtoexecute'texImage2D'on'WebGLRenderingContext':parameter9isnotoftype'ArrayBufferView'onChrome48.0.2564.109. AFAIKthedataparameterofgl.TexImage2Disa[]bytewhichbecomesaUint8ArrayinGopherJS...whichshouldsatisfytheWebGLstandardwhichcallsforanArrayBufferView. Forcomparison,gl.BufferDatatakesa[]byteandworksfine.TheonlydifferenceIcanseeisthattheWebGLspecforbufferDataspecifiesaBufferDataSource?(whichisdefinedasanArrayBufferVieworanArrayBufferinthespec)andnotanArrayBufferView?typeforthedataparameter. openedbynytehauq6 implementallremained"panic"methods Ididn'tcreatetestprogramsbutIjusttestedviacompiler.Therearenosyntaxandtypeerrors. openedbyshibukawa6 Differencewithwebgl? Whatsthedifferencebetweenthislibraryhttps://github.com/ajhager/webglandyoursitseemsbothsupportthesamefunctionalityandAPI,andbotharecrossplatformandIseeyoumadeacommittherealso question openedbypyros20976 SupportedOpenGLversion ItseemsoddthatyouareusingOpenGL2.1fordesktopsbutES2formobile.Doesn'ttheES2specbasicallymatchOpenGL3.3?IstheremoredetailthatI'mmissing? question openedbydelaneyj4 Can'tgetsecondattributelocation Hi, Itookthetriangleexampleandjustaddedthelinesbellow: ... attributevec3aVertexPosition; attributevec3aVertexPosition2; ... vertexPositionAttrib:=gl.GetAttribLocation(program,"aVertexPosition") fmt.Printf("vertexPositionAttrib=%d",vertexPositionAttrib) vertexPositionAttrib2:=gl.GetAttribLocation(program,"aVertexPosition2") fmt.Printf("vertexPositionAttrib2=%d",vertexPositionAttrib2) ... IbuilditwithgopherjsandthevalueofvertexPositionAttrib2is-1. DidImissedsomething? Regards, Marc question openedbybombjackm4 DoesanyonewantWindowssupport? RightnowthispackagesupportsOSX,Linux,andbrowsers. Windowsiscurrentlynotsupported.Icanadditveryeasily,itwouldtakemeanhourorso,butIwouldn'twanttospendtimeonitunlesspeopleactuallywant/needit(Idon'tuseWindowsmyself). Ifyou'reusingthispackage(orconsideringit)andwantWindowsbackendadded,justleavea+1here. enhancement openedbydmitshur3 Wasm UpdatethewasmbranchtoworkwithmorerecentdependenciesandtrytoreducecodedifferenceforuserofthepackagebetweentheGopherjsuseandWasmuse. openedbyBluebugs2 MaintenanceandSupersession Thispackageisfullyfunctional,butmayeventuallybecomesupercededbythenewx/mobile/glplan. Yet,over4yearsafterthatsentencewaswritten,Icouldn'tfindanyupdatesonWebGLsupportbeingaddedtothegolang.org/x/mobile/glpackage. Isthereactuallyanyworkatallbeingdonewiththat(andIjustmissedit),orissupersessionbyx/mobile/glentirelyahypothetical? Ifit'sthelatter,itmightbeabouttimethattheREADMEseesanotherupdatetomoreaccuratelyreflectthecurrentstateofthispackage..? openedbylunabunn1 README:stopsuggestingGOARCH=jsgogetsinceitnolongerworks Iamsorry,thismaybeverybasicbutIamtryingtousethislibraryandItrytorun GOARCH=jsgoget-u-dgithub.com/goxjs/gl/... IgetunsupportedGOOS/GOARCHpairdarwin/jsIhavetriedaseriesofpairslikejs/jsor/jsorjs/darwinandIgetthesamemessageeverytime. AmIdoingsomethingwrong?doesthelibraryneedtobeupdated? openedbytanema5 Updatetonewest"golang.org/x/mobile/gl" I'mcurrentlyinvestigatingmyoptionsforwritinganOpenGLapplicationforbothdesktopandwebandthisrepositoryseemsthebethebestcandidate-goodwork! Itisawhilesinceitwasforkedfrom"golang.org/x/mobile/gl"anditseemsthattherewerequitesomemajorchanges-addingWebGLsupportwasn'toneofthem. OnechangeIlikeparticularlyistherender-thread:Applicationsuseaglctx-objectthatexposestheOpenGLfunctionality,butthecallstothatcontextareonlypushedintoachannelandexecutedlaterbyadedicatedrenderthread.Thisimprovesmultithreading/go-routinesupportgreatly. I'mnotabletouse"golang.org/x/mobile/gl"duetothelackofWebGLsupport(Idon'tneedtosupportmobile).AndIalsodon'tlikethefactthatdesktopapplicationsrequiretheANGLEdllsinsteadofusingtheOpenGLbindingsfromgo-gl-butIcanlivewiththat. Isitpossibleforgoxjstoadaptthosefeaturesortobeupdatedtothenewestversionofgolang.org/x/mobile/gl? Whichchangeswouldberequiredtodoso? enhancement openedbymaja423 AddWebAssemblysupport. ThischangeisaworkinprogressonaddingsupportforWebAssemblytopackagegl,whilemaintainingGopherJSsupport. It'sdonebydifferentiatingcodeforWebAssembly(whichusessyscall/jsAPI)fromexistingcodeforGopherJS(whichusesgithub.com/gopherjs/gopherjs/jsAPI)withthefollowingbuildconstraints: _js.go //+buildjs,!wasm ...GopherJScode... _wasm.go //+buildjs,wasm ...WebAssemblycode... IthasbeendevelopedandtestedprimarilywiththeHoverandeX0-goprojects. openedbydmitshur0 Attrib.Valueisintforwebglanduintforopengl? Inattemptingtocross-compileaprogramforbothWebGLandDesktopOpenGL,I'venoticedthattheAttribtypeisuintfortheformer,andintforthelatter.Thismakesitalittlehardtomanipulatetheseinaportableway. Isthereatechnicalreasonwhythesearedifferent,orcouldtheybebroughtintoalignment? openedbyswiftcoder5 PlansforWebGL2 IsthereanyplansforWebGL2? question openedbyignishub3 GetTexParameterfv,similarGetfuncargumentsarenotinlinewithOpenGLspec. Thefuncsingoxjs/glhavedestinationfirst,butOpenGLspectendstohaveitlast. Thinkaboutthis,whetherit'sanissueornot,andhowitcanberesolved,ifatall. openedbydmitshur0 FailsonRaspberryPi(go1.5linux/arm). gogetgithub.com/goxjs/gl github.com/goxjs/gl code/go/src/github.com/goxjs/gl/gl_opengles.go:24:ContextWatcherredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:17 code/go/src/github.com/goxjs/gl/gl_opengles.go:26:contextWatcherredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:19 code/go/src/github.com/goxjs/gl/gl_opengles.go:29:contextWatcher.OnDetachredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:33 code/go/src/github.com/goxjs/gl/gl_opengles.go:31:ActiveTextureredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:38 code/go/src/github.com/goxjs/gl/gl_opengles.go:35:AttachShaderredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:45 code/go/src/github.com/goxjs/gl/gl_opengles.go:39:BindAttribLocationredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:53 code/go/src/github.com/goxjs/gl/gl_opengles.go:45:BindBufferredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:60 code/go/src/github.com/goxjs/gl/gl_opengles.go:49:BindFramebufferredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:67 code/go/src/github.com/goxjs/gl/gl_opengles.go:53:BindRenderbufferredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:74 code/go/src/github.com/goxjs/gl/gl_opengles.go:57:BindTextureredeclaredinthisblock previousdeclarationatcode/go/src/github.com/goxjs/gl/gl_opengl.go:81 code/go/src/github.com/goxjs/gl/gl_opengles.go:57:toomanyerrors` enhancement helpwanted openedbycarlTLR11 Owner Gocross-platformpackages. GitHubRepository Gocross-platformglfwlibraryforcreatinganOpenGLcontextandreceivingevents. glfwPackageglfwexperimentallyprovidesaglfw-likeAPIwithdesktop(viaglfw)andbrowser(viaHTML5canvas)backends.ItisusedforcreatingaG 71Aug6,2021 GobindingsforOpenGL(generatedviaglow) glThisrepositoryholdsGobindingstovariousOpenGLversions.Theyareauto-generatedusingGlow.Features:GofunctionsthatmirrortheCspecific 851Dec10,2021 GobindingstoOpenGLUtilityLibrary GLUThispackageoffersminimalbindingsforGLUfunctions.Usagegogetgithub.com/go-gl-legacy/glu LicenseCopyright2012Thego-glAuthors.Allri 21Aug18,2018 golangOpenGLhelperfunctions glh:golangOpenGLhelpersThispackagecontainsanumberoffunctionsusefulforapplicationsusingOpenGL.CodeReferenceFeaturesTexturesandText 23Oct28,2021 OpenGLbindinggeneratorforGo GoGLGoGLisanOpenGLbindinggeneratorforGo.NoexternaldependencieslikeGLEWareneeded.InstalltheOpenGLbindingsForexample,OpenGL2.1bi 138Jul15,2021 Quake2LevelRendererwritteninGoandOpenGL go-quake2Quake2MapRendererwritteninGoandOpenGL.FeaturesLoadsanyBSPfilefromQuake2FreeroamaroundtheenvironmentRendersonlyasmal 24Nov18,2021 CanvasisaGodrawinglibrarybasedonOpenGLorusingsoftwarerenderingthatisverysimilartotheHTML5canvasAPI GocanvasCanvasisapureGolibrarythatprovidesdrawingfunctionalityassimilaraspossibletotheHTML5canvasAPI.IthasnothingtodowithHT 398Dec10,2021 APongclonemadefromscratchwithGoandCusingOpenGL3.3 Go-PongAPongvideogameclonemadewithGolangandOpenGL3.3usingC.GameplayOfflineKeybindingsare'w'and's'fortheleftplayerand'upar 32Dec13,2021 OpenGLrenderer oglrAboutoglrisapackageforGotoloadOpenGLfunctionsandrendergraphics.Itispublishedonhttps://github.com/vbsw/oglr.CopyrightCopyright 0Nov21,2021 Across-platformtooltoconvertimagesintoasciiartandprintthemontheconsole Across-platformtooltoconvertimagesintoasciiartandprintthemontheconsole 633Dec13,2021 GobindingsforGLFW3 GLFW3.3forGoInstallationGLFWClibrarysourceisincludedandbuiltautomaticallyaspartoftheGopackage.Butyouneedtomakesureyouhaved 1.2kDec8,2021 GobindingsforGLFW3 GLFW3.3forGoInstallationGLFWClibrarysourceisincludedandbuiltautomaticallyaspartoftheGopackage.Butyouneedtomakesureyouhaved 1.2kDec4,2021 GobindingsforaudiocaptureandplaybackwithALSAandlibasound GoALSAbindingsThesebindingsallowcaptureandplaybackofaudioviaALSAusingthealsa-liblibrary.Installationgogetgithub.com/cocoonlife/goa 34Oct8,2021 naivegobindingstoGnuPlot go-gnuplotSimple-mindedfunctionstoworkwithgnuplot.go-gnuplotrunsgnuplotasasubprocessandpushescommandsviatheSTDINofthatsubprocess. 26Nov8,2021 go-gtk3-GTK3BINDINGSFORGO go-gtk3-GTK3BINDINGSFORGOTHISIS:HopefullyGTK3BindingsusinggobjectbindingforGo. Goalistohavefairlycompletegtk3widgets withpango 57May25,2021 ExperimentalOpenALbindingsforGo. ExperimentalOpenALbindingsforGo. ==================================== Everythingisevolvingquicklyandnothingistotallydone. Ifyouwantto 30May25,2021 GobindingsforOpenCV/2.xAPIingocv/1.xAPIinopencv GoOpenCVbindingAGolangbindingforOpenCV.OpenCV1.xCAPIbindingsthroughCGO,andOpenCV2+C++API(GoCV)throughSWIG.DisclaimerThisisa 1.3kDec9,2021 GobindingsforGStreamer(retired:currentlyIdon'tuse/developthispackage) Retired.Idon'tuse/developthispackageanymore.GobindingsforGStreamerataveryearlystageofmaturity.ThispackageisbasedonGLibbindings 162Nov10,2021 GobindingsforlibVLCandhigh-levelmediaplayerinterface GobindingsforlibVLC2.X/3.X/4.Xandhigh-levelmediaplayerinterface.Thepackagecanbeusefulforaddingmultimediacapabilitiestoapplications 261Nov30,2021
延伸文章資訊
- 1Learn Opengl Golang
OpenGL Tutorial in Go. Based on the excellent tutorial by Joey de Vries; uses go-gl for all OpenG...
- 2OpenGL & Go Tutorial Part 1: Hello, OpenGL - Kyle Banks
There are bindings for OpenGL in just about every language and Go is no ... Conway's Game of Life...
- 3Games With Go 39 - Intro OpenGL & Golang - YouTube
For more info on games with go, see: https://gameswithgo.org/The error around halfway with shader...
- 4vbsw/opengl-go-example - Giters
Vitali Baumtrok opengl-go-example: simple OpenGL example with GLFW3 in Go.
- 5Vitali Baumtrok / opengl-go-example - GitLab
simple OpenGL example with GLFW3 in Go. ... opengl-go-example. Project ID: 19237990. simple golan...