Why is nothing rendering? - LWJGL

That means that glClear(1) was causing the error. It should render now if everything else is correct.

Sorry if my explanation was hard to follow. You got the two mixed up. If the first glGetError is zero and the second check is not, then you know that the code in between the checks is throwing the error. In your case, the error was not cause by the glClear in between the two calls, because the first check already had an error, so you know that the error was called before this section of code.

If that block of code was throwing the error, then you would have gotten this output:

[quote]VERY FIRST! 0
2nd! 1281
[/quote]

Ohh, ok thanks :smiley:

However, like I said, it’s still pitch black? What am I doing wrong?, I’ve tried for days with different tutorials to get VBO’s to work but no O.o’?

Thank you people, I have seemed to resolve the problem.

When fixing both of these to suggestions the I seem to be able to see my rendered objects and move as expected.

Thanks especially to you too, and to all others that tried to help and contribute :smiley:

Well, this is embarrasing, when we’ve finally got it rendering, it’s rendering too much!. Well sorta.


This picture is of a chunk size of 4. I’ve removed the left and right sides to make it more visible. Inside you see a weird almost cubish object. Where does it come from? I don’t know.
But what I do know is, it appears in 1, 2, 4, 8 and maybe more chunk size, in 16 I cannot find it. And, as I approtch it I drop from 999 to 4 fps.

help please!?

Some code!

Chunk.java


private void rebuildVBO() {
		FloatBuffer vCoords = BufferUtils.createFloatBuffer(size * size * size * (3 * 4 * 6));
		FloatBuffer cCoords = BufferUtils.createFloatBuffer(size * size * size * (4 * 4 * 6));
		
		for(int x = 0; x < size; x++) {
			for(int y = 0; y < size; y++) {
				for(int z = 0; z < size; z++) {
					
					vCoords.put(Shape.createCubeVerticies(x, y, z, 1f));
					cCoords.put(Shape.getCubeColors());
					
				}
			}
		}
		
		vCoords.flip();
		cCoords.flip();
		
		glBindBuffer(GL_ARRAY_BUFFER, vId);
		glBufferData(GL_ARRAY_BUFFER, vCoords, GL_STATIC_DRAW);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
		
		glBindBuffer(GL_ARRAY_BUFFER, cId);
		glBufferData(GL_ARRAY_BUFFER, cCoords, GL_STATIC_DRAW);
		glBindBuffer(GL_ARRAY_BUFFER, 0);
	}

Shape.java


public static float[] createCubeVerticies(float x, float y, float z, float size) {
		size = size / 2;
		
		return new float[] {x + size, y + size, z - size, // Top Right Of The Quad (Top)
			x - size, y + size, z - size, // Top Left Of The Quad (Top)
			x - size, y + size, z + size, // Bottom Left Of The Quad (Top)
			x + size, y + size, z + size, // Bottom Right Of The Quad (Top)
			
			x + size, y - size, z + size, // Top Right Of The Quad (Bottom)
			x - size, y - size, z + size, // Top Left Of The Quad (Bottom)
			x - size, y - size, z - size, // Bottom Left Of The Quad (Bottom)
			x + size, y - size, z - size, // Bottom Right Of The Quad (Bottom)
			
			x + size, y + size, z + size, // Top Right Of The Quad (Front)
			x - size, y + size, z + size, // Top Left Of The Quad (Front)
			x - size, y - size, z + size, // Bottom Left Of The Quad (Front)
			x + size, y - size, z + size, // Bottom Right Of The Quad (Front)
			
			x + size, y - size, z - size, // Bottom Left Of The Quad (Back)
			x - size, y - size, z - size, // Bottom Right Of The Quad (Back)
			x - size, y + size, z - size, // Top Right Of The Quad (Back)
			x + size, y + size, z - size, // Top Left Of The Quad (Back)
			
		};
	}
	
	private static Random ran = new Random();
	
	public static float[] getCubeColors() {
		float r1 = 1f;
		float b1 = 0f;
		float g1 = 0f;
		
		float r2 = 1f;
		float b2 = 1f;
		float g2 = 0f;
		
		float r3 = 1f;
		float b3 = 1f;
		float g3 = 1f;
		
		float r4 = 0f;
		float b4 = 1f;
		float g4 = 1f;
		
		float r5 = 0f;
		float b5 = 0f;
		float g5 = 1f;
		
		float r6 = 1f;
		float b6 = 0f;
		float g6 = 1f;
		
		return new float[] {
			r1, b1, g1, 1,
			r1, b1, g1, 1,
			r1, b1, g1, 1,
			r1, b1, g1, 1,
			
			r2, b2, g2, 1,
			r2, b2, g2, 1,
			r2, b2, g2, 1,
			r2, b2, g2, 1,
			
			r3, b3, g3, 1,
			r3, b3, g3, 1,
			r3, b3, g3, 1,
			r3, b3, g3, 1,
			
			r4, b4, g4, 1,
			r4, b4, g4, 1,
			r4, b4, g4, 1,
			r4, b4, g4, 1,
			
			r5, b5, g5, 1,
			r5, b5, g5, 1,
			r5, b5, g5, 1,
			r5, b5, g5, 1,
			
			r6, b6, g6, 1,
			r6, b6, g6, 1,
			r6, b6, g6, 1,
			r6, b6, g6, 1,
		};
	}