Skip to main content
gamedev.net
🔒 Locked

GL 3D Setup problem...

Started by Riddle Mar 22, 2005 at 1:29 PM 0 replies 350+ views
Original Post
Riddle
Riddle
I currently setup gl for 2D this way:

            Gl.glViewport( 0, 0, screen_w, screen_h );

            Gl.glMatrixMode( Gl.GL_PROJECTION );
            Gl.glLoadIdentity();

            Gl.glOrtho( 0, screen_w, screen_h, 0, -1.0, 1.0 );

            Gl.glMatrixMode( Gl.GL_MODELVIEW );
            Gl.glLoadIdentity();

            Gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );


I tried to setup it for 3D.. but no vertices are rendered!

                Gl.glViewport( 0, 0, _window.Width, _window.Height );

                Gl.glMatrixMode( Gl.GL_PROJECTION );
                Gl.glLoadIdentity();

                Gl.glMatrixMode( Gl.GL_MODELVIEW );
                Gl.glLoadIdentity();

                Gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );

                Gl.glClearDepth( 1.0d );
                Gl.glEnable( Gl.GL_DEPTH_TEST );
                Gl.glDepthFunc( Gl.GL_LEQUAL );

                Gl.glHint( Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST );


What is wrong?! Thank you very much for your help!(: Riddle
zedzeek
zedzeek
after Gl.glMatrixMode( Gl.GL_PROJECTION ); u need to set some projection matrix eg with gluPerspective(...)
see a tutorial site eg
http://www.ultimategameprogramming.com/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.