Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9033089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:08:24+00:00 2026-06-16T08:08:24+00:00

Alright, so I started learning LWJGL through a few tutorials of TheCodingUniverse, but I’ve

  • 0

Alright, so I started learning LWJGL through a few tutorials of TheCodingUniverse, but I’ve hit a wall at drawing lines and quads.

The code

package LWJGL_Learn;

import static org.lwjgl.opengl.GL11.*;
import org.lwjgl.opengl.*;
import org.lwjgl.*;

public class SimpleOGLRenderer {

    public SimpleOGLRenderer() {
        try {
            Display.setDisplayMode(new DisplayMode(640, 480));
            Display.setTitle("SimpleOGLRenderer");
            //Display.setInitialBackground(256, 256, 256);
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
        }

        //OpenGL Initialization
        glMatrixMode(GL_PROJECTION); 
        glLoadIdentity();
        glOrtho(0, 640, 480, 0, 1, -1);
        glMatrixMode(GL_MODELVIEW);

        while (!Display.isCloseRequested()) {

            //Render Code'
            glBegin(GL_QUADS);
                glVertex2i(50, 50);
                glVertex2i(80, 70);
                glVertex2i(80, 130);
                glVertex2i(50, 300);
            glEnd();

            glBegin(GL_LINES);
                glVertex2i(100, 100);
                glVertex2i(200, 200);
            glEnd();

            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
            Display.update();
            Display.sync(60);
        }
        Display.destroy();
        System.exit(0);
    }
    public static void main(String[] args) {
        new SimpleOGLRenderer();
    }
}

Refer to around 6:50 minutes in this video to see what the code is supposed to be, and what its supposed to do.

Anyway, the problem is that no lines or quads show up. The screen stays black. Now, I thought maybe it was because black lines were being drawn on a black display so I modified the background color (the commented out line which went like .setInitialDisplay...), but with no result. The color changed, but the screen stayed white and no lines appeared. Do any of you guys know what I’m doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T08:08:26+00:00Added an answer on June 16, 2026 at 8:08 am

    1) The default color is white, but you are clearing the color buffer right before doing the Display.update()
    remove:

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    2) You’re not using the coordinates from the video, right before 6:50.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, so I started learning AJAX, it's pretty hard for me to understand it
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright so I have no idea how to even begin doing this But basically
I have recently started learning Perl and one of my latest assignments involves searching
Alright, so I have started using Github to easily share my code, and to
I am getting started with HTML and PHP. Doing alright, I understand the syntax
I am new to C++, but the language seems alright to me. As a
I've started customizing my website recently and it looks alright in all browsers except
Alright i have been searching for days but there is no example of what
Alright, so I'm about 90% sure that this isn't possible, but I thought I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.