title: iOS cocos2d v3 convert openGL code to CCDrawNode
body: <p>I have a visit method for the dot indicator of my Sliding Menu Grid. </p>
  
  <pre><code>- (void) visit
  {
      [super visit];//&lt; Will draw after glPopScene.
  
      BOOL showPagesIndicator = YES;
  
  
      ccColor4B pagesIndicatorNormalColor_ = ccc4([sud integerForKey:key_int_r], [sud integerForKey:key_int_g], [sud integerForKey:key_int_b], 255);
      ccColor4B pagesIndicatorSelectedColor_ = ccc4(255, 255, 255, 255);
      if (showPagesIndicator)
      {
          int totalScreens = iPageCount;
  
          // Prepare Points Array
          CGFloat n = (CGFloat)totalScreens; //&lt; Total points count in CGFloat.
          CGFloat pY = pageIndicatorPosition.y; //&lt; Points y-coord in parent coord sys.
          CGFloat d = may_double(16.0f); //&lt; Distance between points.
          CGPoint points[totalScreens];
          for (int i=0; i &lt; totalScreens; ++i)
          {
              CGFloat pX = pageIndicatorPosition.x + d * ( (CGFloat)i - 0.5f*(n-1.0f) );
              points[i] = ccp (pX, pY);
          }
  
          // Set GL Values
  #if COCOS2D_VERSION &gt;= 0x00020000
  //        ccGLEnable(CC_GL_BLEND);
          ccPointSize( may_double(6.0 * CC_CONTENT_SCALE_FACTOR()) );
  #define DRAW_4B_FUNC ccDrawColor4B
  
  #else
          glEnable(GL_POINT_SMOOTH);
          GLboolean blendWasEnabled = glIsEnabled( GL_BLEND );
          glEnable(GL_BLEND);
  
          // save the old blending functions
          int blend_src = 0;
          int blend_dst = 0;
          glGetIntegerv( GL_BLEND_SRC, &amp;blend_src );
          glGetIntegerv( GL_BLEND_DST, &amp;blend_dst );
          glPointSize( may_double(6.0 * CC_CONTENT_SCALE_FACTOR()) );
  
  #define DRAW_4B_FUNC glColor4ub
  
  #endif
          ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  //        glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
  
  
          // Draw Gray Points
          DRAW_4B_FUNC(pagesIndicatorNormalColor_.r,
                       pagesIndicatorNormalColor_.g,
                       pagesIndicatorNormalColor_.b,
                       pagesIndicatorNormalColor_.a);
  
          ccDrawPoints( points, totalScreens );
  
          // Draw White Point for Selected Page
          DRAW_4B_FUNC(pagesIndicatorSelectedColor_.r,
                       pagesIndicatorSelectedColor_.g,
                       pagesIndicatorSelectedColor_.b,
                       pagesIndicatorSelectedColor_.a);
          ccDrawPoint(points[iCurrentPage]);
  
          // Restore GL Values
  #if COCOS2D_VERSION &gt;= 0x00020000
          ccPointSize(1.0f);
  #else
          glPointSize(1.0f);
          glDisable(GL_POINT_SMOOTH);
          if (! blendWasEnabled)
              glDisable(GL_BLEND);
  
          // always restore the blending functions too
          ccGLBlendFunc( blend_src, blend_dst);
  //        glBlendFunc( blend_src, blend_dst );
  #endif
      }
  }
  </code></pre>
  
  <p>It worked fine for my earlier projects but not working for cocos2d v3. I get errors (not valid for C99 etc) for almost every openGL statements, such as <code>glPointSize/ccPointSize</code> and <code>glColor4ub</code>. I have tried to use CCDrawNode (the OOP way) but still it's not one to one translation. (<code>glGetIntegerv</code> etc)</p>
  
  <p>The following link is the test project I created (with errors, notice that the screen is not scrollable, and the dot indicator is not shown (i.e. the <code>visit</code> function is not working)</p>
  
  <p><a href="https://drive.google.com/file/d/0BzH5x38rukpYaVlWdUJPWW9EYWc/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0BzH5x38rukpYaVlWdUJPWW9EYWc/edit?usp=sharing</a></p>
  
  <p>EDIT: 
  I have tried to use     <code>[renderer enqueueMethod:@selector(drawDotIndicators) target:self];</code> and put the visit code in <code>drawDotIndicators</code> method. It is not working either</p>
  
  <p>(the end of this tutorial: <a href="https://www.makegameswith.us/docs/#!/cocos2d/1.1/customrendering" rel="nofollow">https://www.makegameswith.us/docs/#!/cocos2d/1.1/customrendering</a>)</p>