0

I'm trying to draw objects on my screen in 2D and translate them on a pixel by pixel bases. Here is my render code, and for some reason it's not showing my objects anymore. It showed them before I added the Ortho Camera. What's going on?

Thanks!

      game.RenderFrame += (sender, e) =>
            {
                GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
                GL.MatrixMode(MatrixMode.Projection);
                GL.LoadIdentity();
                GL.Ortho(0, 800, 600, 0, -1, 1);

                GL.MatrixMode(MatrixMode.Modelview);
                GL.LoadIdentity();
               // GL.ActiveTexture(TextureUnit.Texture0);
                int textID = loadTexture(Rock);

                GL.BindTexture(TextureTarget.Texture2D, textID);

                drawObject(100, 20, 0.15f, 0.15f);

                drawObject(100, 60, 0.15f, 0.15f);

                drawObject(100, 100,0.15f, 0.15f);

                game.SwapBuffers();

            };

 drawObject(PosX, PosY, ScaleX, ScaleY);

and within my drawObject method I am using

`GL.Translate(PosX, PosY, 0);`
Wezley
  • 413
  • 1
  • 3
  • 19
  • What size do your objects have? Maybe they are just too small? – Nico Schertler Dec 24 '14 at 11:20
  • They're not too small. They show perfectly fine until I turn he MatrixMode to Projection. After I turn it to Projection everything disappears. – Wezley Dec 24 '14 at 21:51
  • Is your viewport set correctly? What's the Z coord of your objects, Are their geometries clamped between -1 and 1 on the z axis as your near and far clipping distance suggest (the 2 last params of glOrtho)? – j-p Dec 25 '14 at 05:54
  • Your orthographic projection might scale your objects. Depending on what setting you had before. – Nico Schertler Dec 25 '14 at 08:38

0 Answers0