Exemple #1
0
        private void textureListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (textureListBox.SelectedIndex >= 0)
            {
                NutTexture tex = ((NutTexture)textureListBox.SelectedItem);
                if (tex == null)
                {
                    return;
                }

                // Render the selected texture.
                if (currentNut.glTexByHashId.ContainsKey(tex.HashId))
                {
                    textureToRender = currentNut.glTexByHashId[tex.HashId];
                }

                SetGeneralAndDimensionsText(tex);

                if (tex.surfaces.Count == 6)
                {
                    SetCubeMapText(tex);
                    if (OpenTKSharedResources.SetupStatus == OpenTKSharedResources.SharedResourceStatus.Initialized)
                    {
                        RenderTools.dummyTextures[NUD.DummyTextures.StageMapHigh] = NUT.CreateTextureCubeMap(tex);
                    }
                }
                else
                {
                    SetMipMapText(tex);
                }
            }
            else
            {
                SetDefaultGeneralAndDimensionsText();
            }

            // Render on index changed rather than every frame.
            glControl1.Invalidate();
        }