Good Morning,

I've been trying to find some info on this matter as me and my group partner just started and we are at loss as our teacher doesnt actually "teach" coding but only theory, not even during his aid hours he helps as if we should KNOW EVERYTHING already, and our labs are being rather ridiculous since no1 can actually finish them 50%

This is what we have done so far but still way too incomplete


Code :
using System;
 
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
using OpenTK.Input;
 
namespace StarterKit
{
    class Game : GameWindow
    {
        Casa teste = new Casa();
        Vector3 vec3 = new Vector3(0.0f, 0.0f, 0.0f);
        Vector3 vec4 = new Vector3(0.0f, 0.0f, 0.0f);
        float angulo = 0;
 
        public Game()
            : base(800, 600, GraphicsMode.Default, "OpenTK Quick Start Sample")
        {
            VSync = VSyncMode.On;
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
 
 
            //////////////ETAPA 1 FINAL////////////////////////////////////////////////
            double x = teste.getX(1, teste.paredeFrontal);
            Console.WriteLine(x);
            double s = teste.getX(3, teste.paredeFrontal);
            Console.WriteLine(s);
 
            x = teste.getY(1, teste.paredeFrontal);
            Console.WriteLine(x);
            s = teste.getY(3, teste.paredeFrontal);
            Console.WriteLine(s);
            ///////////////////////////////////////////////////////////////////////////
 
 
            GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            GL.Enable(EnableCap.DepthTest);
        }
 
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
 
            GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
 
            Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI / 4, Width / (float)Height, 1.0f, 64.0f);
            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projection);
 
 
        }
 
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);
 
            if (Keyboard[Key.Escape])
                Exit();
 
            if (Keyboard[Key.O])
                GL.ClearColor(0.9f, 0.2f, 0.5f, 0.0f);
 
            if (Keyboard[Key.P])
                GL.ClearColor(0.5f, 0.2f, 0.9f, 0.0f);
 
            if (Keyboard[Key.Right])
            {
                vec3 += new Vector3(-0.1f, 0.0f, 0.0f);
            }
 
            if (Keyboard[Key.Up])
            {
                vec3 += new Vector3(0.0f, 0.1f, 0.0f);
            }
 
            if (Keyboard[Key.Left])
            {
                vec3 += new Vector3(0.1f, 0.0f, 0.0f);
            }
 
            if (Keyboard[Key.Down])
            {
                vec3 += new Vector3(0.0f, -0.1f, 0.0f);
            }
 
            if (Keyboard[Key.A])
            {
                angulo += (float)(Math.PI/2);
            }
 
            if (Keyboard[Key.D])
            {
                angulo -= (float)(Math.PI / 2);
            }
 
            if (Keyboard[Key.M])
            {
                vec3 += new Vector3(0.0f, 0.0f, 0.1f);
            }
 
            if (Keyboard[Key.N])
            {
                vec3 += new Vector3(0.0f, 0.0f, -0.1f);
            }
 
            if (Keyboard[Key.Z])
            {
                vec4 += new Vector3(0.0f, 0.0f, 0.1f);
            }
 
            if (Keyboard[Key.W])
            {
                vec4 += new Vector3(0.0f, 0.0f, -0.1f);
            }
 
            SwapBuffers();
        }
 
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);
 
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
 
            Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY); 
 
            GL.MatrixMode(MatrixMode.Modelview);
 
            GL.LoadMatrix(ref modelview);
 
            GL.Translate(vec4);
 
            GL.Begin(BeginMode.Lines);
 
 
            GL.Color3(1.0f, 1.0f, 1.0f); GL.Vertex3(0.0f, -20.0f, 10.0f);
            GL.Color3(1.0f, 1.0f, 1.0f); GL.Vertex3(0.0f, 20.0f, 10.0f);
 
            GL.End();
 
            GL.Begin(BeginMode.Lines);
 
 
            GL.Color3(1.0f, 1.0f, 1.0f); GL.Vertex3(20.0f, 0.0f, 10.0f);
            GL.Color3(1.0f, 1.0f, 1.0f); GL.Vertex3(-20.0f, 0.0f, 10.0f);
 
            GL.End();
            GL.PopMatrix();
            GL.LoadMatrix(ref modelview);
            SwapBuffers();
 
 
        }
 
        [STAThread]
        static void Main()
        {
            using (Game game = new Game())
            {
                game.Run(30.0);
            }
 
        }
    }
 
    public class Casa
    {
       public double[,] paredeFrontal;
       public double[,] paredeLateralE;
       public double[,] telhadoTraseiro;
       public double[,] telhadoFrontal;
       public double[,] telhadoLateralE;
 
       public Vector3 corParedeFrontal;
       public Vector3 corParedeLateral;
       public Vector3 corTelhado;
 
        public Casa()
        {
            paredeFrontal = new double[,] { { 0, 0, 6, 6 }, { 0, 4, 4, 0 }, { 0, 0, 0, 0 } };
            paredeLateralE = new double[,] { { 0, 0, -10, -10 }, { 0, 4, 4, 0 }, {0, 0, 0, 0 } };
            telhadoTraseiro = new double[,] { { 0, 3, 0, -10 }, { 4, 6, 4, 4 }, { 0, 0, 0, 0 } };
            telhadoFrontal = new double[,] { { 6, 0, 3 }, { 4, 4, 6 }, { 0, 0, 0} };
            telhadoLateralE = new double[,] { { 0, 0, -10, -10 }, { 4, 6, 6, 4 }, { 0, 0, 0, 0 } };
 
            corParedeFrontal = new Vector3(1.0f, 1.0f, 1.0f);
            corParedeLateral = new Vector3(1.0f, 1.0f, 1.0f);
            corTelhado = new Vector3(1.0f, 0.0f, 0.0f);
        }
 
        public double getX(int idx, double[,] matriz)
        {
            return matriz[0, idx];
        }
 
        public double getY(int idx, double[,] matriz)
        {
            return matriz[1, idx];
        }
    }
}
  1. My first issue is how do i draw the axis x y z with the plane xy at z=50?
  2. The Second issue is to insert the paredeFrontal (front wall), paredeLateralE (left side wall) and telhadoFrontal (front roof) using only translations without push/popMatrix while the front wall must be on the plane z=50 as well


It may be simple coding but its just for u to see how much we are deprived of actuall coding lessons from this teacher...and this is jsut the first 2 steps of the 2nd phase of our laboratory exercises (theres more 2)

Best Regards