Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ptr ¶
Ptr takes a slice or pointer (to a singular scalar value or the first element of an array or slice) and returns its GL-compatible address.
For example:
var data []uint8 ... gl.TexImage2D(gl.TEXTURE_2D, ..., gl.UNSIGNED_BYTE, gl.Ptr(&data[0]))
func PtrToSlice ¶ added in v1.4.0
PtrToSlice in short is an equvalent to `unsafe.Slice(x, length)`. It allows to restore imgui data presented in form of a pointer to a Go slice. Reference issue: https://github.com/AllenDang/cimgui-go/issues/160#issuecomment-2768647950 Example usage:
Consider you have sortSpecs := imgui.TableGetSortSpecs() Now, because sortSpecs is of type *imgui.TableSortSpecs, you can't directly convert it to the slice (this is NOT supposed to be slice - this is a pointer to the GO type). You need to extract raw C pointer which is sortSpecs.CData. After calling PtrToSLice(imgui.TableSortSpecs.CData, int(sortSpecs.Count)), you will need to call NewTableSortSpecsFromC on every element to get something useful.
func SliceToPtr ¶
func SliceToPtr[T any](slice []T) *T
SliceToPtr takes a slice and returns its C-compatible pointer.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.