use of org.lwjgl.LWJGLException in project MinecraftForge by MinecraftForge.
the class SplashProgress method start.
public static void start() {
File configFile = new File(Minecraft.getMinecraft().mcDataDir, "config/splash.properties");
File parent = configFile.getParentFile();
if (!parent.exists())
parent.mkdirs();
FileReader r = null;
config = new Properties();
try {
r = new FileReader(configFile);
config.load(r);
} catch (IOException e) {
FMLLog.info("Could not load splash.properties, will create a default one");
} finally {
IOUtils.closeQuietly(r);
}
//Some system do not support this and have weird effects so we need to detect and disable by default.
//The user can always force enable it if they want to take the responsibility for bugs.
//For now macs derp so disable them.
boolean defaultEnabled = !System.getProperty("os.name").toLowerCase().contains("mac");
// Enable if we have the flag, and there's either no optifine, or optifine has added a key to the blackboard ("optifine.ForgeSplashCompatible")
// Optifine authors - add this key to the blackboard if you feel your modifications are now compatible with this code.
enabled = getBool("enabled", defaultEnabled) && ((!FMLClientHandler.instance().hasOptifine()) || Launch.blackboard.containsKey("optifine.ForgeSplashCompatible"));
rotate = getBool("rotate", false);
showMemory = getBool("showMemory", true);
logoOffset = getInt("logoOffset", 0);
backgroundColor = getHex("background", 0xFFFFFF);
fontColor = getHex("font", 0x000000);
barBorderColor = getHex("barBorder", 0xC0C0C0);
barColor = getHex("bar", 0xCB3D35);
barBackgroundColor = getHex("barBackground", 0xFFFFFF);
memoryGoodColor = getHex("memoryGood", 0x78CB34);
memoryWarnColor = getHex("memoryWarn", 0xE6E84A);
memoryLowColor = getHex("memoryLow", 0xE42F2F);
final ResourceLocation fontLoc = new ResourceLocation(getString("fontTexture", "textures/font/ascii.png"));
final ResourceLocation logoLoc = new ResourceLocation(getString("logoTexture", "textures/gui/title/mojang.png"));
final ResourceLocation forgeLoc = new ResourceLocation(getString("forgeTexture", "fml:textures/gui/forge.png"));
final ResourceLocation forgeFallbackLoc = new ResourceLocation("fml:textures/gui/forge.png");
File miscPackFile = new File(Minecraft.getMinecraft().mcDataDir, getString("resourcePackPath", "resources"));
FileWriter w = null;
try {
w = new FileWriter(configFile);
config.store(w, "Splash screen properties");
} catch (IOException e) {
FMLLog.log(Level.ERROR, e, "Could not save the splash.properties file");
} finally {
IOUtils.closeQuietly(w);
}
miscPack = createResourcePack(miscPackFile);
if (!enabled)
return;
// getting debug info out of the way, while we still can
FMLCommonHandler.instance().registerCrashCallable(new ICrashCallable() {
public String call() throws Exception {
return "' Vendor: '" + glGetString(GL_VENDOR) + "' Version: '" + glGetString(GL_VERSION) + "' Renderer: '" + glGetString(GL_RENDERER) + "'";
}
public String getLabel() {
return "GL info";
}
});
CrashReport report = CrashReport.makeCrashReport(new Throwable() {
@Override
public String getMessage() {
return "This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR";
}
@Override
public void printStackTrace(final PrintWriter s) {
s.println(getMessage());
}
@Override
public void printStackTrace(final PrintStream s) {
s.println(getMessage());
}
}, "Loading screen debug info");
System.out.println(report.getCompleteReport());
try {
d = new SharedDrawable(Display.getDrawable());
Display.getDrawable().releaseContext();
d.makeCurrent();
} catch (LWJGLException e) {
e.printStackTrace();
disableSplash(e);
}
//Call this ASAP if splash is enabled so that threading doesn't cause issues later
getMaxTextureSize();
//Thread mainThread = Thread.currentThread();
thread = new Thread(new Runnable() {
private final int barWidth = 400;
private final int barHeight = 20;
private final int textHeight2 = 20;
private final int barOffset = 55;
public void run() {
setGL();
fontTexture = new Texture(fontLoc, null);
logoTexture = new Texture(logoLoc, null, false);
forgeTexture = new Texture(forgeLoc, forgeFallbackLoc);
glEnable(GL_TEXTURE_2D);
fontRenderer = new SplashFontRenderer();
glDisable(GL_TEXTURE_2D);
while (!done) {
ProgressBar first = null, penult = null, last = null;
Iterator<ProgressBar> i = ProgressManager.barIterator();
while (i.hasNext()) {
if (first == null)
first = i.next();
else {
penult = last;
last = i.next();
}
}
glClear(GL_COLOR_BUFFER_BIT);
// matrix setup
int w = Display.getWidth();
int h = Display.getHeight();
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(320 - w / 2, 320 + w / 2, 240 + h / 2, 240 - h / 2, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// mojang logo
setColor(backgroundColor);
glEnable(GL_TEXTURE_2D);
logoTexture.bind();
glBegin(GL_QUADS);
logoTexture.texCoord(0, 0, 0);
glVertex2f(320 - 256, 240 - 256);
logoTexture.texCoord(0, 0, 1);
glVertex2f(320 - 256, 240 + 256);
logoTexture.texCoord(0, 1, 1);
glVertex2f(320 + 256, 240 + 256);
logoTexture.texCoord(0, 1, 0);
glVertex2f(320 + 256, 240 - 256);
glEnd();
glDisable(GL_TEXTURE_2D);
// memory usage
if (showMemory) {
glPushMatrix();
glTranslatef(320 - (float) barWidth / 2, 20, 0);
drawMemoryBar();
glPopMatrix();
}
// bars
if (first != null) {
glPushMatrix();
glTranslatef(320 - (float) barWidth / 2, 310, 0);
drawBar(first);
if (penult != null) {
glTranslatef(0, barOffset, 0);
drawBar(penult);
}
if (last != null) {
glTranslatef(0, barOffset, 0);
drawBar(last);
}
glPopMatrix();
}
angle += 1;
// forge logo
setColor(backgroundColor);
float fw = (float) forgeTexture.getWidth() / 2;
float fh = (float) forgeTexture.getHeight() / 2;
if (rotate) {
float sh = Math.max(fw, fh);
glTranslatef(320 + w / 2 - sh - logoOffset, 240 + h / 2 - sh - logoOffset, 0);
glRotatef(angle, 0, 0, 1);
} else {
glTranslatef(320 + w / 2 - fw - logoOffset, 240 + h / 2 - fh - logoOffset, 0);
}
int f = (angle / 5) % forgeTexture.getFrames();
glEnable(GL_TEXTURE_2D);
forgeTexture.bind();
glBegin(GL_QUADS);
forgeTexture.texCoord(f, 0, 0);
glVertex2f(-fw, -fh);
forgeTexture.texCoord(f, 0, 1);
glVertex2f(-fw, fh);
forgeTexture.texCoord(f, 1, 1);
glVertex2f(fw, fh);
forgeTexture.texCoord(f, 1, 0);
glVertex2f(fw, -fh);
glEnd();
glDisable(GL_TEXTURE_2D);
// We use mutex to indicate safely to the main thread that we're taking the display global lock
// So the main thread can skip processing messages while we're updating.
// There are system setups where this call can pause for a while, because the GL implementation
// is trying to impose a framerate or other thing is occurring. Without the mutex, the main
// thread would delay waiting for the same global display lock
mutex.acquireUninterruptibly();
Display.update();
// As soon as we're done, we release the mutex. The other thread can now ping the processmessages
// call as often as it wants until we get get back here again
mutex.release();
if (pause) {
clearGL();
setGL();
}
Display.sync(100);
}
clearGL();
}
private void setColor(int color) {
glColor3ub((byte) ((color >> 16) & 0xFF), (byte) ((color >> 8) & 0xFF), (byte) (color & 0xFF));
}
private void drawBox(int w, int h) {
glBegin(GL_QUADS);
glVertex2f(0, 0);
glVertex2f(0, h);
glVertex2f(w, h);
glVertex2f(w, 0);
glEnd();
}
private void drawBar(ProgressBar b) {
glPushMatrix();
// title - message
setColor(fontColor);
glScalef(2, 2, 1);
glEnable(GL_TEXTURE_2D);
fontRenderer.drawString(b.getTitle() + " - " + b.getMessage(), 0, 0, 0x000000);
glDisable(GL_TEXTURE_2D);
glPopMatrix();
// border
glPushMatrix();
glTranslatef(0, textHeight2, 0);
setColor(barBorderColor);
drawBox(barWidth, barHeight);
// interior
setColor(barBackgroundColor);
glTranslatef(1, 1, 0);
drawBox(barWidth - 2, barHeight - 2);
// slidy part
setColor(barColor);
// Step can sometimes be 0.
drawBox((barWidth - 2) * (b.getStep() + 1) / (b.getSteps() + 1), barHeight - 2);
// progress text
String progress = "" + b.getStep() + "/" + b.getSteps();
glTranslatef(((float) barWidth - 2) / 2 - fontRenderer.getStringWidth(progress), 2, 0);
setColor(fontColor);
glScalef(2, 2, 1);
glEnable(GL_TEXTURE_2D);
fontRenderer.drawString(progress, 0, 0, 0x000000);
glPopMatrix();
}
private void drawMemoryBar() {
int maxMemory = bytesToMb(Runtime.getRuntime().maxMemory());
int totalMemory = bytesToMb(Runtime.getRuntime().totalMemory());
int freeMemory = bytesToMb(Runtime.getRuntime().freeMemory());
int usedMemory = totalMemory - freeMemory;
float usedMemoryPercent = usedMemory / (float) maxMemory;
glPushMatrix();
// title - message
setColor(fontColor);
glScalef(2, 2, 1);
glEnable(GL_TEXTURE_2D);
fontRenderer.drawString("Memory Used / Total", 0, 0, 0x000000);
glDisable(GL_TEXTURE_2D);
glPopMatrix();
// border
glPushMatrix();
glTranslatef(0, textHeight2, 0);
setColor(barBorderColor);
drawBox(barWidth, barHeight);
// interior
setColor(barBackgroundColor);
glTranslatef(1, 1, 0);
drawBox(barWidth - 2, barHeight - 2);
// slidy part
long time = System.currentTimeMillis();
if (usedMemoryPercent > memoryColorPercent || (time - memoryColorChangeTime > 1000)) {
memoryColorChangeTime = time;
memoryColorPercent = usedMemoryPercent;
}
int memoryBarColor;
if (memoryColorPercent < 0.75f) {
memoryBarColor = memoryGoodColor;
} else if (memoryColorPercent < 0.85f) {
memoryBarColor = memoryWarnColor;
} else {
memoryBarColor = memoryLowColor;
}
setColor(memoryLowColor);
glPushMatrix();
glTranslatef((barWidth - 2) * (totalMemory) / (maxMemory) - 2, 0, 0);
drawBox(2, barHeight - 2);
glPopMatrix();
setColor(memoryBarColor);
drawBox((barWidth - 2) * (usedMemory) / (maxMemory), barHeight - 2);
// progress text
String progress = getMemoryString(usedMemory) + " / " + getMemoryString(maxMemory);
glTranslatef(((float) barWidth - 2) / 2 - fontRenderer.getStringWidth(progress), 2, 0);
setColor(fontColor);
glScalef(2, 2, 1);
glEnable(GL_TEXTURE_2D);
fontRenderer.drawString(progress, 0, 0, 0x000000);
glPopMatrix();
}
private String getMemoryString(int memory) {
return StringUtils.leftPad(Integer.toString(memory), 4, ' ') + " MB";
}
private void setGL() {
lock.lock();
try {
Display.getDrawable().makeCurrent();
} catch (LWJGLException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
glClearColor((float) ((backgroundColor >> 16) & 0xFF) / 0xFF, (float) ((backgroundColor >> 8) & 0xFF) / 0xFF, (float) (backgroundColor & 0xFF) / 0xFF, 1);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
private void clearGL() {
Minecraft mc = Minecraft.getMinecraft();
mc.displayWidth = Display.getWidth();
mc.displayHeight = Display.getHeight();
mc.resize(mc.displayWidth, mc.displayHeight);
glClearColor(1, 1, 1, 1);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, .1f);
try {
Display.getDrawable().releaseContext();
} catch (LWJGLException e) {
e.printStackTrace();
throw new RuntimeException(e);
} finally {
lock.unlock();
}
}
});
thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
FMLLog.log(Level.ERROR, e, "Splash thread Exception");
threadError = e;
}
});
thread.start();
checkThreadState();
}
use of org.lwjgl.LWJGLException in project lwjgl by LWJGL.
the class PbufferTest method render.
private void render() {
if (pbuffer.isBufferLost()) {
System.out.println("Buffer contents lost - will recreate the buffer");
pbuffer.destroy();
try {
pbuffer = new Pbuffer(512, 512, new PixelFormat(), null, null);
initPbuffer();
} catch (LWJGLException e) {
e.printStackTrace();
}
}
try {
pbuffer.makeCurrent();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
// Pbuffer rendering
//clear background
glClear(GL_COLOR_BUFFER_BIT);
// draw white quad
glPushMatrix();
{
glTranslatef(quadPosition.x, quadPosition.y, 0);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
{
glVertex2i(-50, -50);
glVertex2i(50, -50);
glVertex2i(50, 50);
glVertex2i(-50, 50);
}
glEnd();
}
glPopMatrix();
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0);
try {
Display.makeCurrent();
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
// OpenGL window rendering
glClear(GL_COLOR_BUFFER_BIT);
// draw white quad
glPushMatrix();
{
glTranslatef(quadPosition.x, quadPosition.y, 0);
glRotatef(angle, 0.0f, 0.0f, 1.0f);
glColor3f(1.0f, 1.0f, 0.0f);
glBegin(GL_QUADS);
{
glTexCoord2f(0f, 0f);
glVertex2i(-50, -50);
glTexCoord2f(1f, 0f);
glVertex2i(50, -50);
glTexCoord2f(1f, 1f);
glVertex2i(50, 50);
glTexCoord2f(0f, 1f);
glVertex2i(-50, 50);
}
glEnd();
}
glPopMatrix();
}
use of org.lwjgl.LWJGLException in project lwjgl by LWJGL.
the class SyncTest method runTest.
private static void runTest(String[] args) {
if (args.length < 2)
argsError("Insufficient number of arguments.");
int clears = 1;
int timeout = 0;
try {
clears = Integer.parseInt(args[0]);
timeout = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
argsError("Invalid number format.");
}
ContextAttribs ca = new ContextAttribs();
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
DisplayMode displayMode = chooseMode(modes, 1024, 768);
if (displayMode == null)
displayMode = chooseMode(modes, 800, 600);
if (displayMode == null)
displayMode = chooseMode(modes, 640, 480);
if (displayMode == null)
kill("Failed to set an appropriate display mode.");
System.out.println("Setting display mode to: " + displayMode);
Display.setDisplayMode(displayMode);
Display.create(new PixelFormat(8, 24, 0), ca);
} catch (LWJGLException e) {
kill(e.getMessage());
}
System.out.println("\n---------\n");
final String version = glGetString(GL_VERSION);
System.out.println("GL Version: " + version);
System.out.println("ARB_sync: " + GLContext.getCapabilities().GL_ARB_sync);
if (!GLContext.getCapabilities().OpenGL32 && !GLContext.getCapabilities().GL_ARB_sync)
kill("OpenGL3.2 or ARB_sync support is required for this test.");
System.out.println("\n---------\n");
System.out.println("Clearing the framebuffer a gazillion times...");
Random rand = new Random(System.currentTimeMillis());
for (int i = 0; i < clears; i++) {
glClearColor(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
System.out.println("\nWaiting on fence...");
long time = Sys.getTime();
int status = glClientWaitSync(sync, 0, timeout < 0 ? GL_TIMEOUT_IGNORED : timeout * 1000 * 1000);
System.out.println("\nFence sync complete after: " + ((Sys.getTime() - time) / (double) Sys.getTimerResolution()) + " seconds.");
System.out.print("\nWait Status: ");
switch(status) {
case GL_ALREADY_SIGNALED:
System.out.println("ALREADY_SIGNALED");
break;
case GL_CONDITION_SATISFIED:
System.out.println("CONDITION_SATISFIED");
break;
case GL_TIMEOUT_EXPIRED:
System.out.println("TIMEOUT_EXPIRED");
break;
case GL_WAIT_FAILED:
System.out.println("WAIT_FAILED");
break;
default:
System.out.println("Unexpected wait status: 0x" + Integer.toHexString(status));
}
System.out.println("Sync Status: " + (glGetSynci(sync, GL_SYNC_STATUS) == GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED"));
glDeleteSync(sync);
int error = glGetError();
if (error != 0)
System.out.println("\nTest failed with OpenGL error: " + error);
else
System.out.println("\nTest completed successfully.");
}
use of org.lwjgl.LWJGLException in project lwjgl by LWJGL.
the class VersionTest method initialize.
private static void initialize(String[] args) {
if (args.length < 2)
argsError("Insufficient number of arguments");
int majorInput = 1;
int minorInput = 0;
try {
majorInput = Integer.parseInt(args[0]);
minorInput = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
argsError("Invalid number format");
}
ContextAttribs ca = new ContextAttribs(majorInput, minorInput);
if (2 < args.length) {
for (int i = 2; i < args.length; i++) {
if ("core".equalsIgnoreCase(args[i]))
ca = ca.withProfileCore(true);
else if ("compatibility".equalsIgnoreCase(args[i]))
ca = ca.withProfileCompatibility(true);
else if ("es".equalsIgnoreCase(args[i]))
ca = ca.withProfileES(true);
else if ("debug".equalsIgnoreCase(args[i]))
ca = ca.withDebug(true);
else if ("fc".equalsIgnoreCase(args[i]))
ca = ca.withForwardCompatible(true);
else if ("robust".equalsIgnoreCase(args[i]))
ca = ca.withRobustAccess(true);
else if ("reset_isolation".equalsIgnoreCase(args[i]))
ca = ca.withContextResetIsolation(true);
else if ("reset_lose".equalsIgnoreCase(args[i]))
ca = ca.withResetNotificationStrategy(ContextAttribs.LOSE_CONTEXT_ON_RESET_ARB);
else if ("release_none".equalsIgnoreCase(args[i]))
ca = ca.withContextReleaseBehavior(ContextAttribs.CONTEXT_RELEASE_BEHAVIOR_NONE_ARB);
else if (Pattern.matches("[0-9]+", args[i]))
ca = ca.withLayer(Integer.parseInt(args[i]));
else
argsError("Unknown argument: \'" + args[i] + "\'");
}
}
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
DisplayMode displayMode;
displayMode = chooseMode(modes, 1024, 768);
if (displayMode == null)
displayMode = chooseMode(modes, 800, 600);
if (displayMode == null)
displayMode = chooseMode(modes, 640, 480);
if (displayMode == null)
kill("Failed to set an appropriate display mode.");
System.out.println("Setting display mode to: " + displayMode);
Display.setDisplayMode(displayMode);
Display.create(new PixelFormat(8, 24, 0), ca);
} catch (LWJGLException e) {
kill(e.getMessage());
}
System.out.println("\n---------\n");
System.out.println("Requested " + ca);
final String version = glGetString(GL_VERSION);
boolean deprecated = false;
try {
glVertex3f(0.0f, 0.0f, 0.0f);
Util.checkGLError();
deprecated = true;
} catch (Throwable t) {
}
final StringTokenizer version_tokenizer = new StringTokenizer(version, ". ");
int majorVersion = Integer.parseInt(version_tokenizer.nextToken());
int minorVersion = Integer.parseInt(version_tokenizer.nextToken());
final boolean compatibilityProfile;
final boolean coreProfile;
if (3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion)) {
final int profileMask = glGetInteger(GL_CONTEXT_PROFILE_MASK);
compatibilityProfile = (profileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
coreProfile = (profileMask & GL_CONTEXT_CORE_PROFILE_BIT) != 0;
} else {
compatibilityProfile = false;
coreProfile = false;
}
System.out.println("\nGL_VERSION returned : " + version);
System.out.println("\tCore profile: " + coreProfile);
System.out.println("\tCompatibility profile: " + compatibilityProfile);
System.out.println("ARB_compatibility present: " + GLContext.getCapabilities().GL_ARB_compatibility);
System.out.println("Deprecated functionality present: " + deprecated);
if (!deprecated && GLContext.getCapabilities().GL_ARB_compatibility)
System.out.println("\tARB_compatibility is present, but LWJGL has enabled pseudo-forward compatible mode.");
System.out.println("\n---------");
boolean success = false;
boolean check;
if (majorInput < 3 || (majorInput == 3 && minorInput == 0)) {
System.out.println("\nA version less than or equal to 3.0 is requested, the context\n" + "returned may implement any of the following versions:");
System.out.println("\n1) Any version no less than that requested and no greater than 3.0.");
check = // Satisfies requested version
(majorInput < majorVersion || (majorInput == majorVersion && minorInput <= minorVersion)) && // 3.0 or earlier
(majorVersion < 3 || (majorVersion == 3 && minorVersion == 0));
System.out.println("\t" + check);
success |= check;
System.out.println("\n2) Version 3.1, if the GL_ARB_compatibility extension is also implemented.");
check = majorVersion == 3 && minorVersion == 1 && GLContext.getCapabilities().GL_ARB_compatibility;
System.out.println("\t" + check);
success |= check;
System.out.println("\n3) The compatibility profile of version 3.2 or greater.");
// No need to check version, profiles are only available with 3.2+.
check = compatibilityProfile;
System.out.println("\t" + check);
success |= check;
System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED"));
if (!success && ca.isForwardCompatible())
System.out.println("\t(probably because the forward compatible flag was set)");
} else if (majorInput == 3 && minorInput == 1) {
System.out.println("\nVersion 3.1 is requested, the context returned may implement\n" + "any of the following versions:");
System.out.println("\n1) Version 3.1. The GL_ARB_compatibility extension may or may not\n" + "be implemented, as determined by the implementation.");
check = majorVersion == 3 && minorVersion == 1;
System.out.println("\t" + check);
success |= check;
System.out.println("\n2) The core profile of version 3.2 or greater.");
// No need to check version, profiles are only available with 3.2+.
check = coreProfile;
System.out.println("\t" + check);
success |= check;
System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED"));
} else {
System.out.println("\nVersion 3.2 or greater is requested, the context returned may\n" + "implement any of the following versions:");
System.out.println("\n1) The requested profile of the requested version.");
check = majorInput == majorVersion && minorInput == minorVersion && (!ca.isProfileCompatibility() || compatibilityProfile) && (!ca.isProfileCore() || coreProfile);
System.out.println("\t" + check);
success |= check;
System.out.println("\n2) The requested profile of any later version, so long as no\n" + "features have been removed from that later version and profile.");
check = majorInput < majorVersion || (majorInput == majorVersion && minorInput < minorVersion) && (!ca.isProfileCompatibility() || compatibilityProfile) && (!ca.isProfileCore() || coreProfile);
System.out.println("\t" + check);
success |= check;
System.out.println("\nTEST " + (success ? "SUCCEEDED" : "FAILED"));
}
}
use of org.lwjgl.LWJGLException in project lwjgl by LWJGL.
the class Controllers method create.
/**
* Initialise the controllers collection
*
* @throws LWJGLException Indicates a failure to initialise the controller library.
*/
public static void create() throws LWJGLException {
if (created)
return;
try {
ControllerEnvironment env = ControllerEnvironment.getDefaultEnvironment();
net.java.games.input.Controller[] found = env.getControllers();
ArrayList<net.java.games.input.Controller> lollers = new ArrayList<net.java.games.input.Controller>();
for (net.java.games.input.Controller c : found) {
if ((!c.getType().equals(net.java.games.input.Controller.Type.KEYBOARD)) && (!c.getType().equals(net.java.games.input.Controller.Type.MOUSE))) {
lollers.add(c);
}
}
for (net.java.games.input.Controller c : lollers) {
createController(c);
}
created = true;
} catch (Throwable e) {
throw new LWJGLException("Failed to initialise controllers", e);
}
}
Aggregations