Building Room

Started by NickyP101, May 03, 2005, 12:26:56

Previous topic - Next topic


Haha ok im trying to build a room, here is what i have:

public void render() { 

       		gl.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);          // Clear The Screen And The Depth Buffer 


		gl.glTranslatef(0.0f, 0.0f, -6.0f);

		//Build Room


			gl.glNormal3f(0.0f, 0.0f, 1.0f);


			gl.glVertex3f(-2.0f, 2.0f, -8.0f); //Draw Back Wall - Top Left	
			gl.glVertex3f(-2.0f, -2.0f, -8.0f); //Draw Back Wall - Bottom Left
			gl.glVertex3f( 2.0f, 2.0f, -8.0f); //Draw Back Wall - Top Right	
			gl.glVertex3f( 2.0f, -2.0f, -8.0f); //Draw Back Wall - Bottom Right


			gl.glNormal3f(1.0f, 0.0f, 0.0f);


			gl.glVertex3f( -2.0f, 2.0f, 0.0f); //Draw Left Wall - Top Left	
			gl.glVertex3f( -2.0f, -2.0f, 0.0f); //Draw Left Wall - Bottom Left
			gl.glVertex3f( -2.0f, 2.0f,-8.0f); //Draw Left Wall - Top Right	
			gl.glVertex3f( -2.0f, -2.0f,-8.0f); //Draw Left Wall - Bottom Right



			gl.glNormal3f(-1.0f, 0.0f, 0.0f);

			gl.glVertex3f( 2.0f, 2.0f,-8.0f); //Draw Right Wall - Top Left	
			gl.glVertex3f( 2.0f, -2.0f,-8.0f); //Draw Right Wall - Bottom Left
			gl.glVertex3f( 2.0f, 2.0f, 0.0f); //Draw Right Wall - Top Right	
			gl.glVertex3f( 2.0f, -2.0f, 0.0f); //Draw Right Wall - Bottom Right



			gl.glNormal3f(0.0f, 1.0f, 0.0f);


			gl.glVertex3f( -2.0f,-2.0f,-8.0f); //Draw Floor - Top Left	
			gl.glVertex3f( -2.0f,-2.0f, 0.0f); //Draw Floor - Bottom Left
			gl.glVertex3f(  2.0f,-2.0f,-8.0f); //Draw Floor - Top Right	
			gl.glVertex3f(  2.0f,-2.0f, 0.0f); //Draw Floor - Bottom Right




Its not working quiet correctly, the walls seem to be in the correct position, but on each wall it looks like a triangle has been cut out of it. I cant show u a screenshot because i dont know how lol. Please take a quick look at the code, it might be something soo simple, im just beggining since yesterday lol alot more fun that 2D although i feel like im cheating lol i did some dynamic lighting in 2D using pure java no OpenGL or anything lol pixel by pixel lighting etc, lots of fun, in OpenGL i just set up a light lol LOVE IT!.

Cheers, Nick


Its ok figured it out, have to draw the QUADS clockwise from top left to top right to bottom right to bottom left :)

Thanks anyway!


More accurately, the quads do not need to be clockwise or whatnot, they need to have the points in order for each. That means hitting each corner in order.