java - My cube in lwjgl doesn't render correctly -


i followed tutorial opengl found here provided top answer this question cube refuses render front , faces, other faces render, same problem pyramid. here source code:

public void render(){     gl11.glmatrixmode(gl11.gl_projection);     gl11.glloadidentity();     gl11.glortho(0, display.getdisplaymode().getwidth(), 0, display.getdisplaymode().getheight(), -1, 1);     gl11.glclear(gl11.gl_color_buffer_bit | gl11.gl_stencil_buffer_bit); //clear screen      //center square according screen size     gl11.glpushmatrix();     if(display.wasresized()){         mx = 0; //mx mouse x position         = 0; //my mouse y position     }     if((mx == 0 && ==0)){         gl11.gltranslatef((display.getwidth()/2), (display.getheight()/2), 0.0f);     }else{         gl11.gltranslatef(mx+50, my+50, 0.0f);     }     gl11.glrotatef(angle, 0.0f,1.0f,0.5f); //angle angle of quads rotation     gl11.glbegin(gl11.gl_quads);      gl11.glcolor3f(0.0f,1.0f,0.0f);     gl11.glvertex3f(50.0f, 50f, -50f);     gl11.glvertex3f(-50.0f, 50f, -50f);     gl11.glvertex3f(-50.0f, 50f, 50f);     gl11.glvertex3f(50.0f, 50f, 50f);      gl11.glcolor3f(0.0f,0.5f,0.0f);     gl11.glvertex3f(50.0f, -50f, 50f);     gl11.glvertex3f(-50.0f, -50f, 50f);     gl11.glvertex3f(-50.0f, -50f, -50f);     gl11.glvertex3f(50.0f, -50f, -50f);      gl11.glcolor3f(1.0f,0.0f,0.0f);     gl11.glvertex3f(50.0f, 50f, 50f);     gl11.glvertex3f(-50.0f, 50f, 50f);     gl11.glvertex3f(-50.0f, -50f, 50f);     gl11.glvertex3f(50.0f, -50f, 50f);      gl11.glcolor3f(1.0f,1.0f,0.0f);     gl11.glvertex3f(50.0f, -50f, -50f);     gl11.glvertex3f(-50.0f, -50f, -50f);     gl11.glvertex3f(-50.0f, 50f, -50f);     gl11.glvertex3f(50.0f, 50f, -50f);      gl11.glcolor3f(0.0f,0.0f,1.0f);     gl11.glvertex3f(-50.0f, 50f, 50f);     gl11.glvertex3f(-50.0f, 50f, -50f);     gl11.glvertex3f(-50.0f, -50f, -50f);     gl11.glvertex3f(-50.0f, -50f, 50f);      gl11.glcolor3f(1.0f,0.0f,1.0f);     gl11.glvertex3f(50.0f, 50f, -50f);     gl11.glvertex3f(50.0f, 50f, 50f);     gl11.glvertex3f(50.0f, -50f, 50f);     gl11.glvertex3f(50.0f, -50f, -50f);      gl11.glend();     gl11.glpopmatrix(); } 

looks me depth issue. front of cube off front of frustum , getting clipped out.

gl11.glortho(0, display.getdisplaymode().getwidth(), 0, display.getdisplaymode().getheight(), -1, 1); 

notice 1 (last param), past clipped out.

what seeing in effect section of cube stretched out.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -