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. Bezier Curve issue

Bezier Curve issue

Scheduled Pinned Locked Moved Graphics
helpgraphicsgame-devtutorialquestion
4 Posts 4 Posters 2 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.
  • P Offline
    P Offline
    pvpeng
    wrote on last edited by
    #1

    Hi all, 4 points are defined as follows:

    float[,] ctrlpoints = new float [4,3] {{ -4.0f, -4.0f, 0.0f }, { -2.0f, 4.0f, 0.0f }, { 2.0f, -4.0f, 0.0f }, { 4.0f, 4.0f, 0.0f }};

    When the 4 points are called in following method:

    private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
    {
    // Get the OpenGL object.
    OpenGL gl = openGLControl.OpenGL;

    //  Clear the color and depth buffer.
    gl.Clear(OpenGL.GL\_COLOR\_BUFFER\_BIT | OpenGL.GL\_DEPTH\_BUFFER\_BIT);
    
    int i;
    
    gl.Color(1.0f, 1.0f, 1.0f);
    gl.Begin(OpenGL.GL\_LINE\_STRIP);
    for (i = 0; i <= 30; i++)
    {
        gl.EvalCoord1((float)i / 30.0);
    }
    gl.End();
    // display the control points
    gl.PointSize(5.0f);
    gl.Color(1.0f, 1.0f, 0.0f);
    gl.Begin(OpenGL.GL\_POINTS);
    for (i = 0; i < 4; i++)
    {
        gl.Vertex(&ctrlpoints\[i\]\[0\]);
    }
    gl.End();
    gl.Flush();
    

    }

    The &ctrlpoints[i][0] in gl.Vertex(&ctrlpoints[i][0]) was displayed to be an error. How to fix the problem? Thanks!

    Richard DeemingR L B 3 Replies Last reply
    0
    • P pvpeng

      Hi all, 4 points are defined as follows:

      float[,] ctrlpoints = new float [4,3] {{ -4.0f, -4.0f, 0.0f }, { -2.0f, 4.0f, 0.0f }, { 2.0f, -4.0f, 0.0f }, { 4.0f, 4.0f, 0.0f }};

      When the 4 points are called in following method:

      private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
      {
      // Get the OpenGL object.
      OpenGL gl = openGLControl.OpenGL;

      //  Clear the color and depth buffer.
      gl.Clear(OpenGL.GL\_COLOR\_BUFFER\_BIT | OpenGL.GL\_DEPTH\_BUFFER\_BIT);
      
      int i;
      
      gl.Color(1.0f, 1.0f, 1.0f);
      gl.Begin(OpenGL.GL\_LINE\_STRIP);
      for (i = 0; i <= 30; i++)
      {
          gl.EvalCoord1((float)i / 30.0);
      }
      gl.End();
      // display the control points
      gl.PointSize(5.0f);
      gl.Color(1.0f, 1.0f, 0.0f);
      gl.Begin(OpenGL.GL\_POINTS);
      for (i = 0; i < 4; i++)
      {
          gl.Vertex(&ctrlpoints\[i\]\[0\]);
      }
      gl.End();
      gl.Flush();
      

      }

      The &ctrlpoints[i][0] in gl.Vertex(&ctrlpoints[i][0]) was displayed to be an error. How to fix the problem? Thanks!

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Which language are you using? Most of your syntax looks like C#, but &ctrlpoints[i][0] looks like C++ (or possibly C# in an unsafe context). If it's C#, what's the signature of the Vertex method in the Object Browser?


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • P pvpeng

        Hi all, 4 points are defined as follows:

        float[,] ctrlpoints = new float [4,3] {{ -4.0f, -4.0f, 0.0f }, { -2.0f, 4.0f, 0.0f }, { 2.0f, -4.0f, 0.0f }, { 4.0f, 4.0f, 0.0f }};

        When the 4 points are called in following method:

        private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
        {
        // Get the OpenGL object.
        OpenGL gl = openGLControl.OpenGL;

        //  Clear the color and depth buffer.
        gl.Clear(OpenGL.GL\_COLOR\_BUFFER\_BIT | OpenGL.GL\_DEPTH\_BUFFER\_BIT);
        
        int i;
        
        gl.Color(1.0f, 1.0f, 1.0f);
        gl.Begin(OpenGL.GL\_LINE\_STRIP);
        for (i = 0; i <= 30; i++)
        {
            gl.EvalCoord1((float)i / 30.0);
        }
        gl.End();
        // display the control points
        gl.PointSize(5.0f);
        gl.Color(1.0f, 1.0f, 0.0f);
        gl.Begin(OpenGL.GL\_POINTS);
        for (i = 0; i < 4; i++)
        {
            gl.Vertex(&ctrlpoints\[i\]\[0\]);
        }
        gl.End();
        gl.Flush();
        

        }

        The &ctrlpoints[i][0] in gl.Vertex(&ctrlpoints[i][0]) was displayed to be an error. How to fix the problem? Thanks!

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

        pvpeng wrote:

        was displayed to be an error.

        What error; please do not expect people to guess what messages you are seeing. I cannot find a description for either a Vertex function, or class constructor; is this something you have created yourself?

        1 Reply Last reply
        0
        • P pvpeng

          Hi all, 4 points are defined as follows:

          float[,] ctrlpoints = new float [4,3] {{ -4.0f, -4.0f, 0.0f }, { -2.0f, 4.0f, 0.0f }, { 2.0f, -4.0f, 0.0f }, { 4.0f, 4.0f, 0.0f }};

          When the 4 points are called in following method:

          private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
          {
          // Get the OpenGL object.
          OpenGL gl = openGLControl.OpenGL;

          //  Clear the color and depth buffer.
          gl.Clear(OpenGL.GL\_COLOR\_BUFFER\_BIT | OpenGL.GL\_DEPTH\_BUFFER\_BIT);
          
          int i;
          
          gl.Color(1.0f, 1.0f, 1.0f);
          gl.Begin(OpenGL.GL\_LINE\_STRIP);
          for (i = 0; i <= 30; i++)
          {
              gl.EvalCoord1((float)i / 30.0);
          }
          gl.End();
          // display the control points
          gl.PointSize(5.0f);
          gl.Color(1.0f, 1.0f, 0.0f);
          gl.Begin(OpenGL.GL\_POINTS);
          for (i = 0; i < 4; i++)
          {
              gl.Vertex(&ctrlpoints\[i\]\[0\]);
          }
          gl.End();
          gl.Flush();
          

          }

          The &ctrlpoints[i][0] in gl.Vertex(&ctrlpoints[i][0]) was displayed to be an error. How to fix the problem? Thanks!

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #4

          Didn't you understand the answer to your previous question http://www.codeproject.com/Messages/4850994/How-to-write-an-element-address-of-array-in-Csharp.aspx[^]? You must use the unsafe keyword and use its respective compiler option.

          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