Window (NOT glClear) clearing to blue colour instead of black on certain devices

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Window (NOT glClear) clearing to blue colour instead of black on certain devices

EatingBeansAgain
Hi there,

This is a bit of a weird one, so please forgive me if I should be putting this somewhere else, but this seemed like the best community to ask for help. I'm having an issue when using glScissor where my "no draw" area is coloured blue (seemingly (0,0,1,1)) rather than black. This only happens on my Mac - when I run the same code on my Windows device, I have this problem. I've attached an image showing what I'm looking at. I've stripped my code right back to just doing a ClearColor of red and then the Scissor, so there's no where that I can see it would be getting the blue colour from.

Image:


My code:
public class BlueBackground extends JFrame implements GLEventListener {

	private GLCanvas canvas;
	private int width = 800;
	private int height = 800;


	public BlueBackground() {
		super("Blue Background");
		
		GLProfile profile = GLProfile.get(GLProfile.GL4);		 
		GLCapabilities capabilities = new GLCapabilities(profile);
		canvas = new GLCanvas(capabilities);
		canvas.addGLEventListener(this);
		add(canvas);
		
		// set up the JFrame		
		
		setSize(width, height);
		setVisible(true);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});	
		
		
	}


	public void init(GLAutoDrawable drawable) 
	{

	}
	
	public void display(GLAutoDrawable drawable) 
	{
		GL4 gl = (GL4) GLContext.getCurrentGL();
		
		gl.glEnable(GL.GL_SCISSOR_TEST);
		gl.glScissor(0, 0, 1000, 500);
	
		gl.glClearColor(1f, 0f, 0f, 1.0f);	
		gl.glClear(GL_COLOR_BUFFER_BIT);		
	}
	
	public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) 
	{	
		this.width = width;
		this.height = height;
	}


	public static void main(String[] args)
	{
		new BlueBackground();
	}


	@Override
	public void dispose(GLAutoDrawable arg0) {
		// TODO Auto-generated method stub
		
	}
}

Any help is greatly appreciated. I'm running JRE 13 and working in the Eclipse IDE.
Reply | Threaded
Open this post in threaded view
|

Re: Window (NOT glClear) clearing to blue colour instead of black on certain devices

gouessej
Administrator
Please can you at least use an LTS version of Java, either 11 or 17? Can you be more accurate about your operating system and your hardware?
Julien Gouesse | Personal blog | Website