Horde3D
http://www.horde3d.org/forums/

GL_Line Extension not drawing
http://www.horde3d.org/forums/viewtopic.php?f=1&t=1662
Page 1 of 1

Author:  SpOOky [ 07.04.2012, 09:32 ]
Post subject:  GL_Line Extension not drawing

I'm trying to build an extension that will render the manipulators for an editor. I've based the extension on the terrain one and started with the grid drawn with GL_Line(s).

The node registers and it is outputted in the log, but it doesn't draw anything. I have the following drawing code:

Code:
   void GridNode::renderFunc(uint32 firstItem, uint32 lastItem, const std::string &shaderContext,
      const std::string &theClass, bool debugView, const Frustum *frust1, const Frustum *frust2,
      RenderingOrder::List order, int occSet )
   {
      CameraNode *curCam = Modules::renderer().getCurCamera();
      if( curCam == 0x0 ) return;

      const RenderQueue &renderQueue = Modules::sceneMan().getRenderQueue();

      for( uint32 i = firstItem; i <= lastItem; ++i )
      {
         GridNode *grid = (GridNode *)renderQueue[i].node;

         drawGrid(grid, curCam, frust1, frust2);
      }
   }


   void GridNode::drawGrid(GridNode *grid, CameraNode *cam, const Frustum *frust1, const Frustum *frust2)
   {   
      // TODO fustrum culling check

      glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT |
         GL_ENABLE_BIT | GL_HINT_BIT | GL_LIGHTING_BIT);

      glMatrixMode(GL_PROJECTION);
      glLoadMatrixf(cam->getProjMat().x);

      const float* camTrans = 0;
      cam->getTransMatrices(0, &camTrans);
      Matrix4f transMat (camTrans);
      glMatrixMode(GL_MODELVIEW);
      glLoadMatrixf(transMat.inverted().x);


      glPushMatrix();
      const float* gridTrans = 0;
      grid->getTransMatrices(0, &gridTrans);
      Matrix4f gridTransMat (gridTrans);
      glMultMatrixf(gridTransMat.inverted().x);

      glColor4f(grid->_col_R, grid->_col_G, grid->_col_B, grid->_colMult);
      glBegin(GL_LINE);
      glVertex3f( 0.0f, 0.0f, 0.0f);
      glVertex3f(100.0f, 100.0f, 100.0f);
      glEnd();

      glPopMatrix();
      glPopAttrib();
   }

Author:  Volker [ 07.04.2012, 10:27 ]
Post subject:  Re: GL_Line Extension not drawing

Did you check if the renderFunc has been called? Your may also have to make sure that the rendering code will be done within the correct framebuffer, which may depend on the currently loaded pipeline config. You may also think about using fixed function pipeline mode in an engine based purely on shaders. I used the fixed function pipeline in the Horde3D Editor myself, but wouldn't do it if I had to reimplement it today. And if you want to integrate your code as an extension I really would think about using fixed function code.

Author:  SpOOky [ 07.04.2012, 13:14 ]
Post subject:  Re: GL_Line Extension not drawing

I've placed a breakpoint in GridNode::drawGrid and the programs stops executing, so I know GridNode::renderFunc is called.

Regarding the context, I don't think I placed it in any. How would I do that?

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/