void myHandleErrors() { TwHandleErrors(HandleError); }
void rendering::InitializeTweakBars() { TwInit(TW_OPENGL_CORE, nullptr); // Initializing AntTweakBar library TwHandleErrors(TweakBarErrorHandler); #ifdef OPEN_GL_PROPERTIES_TWEAK_BAR TwEnumVal blendSFactorEV[] = { { GL_ZERO, "GL_ZERO" }, { GL_ONE, "GL_ONE" }, { GL_SRC_COLOR, "GL_SRC_COLOR" }, { GL_ONE_MINUS_SRC_COLOR, "GL_ONE_MINUS_SRC_COLOR" }, { GL_DST_COLOR, "GL_DST_COLOR" }, { GL_ONE_MINUS_DST_COLOR, "GL_ONE_MINUS_DST_COLOR" }, { GL_SRC_ALPHA, "GL_SRC_ALPHA" }, { GL_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_ALPHA" }, { GL_DST_ALPHA, "GL_DST_ALPHA" }, { GL_ONE_MINUS_DST_ALPHA, "GL_ONE_MINUS_DST_ALPHA" }, { GL_CONSTANT_COLOR, "GL_CONSTANT_COLOR" }, { GL_ONE_MINUS_CONSTANT_COLOR, "GL_ONE_MINUS_CONSTANT_COLOR" }, { GL_CONSTANT_ALPHA, "GL_CONSTANT_ALPHA" }, { GL_ONE_MINUS_CONSTANT_ALPHA, "GL_ONE_MINUS_CONSTANT_ALPHA" }, { GL_SRC_ALPHA_SATURATE, "GL_SRC_ALPHA_SATURATE" }, { GL_SRC1_COLOR, "GL_SRC1_COLOR" }, { GL_ONE_MINUS_SRC1_COLOR, "GL_ONE_MINUS_SRC1_COLOR" }, { GL_SRC1_ALPHA, "GL_SRC1_ALPHA" }, { GL_ONE_MINUS_SRC1_ALPHA, "GL_ONE_MINUS_SRC1_ALPHA" }}; const TwType glBlendSFactorEnumType = TwDefineEnum("Blending S Factor", blendSFactorEV, 19); TwEnumVal blendDFactorEV[] = { { GL_ZERO, "GL_ZERO" }, { GL_ONE, "GL_ONE" }, { GL_SRC_COLOR, "GL_SRC_COLOR" }, { GL_ONE_MINUS_SRC_COLOR, "GL_ONE_MINUS_SRC_COLOR" }, { GL_DST_COLOR, "GL_DST_COLOR" }, { GL_ONE_MINUS_DST_COLOR, "GL_ONE_MINUS_DST_COLOR" }, { GL_SRC_ALPHA, "GL_SRC_ALPHA" }, { GL_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_ALPHA" }, { GL_DST_ALPHA, "GL_DST_ALPHA" }, { GL_ONE_MINUS_DST_ALPHA, "GL_ONE_MINUS_DST_ALPHA" }, { GL_CONSTANT_COLOR, "GL_CONSTANT_COLOR" }, { GL_ONE_MINUS_CONSTANT_COLOR, "GL_ONE_MINUS_CONSTANT_COLOR" }, { GL_CONSTANT_ALPHA, "GL_CONSTANT_ALPHA" }, { GL_ONE_MINUS_CONSTANT_ALPHA, "GL_ONE_MINUS_CONSTANT_ALPHA" } }; const TwType glBlendDFactorEnumType = TwDefineEnum("Blending D Factor", blendDFactorEV, 14); TwEnumVal colorLogicOperationCodeEV[] = { { GL_CLEAR, "GL_CLEAR" }, { GL_SET, "GL_SET" }, { GL_COPY, "GL_COPY" }, { GL_COPY_INVERTED, "GL_COPY_INVERTED" }, { GL_NOOP, "GL_NOOP" }, { GL_INVERT, "GL_INVERT" }, { GL_AND, "GL_AND" }, { GL_NAND, "GL_NAND" }, { GL_OR, "GL_OR" }, { GL_NOR, "GL_NOR" }, { GL_XOR, "GL_XOR" }, { GL_EQUIV, "GL_EQUIV" }, { GL_AND_REVERSE, "GL_AND_REVERSE" }, { GL_AND_INVERTED, "GL_AND_INVERTED" }, { GL_OR_REVERSE, "GL_OR_REVERSE" }, { GL_OR_INVERTED, "GL_OR_INVERTED" } }; const TwType glColorLogicOperationCodeEnumType = TwDefineEnum("Logic operation code", colorLogicOperationCodeEV, 16); TwEnumVal cullFaceModeEV[] = { { GL_FRONT, "GL_FRONT" }, { GL_BACK, "GL_BACK" }, { GL_FRONT_AND_BACK, "GL_FRONT_AND_BACK" } }; const TwType glCullFaceModeEnumType = TwDefineEnum("Cull face mode", cullFaceModeEV, 3); TwEnumVal depthTestFuncEV[] = { { GL_NEVER, "GL_NEVER" }, { GL_LESS, "GL_LESS" }, { GL_EQUAL, "GL_EQUAL" }, { GL_LEQUAL, "GL_LEQUAL" }, { GL_GREATER, "GL_GREATER" }, { GL_NOTEQUAL, "GL_NOTEQUAL" }, { GL_GEQUAL, "GL_GEQUAL" }, { GL_ALWAYS, "GL_ALWAYS" } }; const TwType glDepthTestFuncEnumType = TwDefineEnum("Depth test function", depthTestFuncEV, 8); TwEnumVal frontFaceEV[] = { { GL_CW, "GL_CW" }, { GL_CCW, "GL_CCW" } }; const TwType glFrontFaceEnumType = TwDefineEnum("Front face", frontFaceEV, 2); TwBar* glPropertiesBar = TwNewBar("OpenGLPropertiesBar"); TwAddVarRW(glPropertiesBar, "blendEnabled", TW_TYPE_BOOLCPP, &glBlendEnabled, " label='Enabled' group='Blending' "); TwAddVarRW(glPropertiesBar, "blendSFactor", glBlendSFactorEnumType, &glBlendSfactor, " label='S factor' group='Blending' "); TwAddVarRW(glPropertiesBar, "blendDFactor", glBlendDFactorEnumType, &glBlendDfactor, " label='D factor' group='Blending' "); TwAddVarRW(glPropertiesBar, "logicOperationEnabled", TW_TYPE_BOOLCPP, &glColorLogicOperationEnabled, " label='Enabled' group='Color logic operation' "); TwAddVarRW(glPropertiesBar, "logicOperationCode", glColorLogicOperationCodeEnumType, &glColorLogicOperationCode, " label='Code' group='Color logic operation' "); TwAddVarRW(glPropertiesBar, "cullFaceEnabled", TW_TYPE_BOOLCPP, &glCullFaceEnabled, " label='Enabled' group='Face culling' "); TwAddVarRW(glPropertiesBar, "cullFaceMode", glCullFaceModeEnumType, &glCullFaceMode, " label='Mode' group='Face culling' "); TwAddVarRW(glPropertiesBar, "depthClampingEnabled", TW_TYPE_BOOLCPP, &glDepthClampEnabled, " label='Enabled' group='Depth clamp' "); TwAddVarRW(glPropertiesBar, "depthTestEnabled", TW_TYPE_BOOLCPP, &glDepthTestEnabled, " label='Enabled' group='Depth test' "); TwAddVarRW(glPropertiesBar, "depthTestFunction", glDepthTestFuncEnumType, &glDepthTestFunc, " label='Function' group='Depth test' "); TwAddVarRW(glPropertiesBar, "depthRangeNearValue", TW_TYPE_REAL, &glDepthRangeNearValue, " label='Range near value' group='Depth test' step=0.01 min=0.0 max=1.0 "); TwAddVarRW(glPropertiesBar, "depthRangeFarValue", TW_TYPE_REAL, &glDepthRangeFarValue, " label='Range far value' group='Depth test' step=0.01 min=0.0 max=1.0 "); TwAddVarRW(glPropertiesBar, "ditheringEnabled", TW_TYPE_BOOLCPP, &glDitheringEnabled, " label='Enabled' group='Dithering' "); TwAddVarRW(glPropertiesBar, "frontFace", glFrontFaceEnumType, &glFrontFaceMode, " label='Front face' "); TwAddVarRW(glPropertiesBar, "scissorTestEnabled", TW_TYPE_BOOLCPP, &glScissorTestEnabled, " label='Enabled' group='Scissor test' "); TwAddVarRW(glPropertiesBar, "scissorTestLeftCornerX", TW_TYPE_INT32, &glScissorBoxLowerLeftCornerX, " label='Left corner X' group='Scissor test' "); TwAddVarRW(glPropertiesBar, "scissorTestLeftCornerY", TW_TYPE_INT32, &glScissorBoxLowerLeftCornerY, " label='Left corner Y' group='Scissor test' "); TwAddVarRW(glPropertiesBar, "scissorTestBoxWidth", TW_TYPE_INT32, &glScissorBoxWidth, " label='Box width' group='Scissor test' min=50"); TwAddVarRW(glPropertiesBar, "scissorTestBoxHeight", TW_TYPE_INT32, &glScissorBoxHeight, " label='Box height' group='Scissor test' min=50"); TwSetParam(glPropertiesBar, nullptr, "visible", TW_PARAM_CSTRING, 1, "false"); // Hide the bar at startup #endif }