Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. SharpGL: how to add a solid object to a scene

SharpGL: how to add a solid object to a scene

Scheduled Pinned Locked Moved Graphics
architecturetutorial
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10724844
    wrote on last edited by
    #1

    I am using SharpGL to add a solid object to a scene by clicking a button. private void InitElements(Scene scene) { var objectRoot = new SharpGL.SceneGraph.Primitives.Folder() { Name = "Root" }; scene.SceneContainer.AddChild(objectRoot); // This implements free rotation(with translation and rotation). var camera = GetCamera(); float cmX = camera.Position.X; float cmY = camera.Position.Y; float cmZ = camera.Position.Z; float tgX = camera.Target.X; float tgY = camera.Target.Y; float tgZ = camera.Target.Z; float upX = camera.UpVector.X; float upY = camera.UpVector.Y; float upZ = camera.UpVector.Z; objectArcBallEffect = new ArcBallEffect(cmX, cmY, cmZ, tgX, tgY, tgZ, upX, upY, upZ); objectRoot.AddEffect(objectArcBallEffect); var axisRoot = new SharpGL.SceneGraph.Primitives.Folder() { Name = "axis root" }; scene.SceneContainer.AddChild(axisRoot); axisArcBallEffect = new ArcBallEffect(cmX, cmY, cmZ, tgX, tgY, tgZ, upX, upY, upZ); axisRoot.AddEffect(axisArcBallEffect); InitLight(objectRoot); InitAxis(objectRoot); InitAxis(axisRoot); InitFrameElement(6, 24, 7, objectRoot); } After I initiate the solid elements in scene, I would like to add a solid object to that scene by clicking a button. I successfully add it in scene. But I cannot drag and rotate it with the initial elements in the scene. It means I didn't successfully add it to the same scene. Thanks in advance. private void btnAddEllement_Click(object sender, EventArgs e) { var objectRoot = new SharpGL.SceneGraph.Primitives.Folder() { Name = "Root" }; var scene = this.sceneControl1.Scene; addCylinder(objectRoot, 50, 30, 100, 5); scene.SceneContainer.AddChild(objectRoot); }

    L 1 Reply Last reply
    0
    • U User 10724844

      I am using SharpGL to add a solid object to a scene by clicking a button. private void InitElements(Scene scene) { var objectRoot = new SharpGL.SceneGraph.Primitives.Folder() { Name = "Root" }; scene.SceneContainer.AddChild(objectRoot); // This implements free rotation(with translation and rotation). var camera = GetCamera(); float cmX = camera.Position.X; float cmY = camera.Position.Y; float cmZ = camera.Position.Z; float tgX = camera.Target.X; float tgY = camera.Target.Y; float tgZ = camera.Target.Z; float upX = camera.UpVector.X; float upY = camera.UpVector.Y; float upZ = camera.UpVector.Z; objectArcBallEffect = new ArcBallEffect(cmX, cmY, cmZ, tgX, tgY, tgZ, upX, upY, upZ); objectRoot.AddEffect(objectArcBallEffect); var axisRoot = new SharpGL.SceneGraph.Primitives.Folder() { Name = "axis root" }; scene.SceneContainer.AddChild(axisRoot); axisArcBallEffect = new ArcBallEffect(cmX, cmY, cmZ, tgX, tgY, tgZ, upX, upY, upZ); axisRoot.AddEffect(axisArcBallEffect); InitLight(objectRoot); InitAxis(objectRoot); InitAxis(axisRoot); InitFrameElement(6, 24, 7, objectRoot); } After I initiate the solid elements in scene, I would like to add a solid object to that scene by clicking a button. I successfully add it in scene. But I cannot drag and rotate it with the initial elements in the scene. It means I didn't successfully add it to the same scene. Thanks in advance. private void btnAddEllement_Click(object sender, EventArgs e) { var objectRoot = new SharpGL.SceneGraph.Primitives.Folder() { Name = "Root" }; var scene = this.sceneControl1.Scene; addCylinder(objectRoot, 50, 30, 100, 5); scene.SceneContainer.AddChild(objectRoot); }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please do not repost, see http://www.codeproject.com/Messages/1278604/How-to-get-an-answer-to-your-question.aspx[^], especially point 1.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups