use of org.lwjgl.opengl.GL30.glBindTexture in project gaiasky by langurmonkey.
the class GaiaSky method create.
@Override
public void create() {
startTime = TimeUtils.millis();
// Log level
Gdx.app.setLogLevel(debugMode ? Application.LOG_DEBUG : Application.LOG_INFO);
Logger.level = debugMode ? Logger.LoggerLevel.DEBUG : Logger.LoggerLevel.INFO;
consoleLogger = new ConsoleLogger();
if (debugMode)
logger.debug("Logging level set to DEBUG");
// Init graphics and window
graphics = Gdx.graphics;
window = headless ? null : ((Lwjgl3Graphics) graphics).getWindow();
// Basic info
logger.info(settings.version.version, I18n.txt("gui.build", settings.version.build));
logger.info("Display mode", graphics.getWidth() + "x" + graphics.getHeight(), "Fullscreen: " + Gdx.graphics.isFullscreen());
logger.info("Device", GL30.glGetString(GL30.GL_RENDERER));
logger.info(I18n.txt("notif.glversion", GL30.glGetString(GL30.GL_VERSION)));
logger.info(I18n.txt("notif.glslversion", GL30.glGetString(GL30.GL_SHADING_LANGUAGE_VERSION)));
logger.info(I18n.txt("notif.javaversion", System.getProperty("java.version"), System.getProperty("java.vendor")));
// Frame buffer map
frameBufferMap = new HashMap<>();
// Disable all kinds of input
EventManager.publish(Event.INPUT_ENABLED_CMD, this, false);
if (!settings.initialized) {
logger.error(new RuntimeException(I18n.txt("notif.error", "global configuration not initialized")));
return;
}
// Initialise times
final ITimeFrameProvider clock = new GlobalClock(1, Instant.now());
final ITimeFrameProvider real = new RealTimeClock();
time = settings.runtime.realTime ? real : clock;
t = 0;
// Initialise i18n
I18n.initialize();
// Tooltips
TooltipManager.getInstance().initialTime = 1f;
TooltipManager.getInstance().hideAll();
// Initialise asset manager
final FileHandleResolver internalResolver = new InternalFileHandleResolver();
final FileHandleResolver dataResolver = fileName -> settings.data.dataFileHandle(fileName);
assetManager = new AssetManager(internalResolver);
assetManager.setLoader(com.badlogic.gdx.graphics.Texture.class, ".pfm", new PFMTextureLoader(dataResolver));
assetManager.setLoader(PFMData.class, new PFMDataLoader(dataResolver));
assetManager.setLoader(ISceneGraph.class, new SGLoader(dataResolver));
assetManager.setLoader(PointCloudData.class, new OrbitDataLoader(dataResolver));
assetManager.setLoader(GaiaAttitudeServer.class, new GaiaAttitudeLoader(dataResolver));
assetManager.setLoader(ExtShaderProgram.class, new ShaderProgramProvider(internalResolver, ".vertex.glsl", ".fragment.glsl"));
assetManager.setLoader(BitmapFont.class, new BitmapFontLoader(internalResolver));
assetManager.setLoader(AtmosphereShaderProvider.class, new AtmosphereShaderProviderLoader<>(internalResolver));
assetManager.setLoader(GroundShaderProvider.class, new GroundShaderProviderLoader<>(internalResolver));
assetManager.setLoader(TessellationShaderProvider.class, new TessellationShaderProviderLoader<>(internalResolver));
assetManager.setLoader(RelativisticShaderProvider.class, new RelativisticShaderProviderLoader<>(internalResolver));
assetManager.setLoader(IntModel.class, ".obj", new OwnObjLoader(new RegularInputStreamProvider(), internalResolver));
assetManager.setLoader(IntModel.class, ".obj.gz", new OwnObjLoader(new GzipInputStreamProvider(), internalResolver));
assetManager.setLoader(IntModel.class, ".g3dj", new G3dModelLoader(new JsonReader(), internalResolver));
assetManager.setLoader(IntModel.class, ".g3db", new G3dModelLoader(new UBJsonReader(), internalResolver));
// Remove Model loaders
// Init global resources
this.globalResources = new GlobalResources(assetManager);
// Initialize screenshots manager
new ScreenshotsManager(globalResources);
// Catalog manager
this.catalogManager = new CatalogManager();
this.scripting = new EventScriptingInterface(this.assetManager, this.catalogManager);
// Initialise master manager
MasterManager.initialize();
// Load slave assets
SlaveManager.load(assetManager);
// Initialise dataset updater
this.executorService = new GaiaSkyExecutorService();
// Bookmarks
this.bookmarksManager = new BookmarksManager();
// Location log
LocationLogManager.initialize();
// Init timer thread
Timer.instance();
// Initialise Cameras
cameraManager = new CameraManager(assetManager, CameraMode.FOCUS_MODE, vr, globalResources);
// Set asset manager to asset bean
AssetBean.setAssetManager(assetManager);
// Create vr context if possible
final VRStatus vrStatus = createVR();
cameraManager.updateFrustumPlanes();
// Tooltip to 1s
TooltipManager.getInstance().initialTime = 1f;
// Initialise Gaia attitudes
assetManager.load(Constants.ATTITUDE_FOLDER, GaiaAttitudeServer.class, new GaiaAttitudeLoaderParameter());
// Initialise hidden helper user
HiddenHelperUser.initialize();
// Initialise gravitational waves helper
RelativisticEffectsManager.initialize(time);
// GUI
guis = new ArrayList<>(3);
// Post-processor
postProcessor = PostProcessorFactory.instance.getPostProcessor();
// Scene graph renderer
sgr = new SceneGraphRenderer(vrContext, globalResources);
sgr.initialize(assetManager);
// Initialise scripting gateway server
if (!noScripting)
ScriptingServer.initialize();
// Tell the asset manager to load all the assets
final Set<AssetBean> assets = AssetBean.getAssets();
for (AssetBean ab : assets) {
ab.load(assetManager);
}
renderBatch = globalResources.getSpriteBatch();
EventManager.instance.subscribe(this, Event.LOAD_DATA_CMD);
welcomeGui = new WelcomeGui(globalResources.getSkin(), graphics, 1f / settings.program.ui.scale, skipWelcome, vrStatus);
welcomeGui.initialize(assetManager, globalResources.getSpriteBatch());
Gdx.input.setInputProcessor(welcomeGui.getGuiStage());
if (settings.runtime.openVr) {
welcomeGuiVR = new VRGui<>(WelcomeGuiVR.class, (int) (settings.graphics.backBufferResolution[0] / 2f), globalResources.getSkin(), graphics, 1f / settings.program.ui.scale);
welcomeGuiVR.initialize(assetManager, globalResources.getSpriteBatch());
}
// GL clear state
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClearDepthf(1f);
}
Aggregations