Main Menu

glColor4ub

Started by bedelf, April 03, 2005, 10:43:51

Previous topic - Next topic

bedelf

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.

WiESi

Strange, it works fine on my computer. Here's the code I used to test:

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

bedelf

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