Sep 25, 2012 at 4:22 AM
Edited Sep 25, 2012 at 5:09 AM
* I WAS UNAWARE OF SHARPGL's PLANNED FEATURES OF 2.1 WHEN I MADE THIS POST*
I cannot seem to get the texture to wrap to polygon object in Scene Graph^ I can create the texture but when it renders it the colors, position are all totally off...
using the methods built in for opening model files and rendering
textures is there a special way to achieve what im trying to do. Its like everything is there but things are broken
I also noticed you cannot add Polygon as a child to scene class tree acts very wierd. With the limited resources on this topic I made this post hope someone can point me in right direction.
ALL I NEED IS (NOT SIMPLE IN SHARPGL)
1. Open Model File -> to (Polygon)
2. Display Model With Texture
EXAMPLE OF TEXTURE RENDER
CURRENT CODE -> Renders Object & Texture but color on texture is bad and tex cords are off.
I thought it was model but it renders perfectly fine on 3d max, blender and my old scene graph editor I was making in OpenTK sucks cause opengl 3.2 limitations.
#REGION -> Open File
OpenFileDialog openDialog = new OpenFileDialog();
openDialog.Filter = SerializationEngine.Instance.Filter;
if (openDialog.ShowDialog() == DialogResult.OK)
Scene scene = SerializationEngine.Instance.LoadScene(openDialog.FileName);
if (scene != null)
foreach (var polygon in scene.SceneContainer.Traverse<Polygon>())
// Get the bounds of the polygon.
BoundingVolume boundingVolume = polygon.BoundingVolume;
float extent = new float;
polygon.BoundingVolume.GetBoundDimensions(out extent, out extent, out extent);
// Get the max extent.
float maxExtent = extent.Max();
// Scale so that we are at most 10 units in size.
float scaleFactor = maxExtent > 10 ? 10.0f / maxExtent : 1;
polygon.Transformation.ScaleX = scaleFactor;
polygon.Transformation.ScaleY = scaleFactor;
polygon.Transformation.ScaleZ = scaleFactor;
foreach (Polygon polygon in polygons)