go-gl/gl: Go bindings for OpenGL (generated via glow) - GitHub
文章推薦指數: 80 %
The gl package contains the OpenGL functions and enumeration values for the imported version. It also contains helper functions for working with the API. Of ... Skiptocontent {{message}} go-gl / gl Public Notifications Star 853 Fork 64 GobindingsforOpenGL(generatedviaglow) MITLicense 853 stars 64 forks Star Notifications Code Issues 10 Pullrequests 0 Actions Projects 0 Wiki Security Insights More Code Issues Pullrequests Actions Projects Wiki Security Insights master Branches Tags Couldnotloadbranches Nothingtoshow Loading {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default Loading 1 branch 0 tags Code Loading Latestcommit Jacalz Maketheworkflowabitmorereliable(#147) … 726fda9 Dec10,2021 Maketheworkflowabitmorereliable(#147) *Maketheworkflowabitmorereliable Thismakesafewchanges. Mostimportantly,itfixestheinstalltionofdeps. Thiswasduetotherepolistnotbeingupdatedandpartlybecauseapt-get isaterriblepackagemanager(inmyopinion)andthusdoesn'tdoitautomatically. ThetestsnowonlyrunfortheoldestandnewestGoversionsonlyasifitworksonbothofthose, wecanlitterallysaythatanythingbetweenisabuginGoandnothere.Apartfromthat,it ismostlysomecleanupsandupdatestotheusedactions. *Removeanewline 726fda9 Gitstats 93 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime .github/workflows Maketheworkflowabitmorereliable(#147) Dec10,2021 all-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v2.1/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v3.0/gles2 RegenerateglforNetBSDsupport(#146) Dec8,2021 v3.1/gles2 RegenerateglforNetBSDsupport(#146) Dec8,2021 v3.2-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v3.2-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v3.3-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v3.3-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.1-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.1-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.2-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.2-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.3-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.3-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.4-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.4-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.5-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.5-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.6-compatibility/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 v4.6-core/gl RegenerateglforNetBSDsupport(#146) Dec8,2021 LICENSE Initialcommit Apr10,2014 README.md fixbuildstatusbadge May1,2021 generate.go generategles3.0(#143) Sep5,2021 go.mod UpdatetheGoversionto1.12(#144) Oct25,2021 Viewcode gl Usage Examples FunctionLoading Go>=1.14andcheckptr Generating README.md gl ThisrepositoryholdsGobindingstovariousOpenGLversions.Theyareauto-generatedusingGlow. Features: GofunctionsthatmirrortheCspecificationusingGotypes. SupportformultipleOpenGLAPIs(GL/GLES/EGL/WGL/GLX/EGL),versions,andprofiles. Supportforextensions(includingdebugcallbacks). Requirements: Acgocompiler(typicallygcc). OnUbuntu/Debian-basedsystems,thelibgl1-mesa-devpackage. Usage Usegoget-utodownloadandinstalltheprebuiltpackages.TheprebuiltpackagessupportOpenGLversions2.1,3.1,3.2,3.3,4.1,4.2,4.3,4.4,4.5,4.6acrossboththecoreandcompatibilityprofilesandincludeallextensions.Pickwhicheverone(s)youneed: goget-ugithub.com/go-gl/gl/v{3.2,3.3,4.1,4.2,4.3,4.4,4.5,4.6}-{core,compatibility}/gl goget-ugithub.com/go-gl/gl/v3.1/gles2 goget-ugithub.com/go-gl/gl/v2.1/gl Oncethebindingsareinstalledyoucanusethemwiththeappropriateimportstatements. packagemain import"github.com/go-gl/gl/v3.3-core/gl" funcmain(){ window:=...//Openawindow. window.MakeContextCurrent() //Important!Callgl.InitonlyunderthepresenceofanactiveOpenGLcontext, //i.e.,afterMakeContextCurrent. iferr:=gl.Init();err!=nil{ log.Fatalln(err) } } TheglpackagecontainstheOpenGLfunctionsandenumerationvaluesfortheimportedversion.ItalsocontainshelperfunctionsforworkingwiththeAPI.Ofnoteisgl.PtrwhichtakesaGoarrayorsliceorpointerandreturnsacorrespondinguintptrtousewithfunctionsexpectingdatapointers.Alsoofnoteisgl.Strwhichtakesanull-terminatedGostringandreturnsacorresponding*int8tousewithfunctionsexpectingcharacterpointers. Anoteaboutthreadingandgoroutines.ThebindingsdonotexposeamechanismtomakeanOpenGLcontextcurrentonadifferentthreadsoyoumustrestrictyourusagetothethreadonwhichyoucalledgl.Init().TodosoyoushoulduseLockOSThread. Examples Examplesillustratinghowtousethebindingsareavailableintheexamplerepo.ThereareexamplesforOpenGL4.1coreandOpenGL2.1. FunctionLoading Theprocaddrpackagecontainsplatform-specificfunctionsforloadingOpenGLfunctions.Callinggl.Init()usestheautosubpackagetoautomaticallyselectanappropriateimplementationbasedonthebuildenvironment.Ifyouwanttoselectaspecificimplementationyoucanusethenoautobuildtagandthegl.InitWithProcAddrFuncinitializationfunction. Go>=1.14andcheckptr Inversion1.14ofGo,theracedetectoraddedcheckptrinstrumentation.Thiscompilationoptionensuresthatprogramsfollowunsafe.Pointersafetyrules.Seeherefordetails:https://golang.org/doc/go1.14#compiler. Ifenabled,thereisahighchancethatitwillcauseprogramterminationwhencallingspecificOpenGLfunctions,withamessagelikethis: fatalerror:checkptr:pointerarithmeticcomputedbadpointervalue Thereportedcallstackwillpointtoafunctionlikegl.VertexAttribPointer()thatreceivesanunsafe.Pointerasparameter. Incasesuchfunctionrequiresan"offset"passedinasapointer(inthelow-levelAPI),adifferentsignatureneedstobeusedinordertosatisfythedetector. Forthispurposeglowgenerates"override"functionswhichhaveadifferentsignature,takinguintptrinstead.ThesefunctionshavethesuffixWithOffset(orsimilar)intheirname. Forthepreviousexample,itwouldbegl.VertexAttribPointerWithOffset(). Notallsuchfunctionshaveanappropriateoverride!Incaseyoustumbleoversuchanerror,andtheoverrideismissing,youhavethefollowingoptions: Disablethedetectorbybuildingyourprogramwith-gcflags=all=-d=checkptr=0 Reportthemissingfunction(s)asissueforglow Possiblyevencreateapull-requestforglowwiththemissingoverrideyourself,andre-generatetheglbindings. Generating TheseglbindingsaregeneratedusingtheGlowgenerator.Onlydevelopersofthisrepositoryneedtodothisstep. Itisrequiredtohaveglowsourceinasiblingdirectorytogo-gl/glsincerelativepathsareusedforgeneration(seegenerate.go). Fornon-module-awarecases,thismeansglowneedstobeinthesameGoworkspaceasgo-gl/gl. Formodule-awarecases,go-gl/glowneedstobecheckedoutparalleltogo-gl/gl. Ineithercase,theglowbinarymustbeinyour$PATH.Doablewithgoget-ugithub.com/go-gl/glowifyour$GOPATH/binisinyour$PATH. Performgenerationwiththefollowing: cdpath/to/go-gl/gl gogenerate-tags=gen. MoreinformationaboutthesebindingscanbefoundintheGlowrepository. About GobindingsforOpenGL(generatedviaglow) Resources Readme License MITLicense Releases Noreleasespublished Packages0 Nopackagespublished Usedby2.4k +2,423 Contributors16 +5contributors Languages C 92.5% Go 7.5% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.
延伸文章資訊
- 1OpenGL with Golang - GitHub
- 2go gl 彩色的三角形
go 彩色三角形. 之前在網上想找一個能渲染顏色的go gl圖形程式設計例子,,找了半天都是白色的三角形。。。於是自己研究了半天,大概是研究出來的 ...
- 3go-gl搭建开发环境(一)_Frank的专栏
go-gl:OpenGL接口的Golang绑定; mathgl:数学计算库; gltext:文字渲染库. 安装过程根据操作系统不同略有区别,Mac OS X和Linux只 ...
- 4Basic Algebra - 第 132 頁 - Google 圖書結果
Let go 1 Gl —> G2 be a homomorphism between groups, let H0 = kergo, let H be a normal subgroup of...
- 5go-gl第一个窗口(二)_Frank的专栏 - CSDN博客
初始化程序首先添加引用的包,包括glfw和go-glimport ( "runtime" ... import ( "runtime" "github.com/go-gl/glfw/v3.2/g...