×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    38

    Help needed to display text using openGL ES

    Hello Everyone,

    im trying to write text using opengles in my N95. so i m trying to get help from following function:

    void utilOutputText(CWindowGc & aGc, const TDesC &aString,
    const TPoint &aPosition, const TRgb &aColor )


    This function is included in Utils3d.cpp(Nokia openGL ES). When i try to write the coding like this


    void CSlideshow::AppCycle( TInt aFrame,
    TReal aTimeSecs,
    TReal aDeltaTimeSecs )
    {

    display(aRect);


    ...........
    ...........
    }


    void CSlideshow::display(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear( aRect );


    _LIT(KLoading, "Hello Everyone");
    utilOutputText(SystemGc(), KLoading, TPoint(Size().iWidth /2, Size().iHeight /5 ), KRgbBlack );
    }

    The problem seems to SystemGc() and Tpoint has not found any path/dependency.though i already add
    following header files.

    #include <coecntrl.h>
    #include <GLES\egl.h>
    #include <akndef.h>

    So any solution/comments to solve this....actually i want to display text/string using opengl ES in my program..

    So is there any way to write this?

    Thanks
    Rassall

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Help needed to display text using openGL ES

    Do you have a compiler error, or what?

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    38

    Re: Help needed to display text using openGL ES

    Quote Originally Posted by wizard_hu_ View Post
    Do you have a compiler error, or what?
    Thanks for your reply..

    Yea there is some error. show "undefined identifier 'SystemGc' ".

  4. #4
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: Help needed to display text using openGL ES

    Quote Originally Posted by rassall_jubair View Post
    Yea there is some error. show "undefined identifier 'SystemGc' ".
    Check in SDK help:
    Code:
    #include <COEMAIN.H> 
    Link against: cone.lib
    ...
    Class CCoeEnv
    ...
    Defined in CCoeEnv:
    ...
    SystemGc()const Gets the system graphics context.
    ...

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Help needed to display text using openGL ES

    Indeed. Practically the line "CWindowGc& gc = SystemGc();", and the like work in a CCoeControl, and nowhere else. If CSlideshow happens to inherit from something else, use CCoeEnv::Static()->SystemGc().

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    38

    Re: Help needed to display text using openGL ES

    Quote Originally Posted by wizard_hu_ View Post
    Indeed. Practically the line "CWindowGc& gc = SystemGc();", and the like work in a CCoeControl, and nowhere else. If CSlideshow happens to inherit from something else, use CCoeEnv::Static()->SystemGc().
    Thanks...

    I try this way..So declaration & function should like this way:


    Static()->SystemGc();
    utilOutputText(SystemGc(),KLoading, TPoint(Size().iWidth /2, Size().iHeight /5 ), KRgbBlack, );

    Right?

    But what about Tpoint(..). this also show undefined identifier...

    can you describe little bit details in coding..which will be very helpfull for me..

    Again Thanks a lot

    Rassall

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Help needed to display text using openGL ES

    It should be
    Code:
    utilOutputText(CCoeEnv::Static()->SystemGc(), KLoading, TPoint(Size().iWidth /2, Size().iHeight /5 ), KRgbBlack );
    TPoint is declared in e32cmn.h, and practically it is available everywhere (if you #include almost any system header, it will implicitly #include e32cmn.h too). Since you already have a reference to coecntrl.h, both TPoint and CCoeEnv should be available without adding any further #include-s. Check the spelling, P should be a capital letter too (TPoint).

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    38

    Re: Help needed to display text using openGL ES

    Quote Originally Posted by wizard_hu_ View Post
    It should be
    Code:
    utilOutputText(CCoeEnv::Static()->SystemGc(), KLoading, TPoint(Size().iWidth /2, Size().iHeight /5 ), KRgbBlack );
    TPoint is declared in e32cmn.h, and practically it is available everywhere (if you #include almost any system header, it will implicitly #include e32cmn.h too). Since you already have a reference to coecntrl.h, both TPoint and CCoeEnv should be available without adding any further #include-s. Check the spelling, P should be a capital letter too (TPoint).
    Thanks a lot..

    it seems to problem is solving ...but now the problem is size().error shows size() is undefined indentifer.

    utilOutputText(CCoeEnv::Static()->SystemGc(), KLoading, TPoint(Size().iWidth /2, Size().iHeight /5 ), KRgbBlack );

    Slideshow is a sample example from nokia opengl ES. This utilOutputText is working slideshowcontainer.cpp but why its now working(undefined indentifer) in slideshow.cpp. where i already add following header file into slideshow.h

    #include <GLES/gl.h>
    #include <coecntrl.h>
    #include <akndef.h>

    ok ... i give my code here..may be problem in my declaration/coding..

    ************* This is Slideshow.h *****************

    #include <e32base.h>
    #include <GLES\gl.h>
    #include "Slideshowrenderers.h"
    #include "Textureutils.h"
    #include "Mathutils.h"
    #include "Utils3d.h"
    #include <coecntrl.h>
    #include <akndef.h>

    class CSlideshow : public CFiniteStateMachine, public MTextureLoadingListener
    {

    ..........
    ..........
    public:
    ...
    prtected:
    ....

    public:
    void AppInitL( void );
    ........
    void Draw(const TRect& aRect) const;
    ........
    Private:
    .......
    .....
    }

    ************* Slideshow.cpp *****************

    #include <aknnotewrappers.h>
    #include <e32math.h>
    #include "slideshow.h"
    #include <GLES\egl.h>
    {
    ...........
    ........

    void CSlideshow::AppCycle( TInt aFrame,TReal aTimeSecs,TReal aDeltaTimeSecs)

    {



    Draw(TRect& aRect);

    ..........
    ..........
    }

    void CSlideshow :: Draw(const TRect& aRect)const
    {

    _LIT(KLoading, "Hello");

    utilOutputText(CCoeEnv::Static()->SystemGc(), KLoading, TPoint(Size().iWidth /2, Size().iHeight /5 ), KRgbBlack );

    }

    Plesse check my coding..is there any problem/declaration problem? and now error show Size()as undeclaired identifiered...


    Thanks

    Rassall

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Help needed to display text using openGL ES

    Unfortunately I have never checked OpenGL stuff, but I have a feeling that this whole concept will not work. If utilOutputText is just a simple method of yours, be aware of that SystemGc can not be used without being activated. It automatically happens before the "system" invokes CCoeControl:raw, but otherwise you have to invoke CWindowGc::Activate as a minimum. However for invoking this method you would need a window. And in fact CCoeControl-s are the entities that easily have a window (and they are the ones having that Size too - though theoretically you can try using the size of the display if you want), so these things are just not trivial.
    Anyway, for compiling the code CCoeEnv::Static()->ScreenDevice()->SizeInPixels() can be used in place of Size(), just it is not sure that the result will work, because of the SystemGc.

Similar Threads

  1. Nokia N-Series Complete Model Line-Up
    By Dopod in forum General Development Questions
    Replies: 6
    Last Post: 2008-07-22, 20:16
  2. How to display a long text and textbox in low level
    By Basu in forum Mobile Java General
    Replies: 2
    Last Post: 2007-03-31, 08:02
  3. OpenGL ES and View Arch. in Series 60
    By abolfoooud in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-06-06, 13:36
  4. Replies: 0
    Last Post: 2004-10-07, 08:57
  5. Read Chinese Text file and Display Chinese on Canvas Problem?
    By goeast in forum Mobile Java General
    Replies: 4
    Last Post: 2002-09-18, 03:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×