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 8751243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:00:37+00:00 2026-06-13T13:00:37+00:00

I have imported lwjgl in Eclipse. The teacher gave us a BaseWindow application to

  • 0

I have imported lwjgl in Eclipse. The teacher gave us a BaseWindow application to import in Eclipse, too. The application should display a 1024×768 black window. But instead of black window I get black and white stripes flickering on the display. Screenshot: https://i.stack.imgur.com/JHsMC.png
I can’t show a picture of stripes, because they were not visible on the screenshot. But there is another error visible.

This is the source of BaseWindow.java file:

import org.lwjgl.*;
import org.lwjgl.opengl.*;
import org.lwjgl.input.*;
import java.nio.*;

public class BaseWindow
{

  protected static boolean isRunning = false;

  public static void main(String[] args)
  {
    // What version of OpenGL is supported?

    // Start our program
    (new BaseWindow()).execute();
  }

  /**
   * Initializes display and enters main loop
   */
  protected void execute()
  {
    try
    {
      initDisplay();
    } catch (LWJGLException e)
    {
      System.err.println("Can't open display.");
      System.exit(0);
    }

    BaseWindow.isRunning = true;
    mainLoop();
    Display.destroy();
  }

  /**
   * Main loop: renders and processes input events
   */
  protected void mainLoop()
  {
    // setup camera and lights
    setupView();

    while (BaseWindow.isRunning)
    {
      // reset view
      resetView();

      // let subsystem paint
      renderFrame();

      // process input events
      processInput();

      // update window contents and process input messages
      Display.update();
    }
  }

  /**
   * Initial setup of projection of the scene onto screen, lights, etc.
   */
  protected void setupView()
  {

  }

  /**
   * Resets the view of current frame
   */
  protected void resetView()
  {

  }

  /**
   * Renders current frame
   */
  protected void renderFrame()
  {
  }

  /**
   * Processes Keyboard and Mouse input and spawns actions
   */
  protected void processInput()
  {
    if (Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
    {
      BaseWindow.isRunning = false;
    }
  }

  /**
   * Finds best 1024x768 display mode and sets it
   * 
   * @throws LWJGLException
   */
  protected void initDisplay() throws LWJGLException
  {
    DisplayMode bestMode = null;
    DisplayMode[] dm = Display.getAvailableDisplayModes();
    for (int nI = 0; nI < dm.length; nI++)
    {
      DisplayMode mode = dm[nI];
      System.out.println(mode.getFrequency() + " " + mode.getWidth() + " " + mode.getHeight());
      if (mode.getWidth() == 1024 && mode.getHeight() == 768
          && mode.getFrequency() <= 85)
      {
        if (bestMode == null
            || (mode.getBitsPerPixel() >= bestMode.getBitsPerPixel() && mode
                .getFrequency() > bestMode.getFrequency()))
          bestMode = mode;
      }
    }
    System.out.println("Best\n" + bestMode.getFrequency() + " " + bestMode.getWidth() + " " + bestMode.getHeight());
    Display.setDisplayMode(bestMode);
//    FSAA
    Display.create(new PixelFormat(8, 8, 8, 4));
//    No FSAA
//    Display.create();
    Display.setTitle(this.getClass().getName());

    System.out.println("GL_VERSION: "+GL11.glGetString(GL11.GL_VERSION));
    System.out.println("GL_VENDOR: "+GL11.glGetString(GL11.GL_VENDOR));
    System.out.println("GL_RENDERER: "+GL11.glGetString(GL11.GL_RENDERER));
  }

  /**
   * Utils for creating native buffers
   * 
   * @throws LWJGLException
   */
  public static ByteBuffer allocBytes(int howmany)
  {
    return ByteBuffer.allocateDirect(howmany).order(ByteOrder.nativeOrder());
  }

  public static IntBuffer allocInts(int howmany)
  {
    return ByteBuffer.allocateDirect(howmany).order(ByteOrder.nativeOrder())
    .asIntBuffer();
  }

  public static FloatBuffer allocFloats(int howmany)
  {
    return ByteBuffer.allocateDirect(howmany).order(ByteOrder.nativeOrder())
    .asFloatBuffer();
  }

  public static ByteBuffer allocBytes(byte[] bytearray)
  {
    ByteBuffer bb = ByteBuffer.allocateDirect(bytearray.length * 1).order(
        ByteOrder.nativeOrder());
    bb.put(bytearray).flip();
    return bb;
  }

  public static IntBuffer allocInts(int[] intarray)
  {
    IntBuffer ib = ByteBuffer.allocateDirect(intarray.length * 4).order(
        ByteOrder.nativeOrder()).asIntBuffer();
    ib.put(intarray).flip();
    return ib;
  }

  public static FloatBuffer allocFloats(float[] floatarray)
  {
    FloatBuffer fb = ByteBuffer.allocateDirect(floatarray.length * 4).order(
        ByteOrder.nativeOrder()).asFloatBuffer();
    fb.put(floatarray).flip();
    return fb;
  }
}

The application worked fine for everybody but me. The teacher wasn’t able to help me.

My computer:

  • MacBook Pro (late 2011)
  • AMD Radeon HD 6750M 512 MB
  • 10.8.2 (12C60)

  • GL_VERSION: 2.1 ATI-1.0.29

  • GL_VENDOR: ATI Technologies Inc.
  • GL_RENDERER: AMD Radeon HD 6750M OpenGL Engine

Does anybody have any ideas, what could be 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-13T13:00:38+00:00Added an answer on June 13, 2026 at 1:00 pm

    You don’t seem to be clearing the framebuffer (via glClear()) at any point. It’s perfectly allowable for the GL implementation to give you garbage in that case.

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

Sidebar

Related Questions

I have imported my maven project in eclipse using Import Maven project. It got
I have imported maven project in eclipse and configured properly. Its a web application,
I have imported an existing project built using Maven into my Eclipse workspace. Should
I have imported the android project in Eclipse on Mac System, I got Error
I have imported framework for sending email from application in background i.e. SKPSMTPMessage Framework.
I have imported a local directory in my svn repository using import /my/home/dir file://my/home/svn/repo/trunk
I have imported some projects in eclipse through Maven. I want to access the
I have imported a project to Eclipse. The version of the API was 15
I have imported the android api sample applicaition into Eclipse. I am getting compile
I have imported a file using the below command code='IN' exec import %s_tmp_file %

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.