Expand description
Usage
You can import the pointer style loader and type aliases like so:
extern crate gl;
// include the OpenGL type aliases
use gl::types::*;
You can load the function pointers into their respective function pointers
using the load_with
function. You must supply a loader function from your
context library, This is how it would look using [glfw-rs]
(https://github.com/brendanzab/glfw-rs):
// the supplied function must be of the type:
// `&fn(symbol: &str) -> Option<extern "C" fn()>`
gl::load_with(|s| glfw.get_proc_address(s));
// loading a specific function pointer
gl::Viewport::load_with(|s| glfw.get_proc_address(s));
Calling a function that has not been loaded will result in a failure like:
panic!("gl::Viewport was not loaded")
, which aviods a segfault. This feature
does not cause any run time overhead because the failing functions are
assigned only when load_with
is called.
// accessing an enum
gl::TEXTURE_2D;
// calling a function
unsafe { gl::DrawArrays(gl::TRIANGLES, 0, 3) };
// functions that take pointers are unsafe
unsafe { gl::ShaderSource(shader, 1, &c_str, std::ptr::null()) };
Each function pointer has an associated boolean value allowing you to
check if a function has been loaded at run time. The function accesses a
corresponding global boolean that is set when load_with
is called, so there
shouldn’t be much overhead.
if gl::Viewport::is_loaded() {
// do something...
}
Modules
Structs
Constants
Functions
- Fallbacks: ActiveTextureARB
- Fallbacks: AttachObjectARB
- Fallbacks: BeginConditionalRenderNV
- Fallbacks: BeginQueryARB
- Fallbacks: BeginTransformFeedbackEXT, BeginTransformFeedbackNV
- Fallbacks: BindAttribLocationARB
- Fallbacks: BindBufferARB
- Fallbacks: BindBufferBaseEXT, BindBufferBaseNV
- Fallbacks: BindBufferRangeEXT, BindBufferRangeNV
- Fallbacks: BindFragDataLocationEXT
- Fallbacks: BindTextureEXT
- Fallbacks: BindVertexArrayOES
- Fallbacks: BlendColorEXT
- Fallbacks: BlendEquationEXT
- Fallbacks: BlendEquationSeparateEXT
- Fallbacks: BlendEquationSeparateIndexedAMD, BlendEquationSeparateiARB, BlendEquationSeparateiEXT, BlendEquationSeparateiOES
- Fallbacks: BlendEquationIndexedAMD, BlendEquationiARB, BlendEquationiEXT, BlendEquationiOES
- Fallbacks: BlendFuncSeparateEXT, BlendFuncSeparateINGR
- Fallbacks: BlendFuncSeparateIndexedAMD, BlendFuncSeparateiARB, BlendFuncSeparateiEXT, BlendFuncSeparateiOES
- Fallbacks: BlendFuncIndexedAMD, BlendFunciARB, BlendFunciEXT, BlendFunciOES
- Fallbacks: BlitFramebufferEXT, BlitFramebufferNV
- Fallbacks: BufferDataARB
- Fallbacks: BufferStorageEXT
- Fallbacks: BufferSubDataARB
- Fallbacks: CheckFramebufferStatusEXT
- Fallbacks: ClampColorARB
- Fallbacks: ClearDepthfOES
- Fallbacks: ClientWaitSyncAPPLE
- Fallbacks: ColorMaskIndexedEXT, ColorMaskiEXT, ColorMaskiOES
- Fallbacks: CompileShaderARB
- Fallbacks: CompressedTexImage1DARB
- Fallbacks: CompressedTexImage2DARB
- Fallbacks: CompressedTexImage3DARB, CompressedTexImage3DOES
- Fallbacks: CompressedTexSubImage1DARB
- Fallbacks: CompressedTexSubImage2DARB
- Fallbacks: CompressedTexSubImage3DARB, CompressedTexSubImage3DOES
- Fallbacks: CopyBufferSubDataNV
- Fallbacks: CopyImageSubDataEXT, CopyImageSubDataOES
- Fallbacks: CopyTexImage1DEXT
- Fallbacks: CopyTexImage2DEXT
- Fallbacks: CopyTexSubImage1DEXT
- Fallbacks: CopyTexSubImage2DEXT
- Fallbacks: CopyTexSubImage3DEXT, CopyTexSubImage3DOES
- Fallbacks: CreateProgramObjectARB
- Fallbacks: CreateShaderObjectARB
- Fallbacks: DebugMessageCallbackARB, DebugMessageCallbackKHR
- Fallbacks: DebugMessageControlARB, DebugMessageControlKHR
- Fallbacks: DebugMessageInsertARB, DebugMessageInsertKHR
- Fallbacks: DeleteBuffersARB
- Fallbacks: DeleteFramebuffersEXT
- Fallbacks: DeleteQueriesARB
- Fallbacks: DeleteRenderbuffersEXT
- Fallbacks: DeleteSyncAPPLE
- Fallbacks: DeleteTransformFeedbacksNV
- Fallbacks: DeleteVertexArraysAPPLE, DeleteVertexArraysOES
- Fallbacks: DepthRangefOES
- Fallbacks: DetachObjectARB
- Fallbacks: DisableVertexAttribArrayARB
- Fallbacks: DisableIndexedEXT, DisableiEXT, DisableiNV, DisableiOES
- Fallbacks: DrawArraysEXT
- Fallbacks: DrawArraysInstancedANGLE, DrawArraysInstancedARB, DrawArraysInstancedEXT, DrawArraysInstancedNV
- Fallbacks: DrawArraysInstancedBaseInstanceEXT
- Fallbacks: DrawBuffersARB, DrawBuffersATI, DrawBuffersEXT
- Fallbacks: DrawElementsBaseVertexEXT, DrawElementsBaseVertexOES
- Fallbacks: DrawElementsInstancedANGLE, DrawElementsInstancedARB, DrawElementsInstancedEXT, DrawElementsInstancedNV
- Fallbacks: DrawElementsInstancedBaseInstanceEXT
- Fallbacks: DrawElementsInstancedBaseVertexEXT, DrawElementsInstancedBaseVertexOES
- Fallbacks: DrawElementsInstancedBaseVertexBaseInstanceEXT
- Fallbacks: DrawRangeElementsEXT
- Fallbacks: DrawRangeElementsBaseVertexEXT, DrawRangeElementsBaseVertexOES
- Fallbacks: DrawTransformFeedbackNV
- Fallbacks: EnableVertexAttribArrayARB
- Fallbacks: EnableIndexedEXT, EnableiEXT, EnableiNV, EnableiOES
- Fallbacks: EndConditionalRenderNV, EndConditionalRenderNVX
- Fallbacks: EndQueryARB
- Fallbacks: EndTransformFeedbackEXT, EndTransformFeedbackNV
- Fallbacks: FenceSyncAPPLE
- Fallbacks: FlushMappedBufferRangeAPPLE, FlushMappedBufferRangeEXT
- Fallbacks: FramebufferRenderbufferEXT
- Fallbacks: FramebufferTextureARB, FramebufferTextureEXT, FramebufferTextureOES
- Fallbacks: FramebufferTexture1DEXT
- Fallbacks: FramebufferTexture2DEXT
- Fallbacks: FramebufferTexture3DEXT, FramebufferTexture3DOES
- Fallbacks: FramebufferTextureLayerARB, FramebufferTextureLayerEXT
- Fallbacks: GenBuffersARB
- Fallbacks: GenFramebuffersEXT
- Fallbacks: GenQueriesARB
- Fallbacks: GenRenderbuffersEXT
- Fallbacks: GenTransformFeedbacksNV
- Fallbacks: GenVertexArraysAPPLE, GenVertexArraysOES
- Fallbacks: GenerateMipmapEXT
- Fallbacks: GetActiveAttribARB
- Fallbacks: GetActiveUniformARB
- Fallbacks: GetAttribLocationARB
- Fallbacks: GetBooleanIndexedvEXT
- Fallbacks: GetBufferParameterivARB
- Fallbacks: GetBufferPointervARB, GetBufferPointervOES
- Fallbacks: GetBufferSubDataARB
- Fallbacks: GetCompressedTexImageARB
- Fallbacks: GetDebugMessageLogARB, GetDebugMessageLogKHR
- Fallbacks: GetDoubleIndexedvEXT, GetDoublei_vEXT
- Fallbacks: GetFloatIndexedvEXT, GetFloati_vEXT, GetFloati_vNV
- Fallbacks: GetFragDataLocationEXT
- Fallbacks: GetFramebufferAttachmentParameterivEXT
- Fallbacks: GetGraphicsResetStatusKHR
- Fallbacks: GetInteger64vAPPLE
- Fallbacks: GetIntegerIndexedvEXT
- Fallbacks: GetMultisamplefvNV
- Fallbacks: GetObjectLabelKHR
- Fallbacks: GetObjectPtrLabelKHR
- Fallbacks: GetPointervEXT, GetPointervKHR
- Fallbacks: GetProgramBinaryOES
- Fallbacks: GetQueryObjecti64vEXT
- Fallbacks: GetQueryObjectivARB, GetQueryObjectivEXT
- Fallbacks: GetQueryObjectui64vEXT
- Fallbacks: GetQueryObjectuivARB
- Fallbacks: GetQueryivARB
- Fallbacks: GetRenderbufferParameterivEXT
- Fallbacks: GetSamplerParameterIivEXT, GetSamplerParameterIivOES
- Fallbacks: GetSamplerParameterIuivEXT, GetSamplerParameterIuivOES
- Fallbacks: GetShaderSourceARB
- Fallbacks: GetSyncivAPPLE
- Fallbacks: GetTexParameterIivEXT, GetTexParameterIivOES
- Fallbacks: GetTexParameterIuivEXT, GetTexParameterIuivOES
- Fallbacks: GetTransformFeedbackVaryingEXT
- Fallbacks: GetUniformLocationARB
- Fallbacks: GetUniformfvARB
- Fallbacks: GetUniformivARB
- Fallbacks: GetUniformuivEXT
- Fallbacks: GetVertexAttribIivEXT
- Fallbacks: GetVertexAttribIuivEXT
- Fallbacks: GetVertexAttribLdvEXT
- Fallbacks: GetVertexAttribPointervARB, GetVertexAttribPointervNV
- Fallbacks: GetVertexAttribdvARB, GetVertexAttribdvNV
- Fallbacks: GetVertexAttribfvARB, GetVertexAttribfvNV
- Fallbacks: GetVertexAttribivARB, GetVertexAttribivNV
- Fallbacks: GetnUniformfvKHR
- Fallbacks: GetnUniformivKHR
- Fallbacks: GetnUniformuivKHR
- Hint⚠
- Fallbacks: IsBufferARB
- Fallbacks: IsEnabledIndexedEXT, IsEnablediEXT, IsEnablediNV, IsEnablediOES
- Fallbacks: IsFramebufferEXT
- Fallbacks: IsQueryARB
- Fallbacks: IsRenderbufferEXT
- Fallbacks: IsSyncAPPLE
- Fallbacks: IsTransformFeedbackNV
- Fallbacks: IsVertexArrayAPPLE, IsVertexArrayOES
- Fallbacks: LinkProgramARB
- Fallbacks: MapBufferARB, MapBufferOES
- Fallbacks: MapBufferRangeEXT
- Fallbacks: MemoryBarrierEXT
- Fallbacks: MinSampleShadingARB, MinSampleShadingOES
- Fallbacks: MultiDrawArraysEXT
- Fallbacks: MultiDrawArraysIndirectAMD, MultiDrawArraysIndirectEXT
- Fallbacks: MultiDrawElementsEXT
- Fallbacks: MultiDrawElementsBaseVertexEXT, MultiDrawElementsBaseVertexOES
- Fallbacks: MultiDrawElementsIndirectAMD, MultiDrawElementsIndirectEXT
- Fallbacks: NamedBufferStorageEXT
- Fallbacks: NamedBufferSubDataEXT
- Fallbacks: ObjectLabelKHR
- Fallbacks: ObjectPtrLabelKHR
- Fallbacks: PatchParameteriEXT, PatchParameteriOES
- Fallbacks: PauseTransformFeedbackNV
- Fallbacks: PointParameterfARB, PointParameterfEXT, PointParameterfSGIS
- Fallbacks: PointParameterfvARB, PointParameterfvEXT, PointParameterfvSGIS
- Fallbacks: PointParameteriNV
- Fallbacks: PointParameterivNV
- Fallbacks: PolygonModeNV
- Fallbacks: PopDebugGroupKHR
- Fallbacks: ProgramBinaryOES
- Fallbacks: ProgramParameteriARB, ProgramParameteriEXT
- Fallbacks: ProgramUniform1fEXT
- Fallbacks: ProgramUniform1fvEXT
- Fallbacks: ProgramUniform1iEXT
- Fallbacks: ProgramUniform1ivEXT
- Fallbacks: ProgramUniform1uiEXT
- Fallbacks: ProgramUniform1uivEXT
- Fallbacks: ProgramUniform2fEXT
- Fallbacks: ProgramUniform2fvEXT
- Fallbacks: ProgramUniform2iEXT
- Fallbacks: ProgramUniform2ivEXT
- Fallbacks: ProgramUniform2uiEXT
- Fallbacks: ProgramUniform2uivEXT
- Fallbacks: ProgramUniform3fEXT
- Fallbacks: ProgramUniform3fvEXT
- Fallbacks: ProgramUniform3iEXT
- Fallbacks: ProgramUniform3ivEXT
- Fallbacks: ProgramUniform3uiEXT
- Fallbacks: ProgramUniform3uivEXT
- Fallbacks: ProgramUniform4fEXT
- Fallbacks: ProgramUniform4fvEXT
- Fallbacks: ProgramUniform4iEXT
- Fallbacks: ProgramUniform4ivEXT
- Fallbacks: ProgramUniform4uiEXT
- Fallbacks: ProgramUniform4uivEXT
- Fallbacks: ProgramUniformMatrix2fvEXT
- Fallbacks: ProgramUniformMatrix2x3fvEXT
- Fallbacks: ProgramUniformMatrix2x4fvEXT
- Fallbacks: ProgramUniformMatrix3fvEXT
- Fallbacks: ProgramUniformMatrix3x2fvEXT
- Fallbacks: ProgramUniformMatrix3x4fvEXT
- Fallbacks: ProgramUniformMatrix4fvEXT
- Fallbacks: ProgramUniformMatrix4x2fvEXT
- Fallbacks: ProgramUniformMatrix4x3fvEXT
- Fallbacks: ProvokingVertexEXT
- Fallbacks: PushDebugGroupKHR
- Fallbacks: QueryCounterEXT
- Fallbacks: ReadnPixelsARB, ReadnPixelsEXT, ReadnPixelsKHR
- Fallbacks: RenderbufferStorageEXT
- Fallbacks: RenderbufferStorageMultisampleEXT, RenderbufferStorageMultisampleNV
- Fallbacks: ResumeTransformFeedbackNV
- Fallbacks: SampleCoverageARB
- Fallbacks: SamplerParameterIivEXT, SamplerParameterIivOES
- Fallbacks: SamplerParameterIuivEXT, SamplerParameterIuivOES
- Fallbacks: ScissorArrayvNV
- Fallbacks: ScissorIndexedNV
- Fallbacks: ScissorIndexedvNV
- Fallbacks: ShaderSourceARB
- Fallbacks: StencilOpSeparateATI
- Fallbacks: TexBufferARB, TexBufferEXT, TexBufferOES
- Fallbacks: TexBufferRangeEXT, TexBufferRangeOES
- Fallbacks: TexImage3DEXT, TexImage3DOES
- Fallbacks: TexParameterIivEXT, TexParameterIivOES
- Fallbacks: TexParameterIuivEXT, TexParameterIuivOES
- Fallbacks: TexStorage1DEXT
- Fallbacks: TexStorage2DEXT
- Fallbacks: TexStorage3DEXT
- Fallbacks: TexStorage3DMultisampleOES
- Fallbacks: TexSubImage1DEXT
- Fallbacks: TexSubImage2DEXT
- Fallbacks: TexSubImage3DEXT, TexSubImage3DOES
- Fallbacks: TextureViewEXT, TextureViewOES
- Fallbacks: TransformFeedbackVaryingsEXT
- Fallbacks: Uniform1fARB
- Fallbacks: Uniform1fvARB
- Fallbacks: Uniform1iARB
- Fallbacks: Uniform1ivARB
- Fallbacks: Uniform1uiEXT
- Fallbacks: Uniform1uivEXT
- Fallbacks: Uniform2fARB
- Fallbacks: Uniform2fvARB
- Fallbacks: Uniform2iARB
- Fallbacks: Uniform2ivARB
- Fallbacks: Uniform2uiEXT
- Fallbacks: Uniform2uivEXT
- Fallbacks: Uniform3fARB
- Fallbacks: Uniform3fvARB
- Fallbacks: Uniform3iARB
- Fallbacks: Uniform3ivARB
- Fallbacks: Uniform3uiEXT
- Fallbacks: Uniform3uivEXT
- Fallbacks: Uniform4fARB
- Fallbacks: Uniform4fvARB
- Fallbacks: Uniform4iARB
- Fallbacks: Uniform4ivARB
- Fallbacks: Uniform4uiEXT
- Fallbacks: Uniform4uivEXT
- Fallbacks: UniformMatrix2fvARB
- Fallbacks: UniformMatrix2x3fvNV
- Fallbacks: UniformMatrix2x4fvNV
- Fallbacks: UniformMatrix3fvARB
- Fallbacks: UniformMatrix3x2fvNV
- Fallbacks: UniformMatrix3x4fvNV
- Fallbacks: UniformMatrix4fvARB
- Fallbacks: UniformMatrix4x2fvNV
- Fallbacks: UniformMatrix4x3fvNV
- Fallbacks: UnmapBufferARB, UnmapBufferOES
- Fallbacks: UseProgramObjectARB
- Fallbacks: ValidateProgramARB
- Fallbacks: VertexAttrib1dARB, VertexAttrib1dNV
- Fallbacks: VertexAttrib1dvARB, VertexAttrib1dvNV
- Fallbacks: VertexAttrib1fARB, VertexAttrib1fNV
- Fallbacks: VertexAttrib1fvARB, VertexAttrib1fvNV
- Fallbacks: VertexAttrib1sARB, VertexAttrib1sNV
- Fallbacks: VertexAttrib1svARB, VertexAttrib1svNV
- Fallbacks: VertexAttrib2dARB, VertexAttrib2dNV
- Fallbacks: VertexAttrib2dvARB, VertexAttrib2dvNV
- Fallbacks: VertexAttrib2fARB, VertexAttrib2fNV
- Fallbacks: VertexAttrib2fvARB, VertexAttrib2fvNV
- Fallbacks: VertexAttrib2sARB, VertexAttrib2sNV
- Fallbacks: VertexAttrib2svARB, VertexAttrib2svNV
- Fallbacks: VertexAttrib3dARB, VertexAttrib3dNV
- Fallbacks: VertexAttrib3dvARB, VertexAttrib3dvNV
- Fallbacks: VertexAttrib3fARB, VertexAttrib3fNV
- Fallbacks: VertexAttrib3fvARB, VertexAttrib3fvNV
- Fallbacks: VertexAttrib3sARB, VertexAttrib3sNV
- Fallbacks: VertexAttrib3svARB, VertexAttrib3svNV
- Fallbacks: VertexAttrib4NbvARB
- Fallbacks: VertexAttrib4NivARB
- Fallbacks: VertexAttrib4NsvARB
- Fallbacks: VertexAttrib4NubARB, VertexAttrib4ubNV
- Fallbacks: VertexAttrib4NubvARB, VertexAttrib4ubvNV
- Fallbacks: VertexAttrib4NuivARB
- Fallbacks: VertexAttrib4NusvARB
- Fallbacks: VertexAttrib4bvARB
- Fallbacks: VertexAttrib4dARB, VertexAttrib4dNV
- Fallbacks: VertexAttrib4dvARB, VertexAttrib4dvNV
- Fallbacks: VertexAttrib4fARB, VertexAttrib4fNV
- Fallbacks: VertexAttrib4fvARB, VertexAttrib4fvNV
- Fallbacks: VertexAttrib4ivARB
- Fallbacks: VertexAttrib4sARB, VertexAttrib4sNV
- Fallbacks: VertexAttrib4svARB, VertexAttrib4svNV
- Fallbacks: VertexAttrib4ubvARB
- Fallbacks: VertexAttrib4uivARB
- Fallbacks: VertexAttrib4usvARB
- Fallbacks: VertexAttribDivisorANGLE, VertexAttribDivisorARB, VertexAttribDivisorEXT, VertexAttribDivisorNV
- Fallbacks: VertexAttribI1iEXT
- Fallbacks: VertexAttribI1ivEXT
- Fallbacks: VertexAttribI1uiEXT
- Fallbacks: VertexAttribI1uivEXT
- Fallbacks: VertexAttribI2iEXT
- Fallbacks: VertexAttribI2ivEXT
- Fallbacks: VertexAttribI2uiEXT
- Fallbacks: VertexAttribI2uivEXT
- Fallbacks: VertexAttribI3iEXT
- Fallbacks: VertexAttribI3ivEXT
- Fallbacks: VertexAttribI3uiEXT
- Fallbacks: VertexAttribI3uivEXT
- Fallbacks: VertexAttribI4bvEXT
- Fallbacks: VertexAttribI4iEXT
- Fallbacks: VertexAttribI4ivEXT
- Fallbacks: VertexAttribI4svEXT
- Fallbacks: VertexAttribI4ubvEXT
- Fallbacks: VertexAttribI4uiEXT
- Fallbacks: VertexAttribI4uivEXT
- Fallbacks: VertexAttribI4usvEXT
- Fallbacks: VertexAttribIPointerEXT
- Fallbacks: VertexAttribL1dEXT
- Fallbacks: VertexAttribL1dvEXT
- Fallbacks: VertexAttribL2dEXT
- Fallbacks: VertexAttribL2dvEXT
- Fallbacks: VertexAttribL3dEXT
- Fallbacks: VertexAttribL3dvEXT
- Fallbacks: VertexAttribL4dEXT
- Fallbacks: VertexAttribL4dvEXT
- Fallbacks: VertexAttribLPointerEXT
- Fallbacks: VertexAttribPointerARB
- Fallbacks: ViewportArrayvNV
- Fallbacks: ViewportIndexedfNV
- Fallbacks: ViewportIndexedfvNV
- Fallbacks: WaitSyncAPPLE
- Load each OpenGL symbol using a custom load function. This allows for the use of functions like
glfwGetProcAddress
orSDL_GL_GetProcAddress
.