Hello Guest

Help! Urgent Bug! Shading issue with slick util.

  • 1 Replies
  • 6999 Views
Help! Urgent Bug! Shading issue with slick util.
« on: May 17, 2013, 22:47:07 »
Hello members of the LWJGL forum,

I am new to workng with LWJGL, and i seem to be having a bit of an issue with lwjgl 2.9.0 and slick-util: I bind a texture with click-util, and draw it on a quad with openGL. However, when i go to draw a quad without entering the texcoord2d functions, which should, to my knowledge, not call upon a texture, by colored quad gets displayed darkened, as if there were a half-opaque black quad on top of it. Here is my code for rendering a simple gui (ignore the wierd setup, just look at the GL11.something code):

NOTE: I think i have to do something to "unbind" the texture, but I don't know if there is a command like that.

package gui;

import org.lwjgl.opengl.*;

import core.Genome;

public class GUIMainMenu extends GUI {
   
   int counter;
   
   public GUIMainMenu(int arg0, int arg1, int arg2, int arg3) {
      
      super(arg0, arg1, arg2, arg3);
      
   }
   
   public void tick() throws Exception {
      
      if (counter < 1000) {
         
         counter ++;
         
      }
      
      GL11.glColor3d(0, 0, 1);
      
      GL11.glBegin(GL11.GL_QUADS);
      
      GL11.glVertex2f(0, 0);
      
      GL11.glVertex2f(w, 0);
      
      GL11.glVertex2f(w, h);
      
      GL11.glVertex2f(0, h);
      
      GL11.glEnd();
      
      if (Genome.instance.tick.ticks % 10 <= 5) {
         
         GL11.glColor3d(1, 1, 1);
         
         GL11.glBegin(GL11.GL_QUADS);
         
         GL11.glVertex2f(0, h * 7 / 8);
         
         GL11.glVertex2f(w / 16, h * 7 / 8);
         
         GL11.glVertex2f(w / 16, h * 29 / 32);
         
         GL11.glVertex2f(0, h * 29 / 32);
         
         GL11.glEnd();
         
      }
      
      if (counter >= 20) {
         
         GL11.glColor3d(1, 1, 1);
         
         Genome.instance.screen.textureMap.loadTexture("initializing.png");
         
         GL11.glBegin(GL11.GL_QUADS);
         
         GL11.glTexCoord2f(0, 1);
         
         GL11.glVertex2f(0, h * 3 / 4);
         
         GL11.glTexCoord2f(1, 1);
         
         GL11.glVertex2f(w * 1 / 2, h * 3 / 4);
         
         GL11.glTexCoord2f(1, 0);
         
         GL11.glVertex2f(w * 1 / 2, h * 7 / 8);
         
         GL11.glTexCoord2f(0, 0);
         
         GL11.glVertex2f(0, h * 7 / 8);
         
         GL11.glEnd();
         
      }
      
   }
   
}

All help is appreciated!

Re: Help! Urgent Bug! Shading issue with slick util.
« Reply #1 on: May 20, 2013, 13:10:30 »
I'm not sure how this is an "Urgent Bug!" :P

I would normally just say "Google is your friend", but I'm feeling unusually helpful today:
GL11.glDisable(GL11.GL_TEXTURE_2D);
and
GL11.glEnable(GL11.GL_TEXTURE_2D);


EDIT: Realized you double-posted and someone already answered somewhere else. :-\
« Last Edit: May 20, 2013, 13:21:32 by Fool Running »
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D