public void Render(int x, int y)
 {
     if (textureID == -1)
     {
         return;
     }
     GL.BindTexture(TextureTarget.Texture2D, textureID);
     RHelp.Draw2DBox(x, y, ImgWidth, ImgHeight, 0f);
 }
Example #2
0
        void PrepareText(TextItem item)
        {
            // If we're modified and have texture already delete it from graphics card
            if (item.TextureID > 0)
            {
                //GL.DeleteTexture(item.TextureID);
                item.TextureID = -1;
            }

            Size s;

            try
            {
                s = TextRenderer.MeasureText(
                    item.Text,
                    item.Font,
                    MaxSize,
                    item.Flags);
            }
            catch
            {
                return;
            }

            item.ImgWidth  = s.Width;
            item.ImgHeight = s.Height;

            if (!RenderSettings.TextureNonPowerOfTwoSupported)
            {
                item.ImgWidth  = RHelp.NextPow2(s.Width);
                item.ImgHeight = RHelp.NextPow2(s.Height);
            }

            Bitmap img = new Bitmap(
                item.ImgWidth,
                item.ImgHeight,
                System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            Graphics g = Graphics.FromImage(img);

            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

            TextRenderer.DrawText(
                g,
                item.Text,
                item.Font,
                new Rectangle(0, 0, s.Width + 2, s.Height + 2),
                Color.White,
                Color.Transparent,
                item.Flags);

            item.TextureID = RHelp.GLLoadImage(img, true, false);
            g.Dispose();
            img.Dispose();
        }
Example #3
0
        void TextureThread()
        {
            PendingTextures.Open();
            Logger.DebugLog("Started Texture Thread");

            while (TextureThreadRunning)
            {
                TextureLoadItem item = null;

                if (!PendingTextures.Dequeue(Timeout.Infinite, ref item))
                {
                    continue;
                }

                if (TexturesPtrMap.ContainsKey(item.TeFace.TextureID))
                {
                    item.Data.TextureInfo = TexturesPtrMap[item.TeFace.TextureID];
                    continue;
                }

                if (LoadTexture(item.TeFace.TextureID, ref item.Data.TextureInfo.Texture, false))
                {
                    Bitmap bitmap = (Bitmap)item.Data.TextureInfo.Texture;

                    bool hasAlpha;
                    if (item.Data.TextureInfo.Texture.PixelFormat == System.Drawing.Imaging.PixelFormat.Format32bppArgb)
                    {
                        hasAlpha = true;
                    }
                    else
                    {
                        hasAlpha = false;
                    }

                    item.Data.TextureInfo.HasAlpha = hasAlpha;

                    bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);

                    var loadOnMainThread = new MethodInvoker(() =>
                    {
                        item.Data.TextureInfo.TexturePointer  = RHelp.GLLoadImage(bitmap, hasAlpha, RenderSettings.HasMipmap);
                        TexturesPtrMap[item.TeFace.TextureID] = item.Data.TextureInfo;
                        bitmap.Dispose();
                        item.Data.TextureInfo.Texture = null;
                        SafeInvalidate();
                    });

                    if (!instance.MonoRuntime || IsHandleCreated)
                    {
                        BeginInvoke(loadOnMainThread);
                    }
                }
            }
            Logger.DebugLog("Texture thread exited");
        }
Example #4
0
        void InitWater()
        {
            Bitmap normal = (Bitmap)Bitmap.FromFile(System.IO.Path.Combine("shader_data", "normalmap.png"));

            reflectionTexture = RHelp.GLLoadImage(normal, false);
            refractionTexture = RHelp.GLLoadImage(normal, false);
            normalmap         = RHelp.GLLoadImage(normal, false);
            depthTexture      = RHelp.GLLoadImage(normal, false);
            dudvmap           = RHelp.GLLoadImage((Bitmap)Bitmap.FromFile(System.IO.Path.Combine("shader_data", "dudvmap.png")), false);
            waterProgram.Load("water.vert", "water.frag");
        }
Example #5
0
        public void End()
        {
            GL.GetInteger(GetPName.Viewport, Viewport);
            ScreenWidth  = Viewport[2];
            ScreenHeight = Viewport[3];
            int stamp = Environment.TickCount;

            GL.Enable(EnableCap.Texture2D);
            GLHUDBegin();
            {
                foreach (TextItem item in textItems)
                {
                    int        hash = GetItemHash(item);
                    CachedInfo tex  = new CachedInfo()
                    {
                        TextureID = -1
                    };
                    if (Cache.ContainsKey(hash))
                    {
                        tex          = Cache[hash];
                        tex.LastUsed = stamp;
                    }
                    else
                    {
                        PrepareText(item);
                        if (item.TextureID != -1)
                        {
                            Cache[hash] = tex = new CachedInfo()
                            {
                                TextureID = item.TextureID,
                                Width     = item.ImgWidth,
                                Height    = item.ImgHeight,
                                LastUsed  = stamp
                            };
                        }
                    }
                    if (tex.TextureID == -1)
                    {
                        continue;
                    }
                    GL.Color4(item.Color);
                    GL.BindTexture(TextureTarget.Texture2D, tex.TextureID);
                    RHelp.Draw2DBox(item.Box.X, ScreenHeight - item.Box.Y - tex.Height, tex.Width, tex.Height, 0f);
                }

                GL.BindTexture(TextureTarget.Texture2D, 0);
                GL.Disable(EnableCap.Texture2D);
                GL.Color4(1f, 1f, 1f, 1f);
            }
            GLHUDEnd();

            textItems.Clear();
        }
 public void Step(float time)
 {
     if (RenderPosition != Position)
     {
         RenderPosition = RHelp.Smoothed1stOrder(RenderPosition, Position, time);
         Modified       = true;
     }
     if (RenderFocalPoint != FocalPoint)
     {
         RenderFocalPoint = RHelp.Smoothed1stOrder(RenderFocalPoint, FocalPoint, time);
         Modified         = true;
     }
 }
        public void PrepareText(int maxWidth)
        {
            if (maxWidth != widthForTextureGenerated)
            {
                string txt = item.From + item.Text;

                // If we're modified and have texture already delete it from graphics card
                if (textureID > 0)
                {
                    GL.DeleteTexture(textureID);
                    textureID = -1;
                }

                TextFormatFlags flags = TextFormatFlags.Top | TextFormatFlags.Left | TextFormatFlags.WordBreak;

                Size s = TextRenderer.MeasureText(
                    txt,
                    ChatOverlay.ChatFont,
                    new Size(maxWidth, 2000), flags);

                ImgWidth  = TextWidth = s.Width;
                ImgHeight = TextHeight = s.Height;

                if (!RenderSettings.TextureNonPowerOfTwoSupported)
                {
                    ImgWidth  = RHelp.NextPow2(TextWidth);
                    ImgHeight = RHelp.NextPow2(TextHeight);
                }

                Bitmap img = new Bitmap(
                    ImgWidth,
                    ImgHeight,
                    System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                Graphics g = Graphics.FromImage(img);

                TextRenderer.DrawText(
                    g,
                    txt,
                    ChatOverlay.ChatFont,
                    new Rectangle(0, ImgHeight - TextHeight, TextWidth + 2, TextHeight + 2),
                    Color.White,
                    Color.Transparent,
                    flags);

                widthForTextureGenerated = maxWidth;
                textureID = RHelp.GLLoadImage(img, true, false);
                g.Dispose();
                img.Dispose();
            }
        }
        /// <summary>
        /// Perform per frame tasks
        /// </summary>
        /// <param name="time">Time since the last call (last frame time in seconds)</param>
        public virtual void Step(float time)
        {
            if (BasePrim == null)
            {
                return;
            }

            // Don't interpolate when parent changes (sit/stand link/unlink)
            if (previousParent != BasePrim.ParentID)
            {
                previousParent       = BasePrim.ParentID;
                InterpolatedPosition = BasePrim.Position;
                InterpolatedRotation = BasePrim.Rotation;
                return;
            }

            // Linear velocity and acceleration
            if (BasePrim.Velocity != Vector3.Zero)
            {
                BasePrim.Position = InterpolatedPosition = BasePrim.Position + BasePrim.Velocity * time
                                                           * 0.98f * RadegastInstance.GlobalInstance.Client.Network.CurrentSim.Stats.Dilation;
                BasePrim.Velocity += BasePrim.Acceleration * time;
            }
            else if (InterpolatedPosition != BasePrim.Position)
            {
                InterpolatedPosition = RHelp.Smoothed1stOrder(InterpolatedPosition, BasePrim.Position, time);
            }

            // Angular velocity (target omega)
            if (BasePrim.AngularVelocity != Vector3.Zero)
            {
                Vector3    angVel = BasePrim.AngularVelocity;
                float      angle  = time * angVel.Length();
                Quaternion dQ     = Quaternion.CreateFromAxisAngle(angVel, angle);
                InterpolatedRotation = dQ * InterpolatedRotation;
            }
            else if (InterpolatedRotation != BasePrim.Rotation && !(this is RenderAvatar))
            {
                InterpolatedRotation = Quaternion.Slerp(InterpolatedRotation, BasePrim.Rotation, time * 10f);
                if (1f - Math.Abs(Quaternion.Dot(InterpolatedRotation, BasePrim.Rotation)) < 0.0001)
                {
                    InterpolatedRotation = BasePrim.Rotation;
                }
            }
            else
            {
                InterpolatedRotation = BasePrim.Rotation;
            }
        }
Example #9
0
        public override void Render(RenderPass pass, int pickingID, SceneWindow scene, float time)
        {
            terrainTimeSinceUpdate += time;

            if (Modified && terrainTimeSinceUpdate > RenderSettings.MinimumTimeBetweenTerrainUpdated)
            {
                if (!terrainInProgress)
                {
                    terrainInProgress = true;
                    ResetTerrain(false);
                    UpdateTerrain();
                }
            }

            if (terrainTextureNeedsUpdate)
            {
                UpdateTerrainTexture();
            }

            if (terrainIndices == null || terrainVertices == null)
            {
                return;
            }

            GL.Color3(1f, 1f, 1f);
            GL.EnableClientState(ArrayCap.VertexArray);
            GL.EnableClientState(ArrayCap.TextureCoordArray);
            GL.EnableClientState(ArrayCap.NormalArray);
            if (pass == RenderPass.Picking)
            {
                GL.EnableClientState(ArrayCap.ColorArray);
                GL.ShadeModel(ShadingModel.Flat);
            }

            if (terrainImage != null)
            {
                if (terrainTexture != -1)
                {
                    GL.DeleteTexture(terrainTexture);
                }

                terrainTexture = RHelp.GLLoadImage(terrainImage, false);
                terrainImage.Dispose();
                terrainImage = null;
            }

            if (pass != RenderPass.Picking && terrainTexture != -1)
            {
                GL.Enable(EnableCap.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, terrainTexture);
            }

            if (!RenderSettings.UseVBO || terrainVBOFailed)
            {
                unsafe
                {
                    fixed(float *normalPtr = &terrainVertices[0].Vertex.Normal.X)
                    fixed(float *texPtr  = &terrainVertices[0].Vertex.TexCoord.X)
                    fixed(byte *colorPtr = &terrainVertices[0].Color.R)
                    {
                        GL.NormalPointer(NormalPointerType.Float, ColorVertex.Size, (IntPtr)normalPtr);
                        GL.TexCoordPointer(2, TexCoordPointerType.Float, ColorVertex.Size, (IntPtr)texPtr);
                        GL.VertexPointer(3, VertexPointerType.Float, ColorVertex.Size, terrainVertices);
                        if (pass == RenderPass.Picking)
                        {
                            GL.ColorPointer(4, ColorPointerType.UnsignedByte, ColorVertex.Size, (IntPtr)colorPtr);
                        }
                        GL.DrawElements(BeginMode.Triangles, terrainIndices.Length, DrawElementsType.UnsignedInt, terrainIndices);
                    }
                }
            }
            else
            {
                if (terrainVBO == -1)
                {
                    Compat.GenBuffers(out terrainVBO);
                    Compat.BindBuffer(BufferTarget.ArrayBuffer, terrainVBO);
                    Compat.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(terrainVertices.Length * ColorVertex.Size), terrainVertices, BufferUsageHint.StaticDraw);
                    if (Compat.BufferSize(BufferTarget.ArrayBuffer) != terrainVertices.Length * ColorVertex.Size)
                    {
                        terrainVBOFailed = true;
                        Compat.BindBuffer(BufferTarget.ArrayBuffer, 0);
                        terrainVBO = -1;
                    }
                }
                else
                {
                    Compat.BindBuffer(BufferTarget.ArrayBuffer, terrainVBO);
                }

                if (terrainIndexVBO == -1)
                {
                    Compat.GenBuffers(out terrainIndexVBO);
                    Compat.BindBuffer(BufferTarget.ElementArrayBuffer, terrainIndexVBO);
                    Compat.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(terrainIndices.Length * sizeof(uint)), terrainIndices, BufferUsageHint.StaticDraw);
                    if (Compat.BufferSize(BufferTarget.ElementArrayBuffer) != terrainIndices.Length * sizeof(uint))
                    {
                        terrainVBOFailed = true;
                        Compat.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
                        terrainIndexVBO = -1;
                    }
                }
                else
                {
                    Compat.BindBuffer(BufferTarget.ElementArrayBuffer, terrainIndexVBO);
                }

                if (!terrainVBOFailed)
                {
                    GL.NormalPointer(NormalPointerType.Float, ColorVertex.Size, (IntPtr)12);
                    GL.TexCoordPointer(2, TexCoordPointerType.Float, ColorVertex.Size, (IntPtr)(24));
                    if (pass == RenderPass.Picking)
                    {
                        GL.ColorPointer(4, ColorPointerType.UnsignedByte, ColorVertex.Size, (IntPtr)32);
                    }
                    GL.VertexPointer(3, VertexPointerType.Float, ColorVertex.Size, (IntPtr)(0));

                    GL.DrawElements(BeginMode.Triangles, terrainIndices.Length, DrawElementsType.UnsignedInt, IntPtr.Zero);
                }

                Compat.BindBuffer(BufferTarget.ArrayBuffer, 0);
                Compat.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
            }

            if (pass == RenderPass.Picking)
            {
                GL.DisableClientState(ArrayCap.ColorArray);
                GL.ShadeModel(ShadingModel.Smooth);
            }
            else
            {
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
            GL.DisableClientState(ArrayCap.VertexArray);
            GL.DisableClientState(ArrayCap.TextureCoordArray);
            GL.DisableClientState(ArrayCap.NormalArray);
        }
        /// <summary>
        /// Render Primitive
        /// </summary>
        /// <param name="pass">Which pass are we currently in</param>
        /// <param name="pickingID">ID used to identify which object was picked</param>
        /// <param name="scene">Main scene renderer</param>
        /// <param name="time">Time it took to render the last frame</param>
        public override void Render(RenderPass pass, int pickingID, SceneWindow scene, float time)
        {
            //if (!RenderSettings.AvatarRenderingEnabled && Attached) return;//hack

            // Individual prim matrix
            GL.PushMatrix();

            // Prim roation and position and scale
            GL.MultMatrix(Math3D.CreateSRTMatrix(Prim.Scale, RenderRotation, RenderPosition));

            // Do we have animated texture on this face
            bool animatedTexture = false;

            // Initialise flags tracking what type of faces this prim has
            if (pass == RenderPass.Simple)
            {
                HasSimpleFaces = false;
            }
            else if (pass == RenderPass.Alpha)
            {
                HasAlphaFaces = false;
            }
            else if (pass == RenderPass.Invisible)
            {
                HasInvisibleFaces = false;
            }

            // Draw the prim faces
            for (int j = 0; j < Faces.Count; j++)
            {
                Primitive.TextureEntryFace teFace = Prim.Textures.GetFace((uint)j);
                Face     face = Faces[j];
                FaceData data = (FaceData)face.UserData;

                if (data == null)
                {
                    continue;
                }

                if (teFace == null)
                {
                    continue;
                }

                // Don't render transparent faces
                Color4 RGBA = teFace.RGBA;

                if (data.TextureInfo.FullAlpha || RGBA.A <= 0.01f)
                {
                    continue;
                }

                bool switchedLightsOff = false;

                if (pass == RenderPass.Picking)
                {
                    data.PickingID = pickingID;
                    var primNrBytes = Utils.UInt16ToBytes((ushort)pickingID);
                    var faceColor   = new byte[] { primNrBytes[0], primNrBytes[1], (byte)j, 255 };
                    GL.Color4(faceColor);
                }
                else if (pass == RenderPass.Invisible)
                {
                    if (!data.TextureInfo.IsInvisible)
                    {
                        continue;
                    }
                    HasInvisibleFaces = true;
                }
                else
                {
                    if (data.TextureInfo.IsInvisible)
                    {
                        continue;
                    }
                    bool belongToAlphaPass = (RGBA.A < 0.99f) || (data.TextureInfo.HasAlpha && !data.TextureInfo.IsMask);

                    if (belongToAlphaPass && pass != RenderPass.Alpha)
                    {
                        continue;
                    }
                    if (!belongToAlphaPass && pass == RenderPass.Alpha)
                    {
                        continue;
                    }

                    if (pass == RenderPass.Simple)
                    {
                        HasSimpleFaces = true;
                    }
                    else if (pass == RenderPass.Alpha)
                    {
                        HasAlphaFaces = true;
                    }

                    if (teFace.Fullbright)
                    {
                        GL.Disable(EnableCap.Lighting);
                        switchedLightsOff = true;
                    }

                    float shiny = 0f;
                    switch (teFace.Shiny)
                    {
                    case Shininess.High:
                        shiny = 0.96f;
                        break;

                    case Shininess.Medium:
                        shiny = 0.64f;
                        break;

                    case Shininess.Low:
                        shiny = 0.24f;
                        break;
                    }

                    if (shiny > 0f)
                    {
                        scene.StartShiny();
                    }
                    GL.Material(MaterialFace.Front, MaterialParameter.Shininess, shiny);
                    var faceColor = new float[] { RGBA.R, RGBA.G, RGBA.B, RGBA.A };
                    GL.Color4(faceColor);

                    GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] { 0.5f, 0.5f, 0.5f, 1f });

                    if (data.TextureInfo.TexturePointer == 0)
                    {
                        TextureInfo teInfo;
                        if (scene.TryGetTextureInfo(teFace.TextureID, out teInfo))
                        {
                            data.TextureInfo = teInfo;
                        }
                    }

                    if (data.TextureInfo.TexturePointer == 0)
                    {
                        GL.Disable(EnableCap.Texture2D);
                        if (!data.TextureInfo.FetchFailed)
                        {
                            scene.DownloadTexture(new TextureLoadItem()
                            {
                                Prim   = this.Prim,
                                TeFace = teFace,
                                Data   = data
                            }, false);
                        }
                    }
                    else
                    {
                        // Is this face using texture animation
                        if ((Prim.TextureAnim.Flags & Primitive.TextureAnimMode.ANIM_ON) != 0 &&
                            (Prim.TextureAnim.Face == j || Prim.TextureAnim.Face == 255))
                        {
                            if (data.AnimInfo == null)
                            {
                                data.AnimInfo = new TextureAnimationInfo();
                            }
                            data.AnimInfo.PrimAnimInfo = Prim.TextureAnim;
                            data.AnimInfo.Step(time);
                            animatedTexture = true;
                        }
                        else if (data.AnimInfo != null) // Face texture not animated. Do we have previous anim setting?
                        {
                            data.AnimInfo = null;
                        }

                        GL.Enable(EnableCap.Texture2D);
                        GL.BindTexture(TextureTarget.Texture2D, data.TextureInfo.TexturePointer);
                    }
                }
                //hack

                /*
                 * if (!RenderSettings.UseVBO || data.VBOFailed)
                 * {
                 * Vertex[] verts = face.Vertices.ToArray();
                 * ushort[] indices = face.Indices.ToArray();
                 *
                 * unsafe
                 * {
                 * fixed (float* normalPtr = &verts[0].Normal.X)
                 * fixed (float* texPtr = &verts[0].TexCoord.X)
                 * {
                 * GL.NormalPointer(NormalPointerType.Float, FaceData.VertexSize, (IntPtr)normalPtr);
                 * GL.TexCoordPointer(2, TexCoordPointerType.Float, FaceData.VertexSize, (IntPtr)texPtr);
                 * GL.VertexPointer(3, VertexPointerType.Float, FaceData.VertexSize, verts);
                 * GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedShort, indices);
                 * }
                 * }
                 * }
                 * else
                 * {
                 * if (data.CheckVBO(face))
                 * {
                 * Compat.BindBuffer(BufferTarget.ArrayBuffer, data.VertexVBO);
                 * Compat.BindBuffer(BufferTarget.ElementArrayBuffer, data.IndexVBO);
                 * GL.NormalPointer(NormalPointerType.Float, FaceData.VertexSize, (IntPtr)12);
                 * GL.TexCoordPointer(2, TexCoordPointerType.Float, FaceData.VertexSize, (IntPtr)(24));
                 * GL.VertexPointer(3, VertexPointerType.Float, FaceData.VertexSize, (IntPtr)(0));
                 *
                 * GL.DrawElements(BeginMode.Triangles, face.Indices.Count, DrawElementsType.UnsignedShort, IntPtr.Zero);
                 * }
                 * Compat.BindBuffer(BufferTarget.ArrayBuffer, 0);
                 * Compat.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
                 *
                 * }
                 */
                if (switchedLightsOff)
                {
                    GL.Enable(EnableCap.Lighting);
                    switchedLightsOff = false;
                }
            }

            GL.BindTexture(TextureTarget.Texture2D, 0);
            RHelp.ResetMaterial();

            // Reset texture coordinates if we modified them in texture animation
            if (animatedTexture)
            {
                GL.MatrixMode(MatrixMode.Texture);
                GL.LoadIdentity();
                GL.MatrixMode(MatrixMode.Modelview);
            }

            // Pop the prim matrix
            GL.PopMatrix();

            base.Render(pass, pickingID, scene, time);
        }
        public void RenderChat(float time, RenderPass pass)
        {
            runningTime += time;
            if (chatLines.Count == 0)
            {
                return;
            }

            int c       = 0;
            int expired = 0;

            screenWidth  = Window.Viewport[2];
            screenHeight = Window.Viewport[3];
            ChatLine[] lines;

            lock (chatLines)
            {
                lines = chatLines.ToArray();
                c     = lines.Length;
                for (int i = 0; i < c; i++)
                {
                    if ((runningTime - lines[i].TimeAdded) > ChatLineTimeOnScreen)
                    {
                        expired++;
                        ChatLine goner = chatLines.Dequeue();
                        goner.Dispose();
                    }
                    else
                    {
                        break;
                    }
                }
                if (expired > 0)
                {
                    lines = chatLines.ToArray();
                    c     = lines.Length;
                }
            }

            if (c == 0)
            {
                runningTime = 0f;
                return;
            }

            int maxWidth = (int)((float)screenWidth * 0.7f);

            int actualMaxWidth = 0;
            int height         = 0;

            for (int i = 0; i < c; i++)
            {
                lines[i].PrepareText(maxWidth);
                if (lines[i].TextWidth > actualMaxWidth)
                {
                    actualMaxWidth = lines[i].TextWidth;
                }
                height += lines[i].TextHeight;
            }

            int x = 5;
            int y = 5;

            GL.Enable(EnableCap.Texture2D);
            GL.Color4(ChatBackground);
            RHelp.Draw2DBox(x, y, actualMaxWidth + 6, height + 10, 1f);
            for (int i = c - 1; i >= 0; i--)
            {
                ChatLine line = lines[i];
                OpenTK.Graphics.Color4 color = GetColorForStyle(line.Style);
                float remain = ChatLineTimeOnScreen - (runningTime - line.TimeAdded);
                if (remain < ChatLineFade)
                {
                    color.A = remain / ChatLineFade;
                }
                GL.Color4(color);
                line.Render(x + 3, y + 5);
                y += line.TextHeight;
            }
            GL.BindTexture(TextureTarget.Texture2D, 0);
            GL.Disable(EnableCap.Texture2D);
            GL.Color4(1f, 1f, 1f, 1f);
        }