Hello Guest

glColor4ub

  • 2 Replies
  • 10395 Views
*

Offline bedelf

  • ***
  • 196
glColor4ub
« on: April 03, 2005, 10:43:51 »
glColor4ub((byte)255, (byte)0, (byte)0, (byte)255)); // red..
glColor4ub((byte)0, (byte)0, (byte)255, (byte)255)); // blue..
glColor4ub((byte)0, (byte)255, (byte)0, (byte)255)); // NOTHING?

Trying hard to figure out what I was doing wrong with my code, so I just changed that single line 3 times with explicit color values, and I seem to come up with nothing when I use green.

I'm going to be captain obvious and just say either I'm doing something wrong, or I found a bug. :P I'm using lwjgl 0.95. (edit: still happens in 0.96)


rowr.

*

Offline WiESi

  • **
  • 70
glColor4ub
« Reply #1 on: April 03, 2005, 16:13:23 »
Strange, it works fine on my computer. Here's the code I used to test:

Code: [Select]
import org.lwjgl.opengl.*;

public class ColorTest {

public ColorTest() throws Exception {
Display.create();
GL11.glClearColor(1, 1, 1, 1);
while(!Display.isCloseRequested()) {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

GL11.glBegin(GL11.GL_QUADS);
GL11.glColor4ub((byte)0, (byte)255, (byte)0, (byte)255);
GL11.glVertex2i(10, 10);
GL11.glVertex2i(50, 10);
GL11.glVertex2i(50, 50);
GL11.glVertex2i(10, 50);

GL11.glEnd();

GL11.glFinish();

Display.update();
}
}

public static void main(String[] args) {
try {
new ColorTest();
}
catch(Exception e) {
e.printStackTrace();
}
}
}


WiESi

*

Offline bedelf

  • ***
  • 196
glColor4ub
« Reply #2 on: April 03, 2005, 17:17:09 »
Your code works, but whenever I specifically tell mine to use just green I get nothing still. Do we know of anything that would cause it to just show black? It doesn't make any sense to me that red and blue work but green does not. Arg.

edit: WOW. Nevermind. I have got to be some shade of retarded. I had some rogue code in there enabling blending. You know, at 3am last night, I was fairly convinced that wasn't happening. :P

Thanks for taking your time to help.

-ed