protected override void OnLoad(EventArgs e) { GL.ClearColor(Color4.CadetBlue); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Texture2D); VertexObjectGroupDefinition vertexGroupDefinition = new VertexObjectGroupDefinition(Properties.Resources.VertexShader, Properties.Resources.FragmentShader); vertexGroup = new VertexObjectGroup(vertexGroupDefinition); this.disposables.Add(vertexGroup); #region Models WavefrontModel model = new WavefrontModelLoader().Load(new FileInfo(@"C:\Users\pstepnowski\Documents\untitled.obj")); RenderableModel modelSphere = vertexGroup.Add(model); #endregion #region Scene Objects race = new Race(200); vertexGroup.Add(modelSphere, race.Spheres); playerSceneSphere = vertexGroup.Renderables.OfType <SceneSphere>().First(s => s.Sphere == race.PlayerSphere); #endregion Camera camera1 = new Camera(Width, Height); camera1.position = new Vector3(5, 2, 5); CameraFollow camera2 = new CameraFollow(Width, Height, playerSceneSphere); camera2.position = new Vector3(5, 2, 5); this.cameras.Add(camera2); TexturedObjectGroupDefinition texturedGroupDefinition = new TexturedObjectGroupDefinition(Properties.Resources.VertexShaderTextured, Properties.Resources.FragmentShaderTextured); texturedGroup = new TexturedObjectGroup(texturedGroupDefinition); this.disposables.Add(texturedGroup); FileInfo textureFile = new FileInfo(@"C:\Users\pstepnowski\Source\Repos\fdafadf\basics\Basics.Physics.Test.UI\Textures\concrete.png"); Texture texture = texturedGroup.LoadTexture(textureFile); TestModelLoader modelLoader = new TestModelLoader(); modelLoader.LoadTrack(texturedGroup, texture); //TexturedModel triangleModel = texturedGroup.Add(race.Ground); //texturedGroup.Add(triangleModel, texture.Handle, new Vector3()); }
public TexturedObjectGroup(TexturedObjectGroupDefinition definition) : base(definition) { ShaderLayout_Position = GL.GetAttribLocation(ShaderProgram.Handle, definition.ShaderLayoutName_Position); ShaderLayout_Texture = GL.GetAttribLocation(ShaderProgram.Handle, definition.ShaderLayoutName_Texture); }