Horde3D

Next-Generation Graphics Engine
It is currently 06.12.2021, 01:17

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 07.04.2012, 09:32 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
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();
   }

_________________
Paul


Top
 Profile  
Reply with quote  
PostPosted: 07.04.2012, 10:27 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1149
Location: Germany
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.


Top
 Profile  
Reply with quote  
PostPosted: 07.04.2012, 13:14 
Offline

Joined: 05.03.2007, 19:38
Posts: 167
Location: Romania
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?

_________________
Paul


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group