DrawTexture in DRAWPASS_HANDLES [SOLVED]



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/05/2011 at 07:43, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R12.043 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi everybody,
    I want to Display some text on screen which only should be drawn when my object is selected. To achieve this I create a GeClipMap at Viewport-resolution and draw the strings onto it. At the end I draw it on Screen using the DrawTexture function. This works fine in DRAWPASS_OBJECT but in DRAWPASS_HANDLES nothing is drawn on screen.
    Thanks for any help!
    Satara



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/05/2011 at 09:23, xxxxxxxx wrote:

    Yes that is right. What exactly is your question?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/05/2011 at 16:14, xxxxxxxx wrote:

    Is it not possible to use drawtexture in drawpass_handles?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/05/2011 at 17:18, xxxxxxxx wrote:

    Apparently not. :) Didn't work for me either.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 06/05/2011 at 01:52, xxxxxxxx wrote:

    ok thanks!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/05/2011 at 01:14, xxxxxxxx wrote:

    Another problem:
    How can I draw the Text in front of the geometry (with drawtexture)?
    This is how it looks currently:

    here is the code:
    DRAWRESULT Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh) {
    if (drawpass == DRAWPASS_OBJECT)
    {
    ....
    // render the clip map to the viewport
    bd->SetMatrix_Screen();
    bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);
    Vector pnts[4] = { Vector(0, 0, 0), Vector(0, height, 0), Vector(width, height, 0), Vector(width, 0, 0) };
    Vector cols[4] = { Vector(1, 1, 1), Vector(1, 1, 1), Vector(1, 1, 1), Vector(1, 1, 1) };
    Vector nrms[4] = { Vector(0, 0, -1), Vector(0, 0, -1), Vector(0, 0, -1), Vector(0, 0, -1) };
    Vector uvs[4] = { Vector(0, 0, 0), Vector(0, 1, 0), Vector(1, 1, 0), Vector(1, 0, 0) };
    bd->DrawTexture(clipMap->GetBitmap(), pnts, cols, nrms, uvs, 4, DRAW_ALPHA_NORMAL, DRAW_TEXTUREFLAGS_INTERPOLATION_NEAREST);
    ...
    }



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/05/2011 at 03:55, xxxxxxxx wrote:

    Draw it in the handles drawing pass. Also make sure to use a clockwise texture polygon e.g. { Vector(0,0,0), Vector(1,0,0), Vector(1,1,0), Vector(0,1,0) }.

    Example:

      
    DRAWRESULT RoundedTube::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)  
    {  
      if (drawpass!=DRAWPASS_HANDLES) return DRAWRESULT_SKIP;  
      
      bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
      
      bd->SetMatrix_Screen();  
      
      Vector padr[4] = { Vector(200,200,0), Vector(300,200,0), Vector(300,300,0), Vector(200,300,0) };  
      Vector cadr[4] = { Vector(1,1,1), Vector(1,1,1), Vector(1,1,1), Vector(1,1,1) };  
      Vector nadr[4] = { Vector(0,0,-1), Vector(0,0,-1), Vector(0,0,-1), Vector(0,0,-1) };  
      Vector uvadr[4] = { Vector(0,0,0), Vector(1,0,0), Vector(1,1,0), Vector(0,1,0) };  
      
      bd->DrawTexture(bmp, padr, cadr, nadr, uvadr, 4, DRAW_ALPHA_NONE, DRAW_TEXTUREFLAGS_0);  
      
      return DRAWRESULT_OK;  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/05/2011 at 04:53, xxxxxxxx wrote:

    Ah! Cool. thx, very good to know :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/05/2011 at 12:39, xxxxxxxx wrote:

    Looks perfect, thx a lot Matthias!



  • On 06/08/2014 at 19:40, xxxxxxxx wrote:

    Hi All, but if is draw in the Handle time, the texture will be not visibile if the object is not selected.

    regards
    Renato


Log in to reply