Examples

Daniel Limberger edited this page Nov 17, 2016 · 21 revisions

Note: this requires OPTION_BUILD_EXAMPLES=On.

Brief overview of the following globjects examples:

commandlineoutput

commandlineoutput shows the logging capabilities of globjects. The output is:

OpenGL Version:  3.1
OpenGL Vendor:   NVIDIA Corporation
OpenGL Renderer: GeForce GTX 960M/PCIe/SSE2

Test Logging of Standard Types:
  void *      00000013E0B5EDE8 : 00000013E0B5EDE8
  bool                    true : true
  char                     'a' : a
  unsigned char            'a' : a
  const char *         "hello" : hello
  const std::string &  "world" : world
  short                  32767 : 32767
  int               2147483647 : 2147483647
  unsigned integer          23 : 23
  long integer            1337 : 1337
  long long integer 1234567890 : 1234567890
  unsigned long integer  45123 : 45123
  float                3.14159 : 3.14159
  double           3.141592654 : 3.141592654
  long double          2.71828 : 2.71828

Test Logging of Container Types:
  std::array<int, 2> : array(0, 1)
  std::vector<float> : vector(0.1, 0.2, 0.3)

Test Logging of globjects objects:
  Buffer                : Buffer(1)
  Framebuffer           : FrameBufferObject(0)
  Program               : Program(1)
  Query                 : Query(1)
  Renderbuffer          : RenderBufferObject(1)
  Sampler               : Sampler(1)
  Shader                : Shader(2)
  Texture               : Texture(1)
  TransformFeedback     : TransformFeedback(1)
  VertexArray           : VertexArrayObject(1)
  Uniform               : Uniform(Pi, 3.14)
  AbstractUniform       : AbstractUniform(Pi)
  glbinding::Version    : Version 3.1
  std::vector<Buffer *> : vector(Buffer(2), Buffer(3))

computeshader

computeshader shows how compute shader can be loaded and used with globjects. The output is:

compute-shader source image

programpipelines

programpipelines shows how program pipelines can be configured and used with globjects. The output is:

program-pipelines source image

qtexample

qtexample shows how the Qt framework can be used in conjunction with globjects for rendering within a QWindow. Note: OpenGLWindow was introduced in Qt 5.4. The example can be easily adjusted following the instructions on http://doc.qt.io/.

qt-example source image

shaderincludes

shaderincludes shows how globjects can provide a fallback mechanism for specific features of OpenGL. If a context supports shader includes, the native implementation of the OpenGL driver is used. If the context does not support shader includes, globjects fallback implementation is used, which correctly resolves all includes. Either way, if the include can be resolved successfully, the output is:

shader-includes source image

If the include cannot be resolved correctly, the output is:

shader-includes-not-working source image

sparsetexture

sparsetexture shows how to set up a sparse texture using globjects and then map/unmap pages using the ARB_sparse_texture extension. The output is:

sparse-texture source image

ssbo

ssbo shows how shader storage buffer objects can be setup and used with globjects. The output is:

ssbo source image

states

states shows how OpenGL states can be persisted, set, and unset more conveniently using globjects. This is demonstrated for GL_POINT_SIZE and GL_RASTERIZER_DISCARD states. The output is:

states source image

tessellation

tessellation shows an isocahedron (sphere) rendered in various resolutions using OpenGL tessellation with globjects. The output is:

tessellation source image

texture

texture shows a simple texture using globjects. The output is:

texture source image

transformfeedback

transformfeedback shows how transform feedback can be setup using globjects. The output is:

transformfeedback source image

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.