Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.nio.ByteBuffer;
- import org.lwjgl.BufferUtils;
- import org.lwjgl.LWJGLException;
- import org.lwjgl.opengl.Display;
- import org.lwjgl.opengl.DisplayMode;
- import static org.lwjgl.input.Keyboard.*;
- import static org.lwjgl.opengl.GL11.*;
- /**
- *
- * @author GinjaNinja32
- */
- public class TestPureLWJGL {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws LWJGLException {
- Display.setTitle("Test");
- Display.setDisplayMode(new DisplayMode(800, 600));
- Display.create();
- int texID = glGenTextures();
- ByteBuffer bb = BufferUtils.createByteBuffer(4);
- bb.put((byte)255).put((byte)255).put((byte)255).put((byte)255);
- bb.flip();
- glBindTexture(GL_TEXTURE_2D, texID);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, bb);
- while(!Display.isCloseRequested()) {
- if(Display.wasResized()) {
- glViewport(0, 0, Display.getWidth(), Display.getHeight());
- }
- if(isKeyDown(KEY_O)) {
- Display.setResizable(true);
- } else if(isKeyDown(KEY_L)) {
- Display.setResizable(false);
- }
- glClear(GL_COLOR_BUFFER_BIT);
- glBindTexture(GL_TEXTURE_2D, texID);
- glBegin(GL_QUADS);
- glTexCoord2f(0, 0);
- glVertex2f(-0.9F, -0.9F);
- glTexCoord2f(0, 1);
- glVertex2f(-0.9F, 0.9F);
- glTexCoord2f(1, 1);
- glVertex2f(0.9F, 0.9F);
- glTexCoord2f(1, 0);
- glVertex2f(0.9F, -0.9F);
- glEnd();
- Display.update();
- Display.sync(60);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement