Slick Forums

Discuss the Slick 2D Library
It is currently Sat Dec 16, 2017 4:54 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Jul 18, 2013 10:53 am 
Offline

Joined: Thu Jul 18, 2013 10:30 am
Posts: 3
Hello!

I set up TWL, but I have a black overlay over my screen. I don't know why. I use LWJGL for rendering in my 3D application. I made a UIRoot class that holds the widgets, and it only has one button. I'm using this theme.

This is how the game currently looks like: http://i.imgur.com/PwnkbjZ.png

And this is how it should be running: http://i.imgur.com/PFxC5EP.png

On the other hand, I got some kind of flickering, maybe from the depth clearing. I clear my depth before drawing my weapons, but I commented that out, but still flickering if the GUI is on.


Top
 Profile  
 
PostPosted: Thu Jul 18, 2013 8:31 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
Hmm - looks strange. Can you post the relevant parts of the code (eg the main loop and everything TWL related)?

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Thu Jul 18, 2013 10:19 pm 
Offline

Joined: Thu Jul 18, 2013 10:30 am
Posts: 3
That's how I setup TWL

Code:
public class UIRoot extends Widget {

    GUI gui;
    Button button;

    public UIRoot()
    {
        LWJGLRenderer renderer = null;
        try {
            renderer = new LWJGLRenderer();
        } catch (LWJGLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        gui = new GUI(this, renderer);

        ThemeManager theme = null;
        try {
            theme = ThemeManager.createThemeManager(
                    Game.class.getResource("/res/chutzpah.xml"), renderer);
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        gui.applyTheme(theme);
        this.setTheme("");

        button = new Button("ROFL");
        button.setTheme("button");
        this.add(button);

    }

    @Override
    public void layout()
    {
        button.adjustSize();
    }

    public void render()
    {
        gui.update();
    }

    public void turn(boolean b)
    {
        gui.setEnabled(b);
    }

    public boolean shouldDraw()
    {
        return gui.isEnabled();
    }

}



Code:
private void run()
   {
      while(!Display.isCloseRequested() && graphics.isRunning())
      {
         try
         {
                graphics.preRender();
                graphics.clear();
                int d = graphics.getDelta();
                update(d);
                render();
                Display.sync(60);
         }
         catch(Exception e)
         {
            e.printStackTrace();
         }
      }
      Display.destroy();
   }


In graphics.preRender, I just calculate delta, nothing render specific. In clear, I clear the window with color buffer and depth buffer bit. In the render method, I just call gui.update().


Top
 Profile  
 
PostPosted: Thu Jul 18, 2013 10:44 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
WHich OpenGL features does your code use? Take a look at the LWJGLRenderer class to see which GL states it accesses.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Fri Jul 19, 2013 2:13 pm 
Offline

Joined: Thu Jul 18, 2013 10:30 am
Posts: 3
Hmmm... I found out, that it's not a black overlay, it's a problem with color. My textures got darker. Still no idea why

EDIT: I dropped in a glColor3f(1,1,1); in my level render method, and now it's okay.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group