Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A acgl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ACGL
  • acgl
  • Wiki
  • includes in shaders

includes in shaders · Changes

Page history
li created page: includes in shaders authored Nov 26, 2015 by Ming Li's avatar Ming Li
Hide whitespace changes
Inline Side-by-side
includes-in-shaders.md 0 → 100644
View page @ 7019548a
When shader programs are getting complex one might want to minimize redundant code by placing it into separate files. For example a lighting function can be used in multiple programs and even in different types of shaders - e.g. the fragment or vertex shader. To support this, ACGL can import shader files from within other shader files. This is done by a special pragma:
#pragma ACGLimport "filename"
In contrast to C, the imported files don't need an include guard (#ifndef / #define / #endif) and only will get included one time. Imported files can also import other files. The final shader version will be the maximum version of all imported files. Note that the parsing for this does not support explicit contexts for version, e.g. "#version 330 core" might be a problem while just "#version 330" will work fine.
Error messages will state from which included file the error was generated, for example:
Error:
In files:
1 Shader/Foo.fsh
2 Shader/Bar.glsl
1(35) : error C7011: implicit cast from "float" to "vec4"
First we see a list of files contributing to the shader and next we see the error while the first number is the file number and the second the line number.
\ No newline at end of file
Clone repository
  • .vao file format
  • acgl compile time settings
  • acgl versions
  • basic openGL concepts to look up
  • custom shader parser
  • debugging opengl
  • extending acgl
  • external libraries included in acgl
  • faq
  • function overview
  • gamepad
  • getting started
  • Home
  • includes in shaders
  • learning openGL
View All Pages