bullet3/build3/findOpenGLGlewGlut.lua

122 lines
3.7 KiB
Lua
Raw Normal View History

function findOpenGL()
configuration{}
if os.is("Linux") then
return true
end
--assume OpenGL is available on Mac OSX, Windows etc
return true
end
function findOpenGL3()
configuration{}
if os.is("MacOSX") then
local osversion = os.getversion()
--Mac OSX 10.9 and above supports OpenGL 3, below doesn't, so ...
if osversion.majorversion > 10 or (osversion.majorversion == 10 and osversion.minorversion >=9) then
return findOpenGL()
else
return false
end
else
return findOpenGL()
end
end
function initOpenGL()
configuration {}
configuration {"Windows"}
links {"opengl32","glu32"}
configuration {"MacOSX"}
links { "OpenGL.framework"}
configuration {"not Windows", "not MacOSX"}
if os.is("Linux") then
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
links {"GL"}
else
2018-02-21 03:44:02 +00:00
print("No GL/gl.h found, using dynamic loading of GL using glad")
defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
links {"dl"}
end
end
configuration{}
end
improve premake4 build in case X11 headers are missing improve video_sync_mp4.py example allow to create a heightfield from file or programmatically in C++ robotics api. Example: { b3RobotSimulatorCreateCollisionShapeArgs shapeArgs; shapeArgs.m_shapeType = GEOM_HEIGHTFIELD; bool useFile = true; if (useFile) { shapeArgs.m_fileName = "D:/dev/bullet3/data/heightmaps/gimp_overlay_out.png"; shapeArgs.m_meshScale.setValue(.05, .05, 1); } else { shapeArgs.m_numHeightfieldColumns = 256; shapeArgs.m_numHeightfieldRows = 256; shapeArgs.m_meshScale.setValue(.05, .05, 1); shapeArgs.m_heightfieldData.resize(shapeArgs.m_numHeightfieldRows * shapeArgs.m_numHeightfieldColumns); double heightPerturbationRange = 0.05; for (int j = 0; j<int(shapeArgs.m_numHeightfieldColumns / 2); j++) { for (int i = 0; i < (int(shapeArgs.m_numHeightfieldRows / 2)); i++) { double height = ((double)rand() / (RAND_MAX)) * heightPerturbationRange; shapeArgs.m_heightfieldData[2 * i + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; } } } int shape = sim->createCollisionShape(shapeArgs.m_shapeType, shapeArgs); b3RobotSimulatorCreateMultiBodyArgs bodyArgs; bodyArgs.m_baseCollisionShapeIndex = shape; int groundId = sim->createMultiBody(bodyArgs); int texId = sim->loadTexture(shapeArgs.m_fileName); b3RobotSimulatorChangeVisualShapeArgs args; args.m_objectUniqueId = groundId; args.m_linkIndex = -1; args.m_textureUniqueId = texId; sim->changeVisualShape(args); }
2020-07-25 01:09:13 +00:00
function initX11()
if os.is("Linux") then
if _OPTIONS["enable_system_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
links{"X11","pthread"}
else
print("No X11/X.h found, using dynamic loading of X11")
includedirs {
projectRootDir .. "examples/ThirdPartyLibs/optionalX11"
}
defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
links {"dl","pthread"}
end
end
end
function initX11()
if os.is("Linux") then
if _OPTIONS["enable_system_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
links{"X11","pthread"}
else
print("No X11/X.h found, using dynamic loading of X11")
includedirs {
projectRootDir .. "examples/ThirdPartyLibs/optionalX11"
}
defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
links {"dl","pthread"}
end
end
end
function initGlew()
configuration {}
if os.is("Windows") then
configuration {"Windows"}
defines { "GLEW_STATIC"}
includedirs {
2018-02-21 03:44:02 +00:00
projectRootDir .. "examples/ThirdPartyLibs/glad"
}
files { projectRootDir .. "examples/ThirdPartyLibs/glad/gl.c"}
end
if os.is("MacOSX") then
includedirs {
projectRootDir .. "examples/ThirdPartyLibs/glad"
}
files { projectRootDir .. "examples/ThirdPartyLibs/glad/gl.c"}
end
if os.is("Linux") then
configuration{"Linux"}
improve premake4 build in case X11 headers are missing improve video_sync_mp4.py example allow to create a heightfield from file or programmatically in C++ robotics api. Example: { b3RobotSimulatorCreateCollisionShapeArgs shapeArgs; shapeArgs.m_shapeType = GEOM_HEIGHTFIELD; bool useFile = true; if (useFile) { shapeArgs.m_fileName = "D:/dev/bullet3/data/heightmaps/gimp_overlay_out.png"; shapeArgs.m_meshScale.setValue(.05, .05, 1); } else { shapeArgs.m_numHeightfieldColumns = 256; shapeArgs.m_numHeightfieldRows = 256; shapeArgs.m_meshScale.setValue(.05, .05, 1); shapeArgs.m_heightfieldData.resize(shapeArgs.m_numHeightfieldRows * shapeArgs.m_numHeightfieldColumns); double heightPerturbationRange = 0.05; for (int j = 0; j<int(shapeArgs.m_numHeightfieldColumns / 2); j++) { for (int i = 0; i < (int(shapeArgs.m_numHeightfieldRows / 2)); i++) { double height = ((double)rand() / (RAND_MAX)) * heightPerturbationRange; shapeArgs.m_heightfieldData[2 * i + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; } } } int shape = sim->createCollisionShape(shapeArgs.m_shapeType, shapeArgs); b3RobotSimulatorCreateMultiBodyArgs bodyArgs; bodyArgs.m_baseCollisionShapeIndex = shape; int groundId = sim->createMultiBody(bodyArgs); int texId = sim->loadTexture(shapeArgs.m_fileName); b3RobotSimulatorChangeVisualShapeArgs args; args.m_objectUniqueId = groundId; args.m_linkIndex = -1; args.m_textureUniqueId = texId; sim->changeVisualShape(args); }
2020-07-25 01:09:13 +00:00
initX11()
2018-02-22 17:08:10 +00:00
if _OPTIONS["enable_system_glx"] then --# and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/glx.h")) then
improve premake4 build in case X11 headers are missing improve video_sync_mp4.py example allow to create a heightfield from file or programmatically in C++ robotics api. Example: { b3RobotSimulatorCreateCollisionShapeArgs shapeArgs; shapeArgs.m_shapeType = GEOM_HEIGHTFIELD; bool useFile = true; if (useFile) { shapeArgs.m_fileName = "D:/dev/bullet3/data/heightmaps/gimp_overlay_out.png"; shapeArgs.m_meshScale.setValue(.05, .05, 1); } else { shapeArgs.m_numHeightfieldColumns = 256; shapeArgs.m_numHeightfieldRows = 256; shapeArgs.m_meshScale.setValue(.05, .05, 1); shapeArgs.m_heightfieldData.resize(shapeArgs.m_numHeightfieldRows * shapeArgs.m_numHeightfieldColumns); double heightPerturbationRange = 0.05; for (int j = 0; j<int(shapeArgs.m_numHeightfieldColumns / 2); j++) { for (int i = 0; i < (int(shapeArgs.m_numHeightfieldRows / 2)); i++) { double height = ((double)rand() / (RAND_MAX)) * heightPerturbationRange; shapeArgs.m_heightfieldData[2 * i + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + 2 * j * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; shapeArgs.m_heightfieldData[2 * i + 1 + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height; } } } int shape = sim->createCollisionShape(shapeArgs.m_shapeType, shapeArgs); b3RobotSimulatorCreateMultiBodyArgs bodyArgs; bodyArgs.m_baseCollisionShapeIndex = shape; int groundId = sim->createMultiBody(bodyArgs); int texId = sim->loadTexture(shapeArgs.m_fileName); b3RobotSimulatorChangeVisualShapeArgs args; args.m_objectUniqueId = groundId; args.m_linkIndex = -1; args.m_textureUniqueId = texId; sim->changeVisualShape(args); }
2020-07-25 01:09:13 +00:00
links{"pthread"}
2018-02-22 17:08:10 +00:00
print("Using system GL/glx.h")
else
print("Using glad_glx")
defines { "GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
files {
projectRootDir .. "examples/ThirdPartyLibs/glad/glx.c"}
2018-02-22 17:08:10 +00:00
end
print("Using glad and dynamic loading of GL functions")
defines { "GLEW_STATIC"}
includedirs {
2018-02-21 03:44:02 +00:00
projectRootDir .. "examples/ThirdPartyLibs/glad"
}
files { projectRootDir .. "examples/ThirdPartyLibs/glad/gl.c",
projectRootDir .. "examples/ThirdPartyLibs/glad/glx.c"}
links {"dl"}
end
configuration{}
end