本文整理汇总了Java中org.lwjgl.LWJGLException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java LWJGLException.printStackTrace方法的具体用法?Java LWJGLException.printStackTrace怎么用?Java LWJGLException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.LWJGLException
的用法示例。
在下文中一共展示了LWJGLException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
@Override
public void init() {
if (!AL.isCreated()) {
try {
AL.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
allSources = new IntArray(SIMULTANEOUS_SOURCES_COUNT);
for (int i = 0; i < SIMULTANEOUS_SOURCES_COUNT; i++) {
int sourceID = AL10.alGenSources();
if (AL10.alGetError() == AL10.AL_NO_ERROR) {
allSources.add(sourceID);
}
}
idleSources = new IntArray(allSources);
recentSounds = new SoundPoolImpl[SIMULTANEOUS_SOURCES_COUNT];
AL10.alListener(AL10.AL_ORIENTATION, orientation);
AL10.alListener(AL10.AL_VELOCITY, velocity);
AL10.alListener(AL10.AL_POSITION, position);
}
}
示例2: main
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public static void main(String... args){
System.setProperty("org.lwjgl.librarypath", new File("native/"+(System.getProperties().getProperty("os.name").split(" ")[0]).toLowerCase()).getAbsolutePath());
FreeWorld.getFreeWorld();
try {
Display.setTitle(FreeWorld.getFreeWorld().getTitle());
Display.setDisplayMode(new DisplayMode(720, 480));
Display.setResizable(true);
Display.create();
}catch (LWJGLException e){
e.printStackTrace();
}
//TODO: Provisoire
glClearColor(0.2f, 0.7f, 0.7f, 1.0f);
FreeWorld.getFreeWorld().start();
}
示例3: pause
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
/**
* Call before you need to explicitly modify GL context state during loading.
* Resource loading doesn't usually require this call.
* Call {@link #resume()} when you're done.
* @deprecated not a stable API, will break, don't use this yet
*/
@Deprecated
public static void pause()
{
if(!enabled) return;
checkThreadState();
pause = true;
lock.lock();
try
{
d.releaseContext();
Display.getDrawable().makeCurrent();
}
catch (LWJGLException e)
{
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例4: Window
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
this.fpsCap = settings.getFpsCap();
try {
getSuitableFullScreenModes();
DisplayMode resolution = getStartResolution(settings);
Display.setInitialBackground(1, 1, 1);
this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
setResolution(resolution, settings.isFullScreen());
if (settings.hasIcon()) {
Display.setIcon(settings.getIcon());
}
Display.setVSyncEnabled(settings.isvSync());
Display.setTitle(settings.getTitle());
Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例5: createDisplay
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
/**
* Creates display for program, sets title and size among other things.
*/
public static void createDisplay() {
ContextAttribs attribs = new ContextAttribs(3, 3).withForwardCompatible(true).withProfileCore(true);
try {
Display.setDisplayMode(new DisplayMode(Reference.WINDOW_SIZE.width, Reference.WINDOW_SIZE.height));
Display.create(new PixelFormat().withSamples(8).withDepthBits(24), attribs);
Display.setTitle(Reference.WINDOW_TITLE);
GL11.glEnable(GL13.GL_MULTISAMPLE);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, Reference.WINDOW_SIZE.width, Reference.WINDOW_SIZE.height);
Log.setVerbose(false);
lastFrameTime = getCurrentTime();
}
示例6: start
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
/**
* Start the game container
*
* @throws Exception Failure to create display
*/
public void start() throws Exception {
Display.setParent(displayParent);
Display.setVSyncEnabled(true);
try {
createDisplay();
} catch (LWJGLException e) {
e.printStackTrace();
// failed to create Display, apply workaround (sleep for 1 second) and try again
Thread.sleep(1000);
createDisplay();
}
initGL();
displayParent.requestFocus();
container.runloop();
}
示例7: BeginSession
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public static void BeginSession(){
Display.setTitle(TITLE);
try {
Display.setDisplayMode(new DisplayMode(WIDTH + MENU_WIDTH, HEIGHT));
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WIDTH + MENU_WIDTH, HEIGHT, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
示例8: initGL
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
/**
* Initialise the GL display
*
* @param width The width of the display
* @param height The height of the display
*/
private void initGL(int width, int height) {
try {
Display.setDisplayMode(new DisplayMode(width,height));
Display.create();
Display.setVSyncEnabled(true);
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glClearDepth(1);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glViewport(0,0,width,height);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, width, height, 0, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
示例9: show
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
@Override
public void show()
{
try
{
Mouse.setNativeCursor(cursor);
}
catch (LWJGLException e)
{
e.printStackTrace();
}
}
示例10: setResolution
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public void setResolution(DisplayMode resolution, boolean fullscreen) {
try {
Display.setDisplayMode(resolution);
this.resolution = resolution;
if (fullscreen && resolution.isFullscreenCapable()) {
Display.setFullscreen(true);
this.fullScreen = fullscreen;
}
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例11: Simulator
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public Simulator() {
try {
window = new SimulatorWindow(this);
} catch (LWJGLException e) {
e.printStackTrace();
}
}
示例12: AltBoot
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public AltBoot() {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("Minecraft 2D");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
grid = new BlockGrid();
grid.setAt(10, 10, BlockType.STONE);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
while (!Display.isCloseRequested()) {
// Render Code here
glClear(GL_COLOR_BUFFER_BIT);
input();
grid.draw();
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
示例13: main
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public static void main(String[] args) {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("I don't get it");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
// exit code 1 : failure
System.exit(1);
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
while (!Display.isCloseRequested()) {
// Clears a 2D Canvas.
glClear(GL_COLOR_BUFFER_BIT);
/* ">>" denotes a possibly modified piece of OpenGL documentation (http://www.opengl.org/sdk/docs/man/)
>> glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives.
>> glBegin accepts a single argument that specifies how the vertices are interpreted.
All upcoming vertex calls will be taken as points of a quadrilateral until glEnd is called. Since
this primitive requires four vertices, we will have to call glVertex four times. */
// glBegin() takes an integer as a parameter.
// all of the set commands are constants
// GL_POINTS, GL_LINES, GL_TRIANGLES, GL_QUADS, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, and GL_POLYGONS
// Don't use GL_QUADS or GL_POLYGONS, as they have been deprecated.
glBegin(GL_QUADS);
// >> glVertex commands are used within glBegin/glEnd pairs to specify point, line, and polygon vertices.
// >> glColor sets the current color. (All subsequent calls to glVertex will be assigned this color)
// >> The number after 'glVertex'/'glColor' indicates the amount of components. (xyzw/rgba)
// >> The character after the number indicates the type of arguments.
// >> (for 'glVertex' = d: Double, f: Float, i: Integer)
// >> (for 'glColor' = d: Double, f: Float, b: Signed Byte, ub: Unsigned Byte)
// glVertex() takes its parameters as its location.
// glColor() takes its parameters and makes it a color.
glColor3f(1.0f, 0.0f, 0.0f); // Pure Green
glVertex2i(0, 0); // Upper-left
glColor3b((byte)0, (byte)127, (byte)0); // Pure Red
glVertex2d(640, 0); // Upper-right
glColor3ub((byte)255, (byte)0, (byte)255); // Purple
glVertex2f(640.0f, 480.0f); // Bottom-right
glColor3d(0, 0, 1); // Pure Blue
glVertex2i(0, 480); // Bottom-left
glEnd();
// refresh display and poll input
Display.update();
// Maintain a 60fps frame rate
Display.sync(60);
}
Display.destroy();
// exit code 0 : success!
System.exit(0);
}
示例14: ImmediateMode
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
private ImmediateMode() {
try {
Display.setDisplayMode(new DisplayMode(640, 480));
Display.setTitle("Immediate Mode");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 640, 480, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
while (!Display.isCloseRequested()) {
// Render Code here
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS); // Denotes Immediate Mode
glVertex2i(400, 400);
glVertex2i(450, 400);
glVertex2i(450, 450);
glVertex2i(400, 450);
glEnd(); // Denotes Immediate Mode
glBegin(GL_LINES); // Denotes Immediate Mode
glVertex2i(400, 400);
glVertex2i(400, 800);
glEnd(); // Denotes Immediate Mode
glBegin(GL_TRIANGLES);
glColor3f(100, 0,0);
glVertex2f(-50.5f, -50.5f);
glColor3f(0, 1,0);
glVertex2f(50.5f, -50.5f);
glColor3f(0, 0,1);
glVertex2f(50.5f, 50.5f);
glEnd();
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}
示例15: main
import org.lwjgl.LWJGLException; //导入方法依赖的package包/类
public static void main(String[] args) {
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.setTitle("Input");
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
Display.destroy();
// exit code 1 : failure
System.exit(1);
}
shapes.add(new Box(15, 15));
shapes.add(new Box(150, 150));
shapes.add(new Box(5, 15));
shapes.add(new Box(10, 150));
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
while (!Display.isCloseRequested()) {
// Render Data
glClear(GL_COLOR_BUFFER_BIT);
if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
Display.destroy();
System.exit(0);
}
for (final Box box : shapes) {
if (Mouse.isButtonDown(0) && box.inBounds(Mouse.getX(), 480 - Mouse.getY()) && !somethingIsSelected) {
somethingIsSelected = true;
box.selected = true;
}
if (Mouse.isButtonDown(2) && box.inBounds(Mouse.getX(), 480 - Mouse.getY()) && !somethingIsSelected) {
if ((System.currentTimeMillis() - lastColourChange) >= 200) {
box.randomizeColors();
lastColourChange = System.currentTimeMillis();
}
}
if (Mouse.isButtonDown(1)) {
box.selected = false;
somethingIsSelected = false;
}
if (box.selected) {
box.update(Mouse.getDX(), -Mouse.getDY());
}
box.draw();
}
Display.update();
Display.sync(60);
}
Display.destroy();
System.exit(0);
}