public static void RenderPlayer(Camera camera, Player.Player player) { //Create temporary matrix4f and give it the Camera's projection Matrix Matrix4 projection = camera.getProjectionMatrix(); //Send the Camera projection Matrix too the shader! GL.UniformMatrix4(4, false, ref projection); //Make temporary matrix4f of the Camera Matrix4 camerapos = camera.getCameraMatrix(); //Send the camera matrix to the GPU GL.UniformMatrix4(6, false, ref camerapos); //Send the tile positon to the GPU e GL.UniformMatrix4(5, false, ref player.position); //Select the correct texture for rendering from GPU memory GL.BindTexture(TextureTarget.Texture2D, player.TextureBind); //Then call the draw code now that all data is in place for the shaders GL.DrawElements(PrimitiveType.Triangles, Geometry.indices.Length, DrawElementsType.UnsignedInt, 0); }
public static void initializeObjects() { Texture.GenerateTextureArray(2); Texture.genTexture(0, @"Bin/textures/TEXTURE.png"); Texture.genTexture(1, @"Bin/textures/player.png"); Lights = new float[12] { 1.0f, 1.0f, 1f, 9.0f, 1.0f, 3f, 1.0f, 9.0f, 4f, 9.0f, 9.0f, 1f }; LightColors = new float[12] { 1.0f, 1.0f, 1f, 1.0f, 0.7f, 0.3f, 1.0f, 1.0f, 1f, 9.0f, 9.0f, 1f }; floor = new ITile(0); floor.setPosition(1, 1); Dimension = new IDimension(floor, 0.1f, new Vector3(0.0f, 0.0f, 0.0f)); player = new Player.Player(1, true); World = new IWorld(Dimension); camera = new Camera(Renderer.Renderer.width, Renderer.Renderer.height); camera.setCameraPosition(1, 1); World.GenerateWorld(); player.setPosition(-1, -1); }