0

I am making a pong game to up my knowledge in game programming. I'm stuck on getting to move vertexes. I made a simple cube to try and figure it out. Nothing came to mind.

Here's my code: package com.pong.game;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11
public class Main {

    private static final int WIDTH = 800;
    private static final int HEIGHT = 600;

    public void start() {
        try {
            Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
            Display.create();

        } catch (LWJGLException e) {
            e.printStackTrace();
            System.exit(0);
        }
        while (!Display.isCloseRequested()) {

            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GL11.glOrtho(0, 800, 0, 600, 1, -1);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);

            // clear screen
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

            // set color
            GL11.glColor3f(0.78f, 0.31f, 0.35f);

            // draw the quad
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glVertex2f(100, 100);
            GL11.glVertex2f(100 + 200, 100);
            GL11.glVertex2f(100 + 200, 100 + 200);
            GL11.glVertex2f(100, 100 + 200);

            GL11.glEnd();

            // sync and update
            Display.update();
            Display.sync(60);

        }
        Display.destroy();

    }

    public static void main(String[] args) {
        Main game = new Main();
        game.start();
    }

}
2
  • 1
    What do you want this to do, and what is it doing wrong? Nov 1, 2014 at 13:02
  • I want to move a vertex to another point. Translations. Nov 3, 2014 at 12:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.