I have recently started in LWJGL and I have created a simple line and a line, but this line sparkles And I know that possibly from
(Display.ScocServated ()) {Display.update (); }
The section remains fresh, but if I delete this part and a Display.update ();
is added after the line is created, the window opens for one second and closes here the whole code is:
package gaming; Import org.lwjgl.LWJGLException; Import org.lwjgl.opengl.Display; Import org.lwjgl.opengl.DisplayMode; Import org.lwjgl.opengl.gl11; Public Square Games {Public Fixed Zero Set GL () {GL11.glMatrixMode (GL11.GL_PROJECTION); GL11.glLoadIdentity (); GL11.glOrtho (0, Display.getWidth (), 0, Display.getHeight (), -1, 1); GL11.glMatrixMode (GL11.GL_MODELVIEW); } Public game (int w, int h) {try {display.setDisplayMode (new display mode (800, 600)); Display.create (); SetGL (); GL11.glColor3d (0.25, 0.75, 0.50); GL11.glClear (GL11.GL_COLOR_BUFFER_BIT); GL11.glBegin (GL11.GL_LINES); GL11.glVertex2i (100, 100); GL11.glVertex2i (200, 200); Display.update (); GL11.glEnd (); While (! Display.isCloseRequested ()) {Display.update (); } While (Display.isCloseRequested ()) {Display.destroy (); }} Catch (LWJLoxception E) {// Todo Auto-Generated Catch Block e.printStackTrace (); }} Public static zero main (string [] args) {new game (800, 600); }}
You have to call your constructor in the main method
< Ex> import java.awt.Dimension; Import java.awt.event.ActionEvent; Import java.awt.event.ActionListener; Import javax.swing.JFrame; Import javax.swing.JOptionPane; Import javax.swing.Timer; Public square supporter 6 JFrame {Public Stable Timer T; Public Pro 6 () {System.out.println ("Halo"); T = new timer (5000, new exclamationist) {@ Override Public Voed Action Crossover (Action Event E) {// Tudo Auto-Generated Method Stub Generation.pd. Shomos Dialliag (empty, "This is a new message.");} }); T.start (); Set size (new dimension (200, 60)); SetDefaultCloseOperation (DISPOSE_ON_CLOSE); } Public static zero main (string [] args) {// TODO Auto-Generated Method Stub New Pro6 () Setwhole (true); }}
Comments
Post a Comment