Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to draw a simplerectangle/polygon using QNX Graphics Framework ?: (11 Items)
   
How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
Dear All,

I am new to GF. I am using the GF APIs and trying to draw a rectangle/polygon or line on the screen. However I am not 
successful.

Could anyone help me out with what could be the issue. The initilization steps seems to be correct. I am attaching the 
display.con,pidin mem information and sloginfo & program here.

Graphics driver is i830.

Output is :

Number of displays: 1
Display 0: 1024X768, refresh = 60Hz
Number of layers: 4
Attaching to Layer : 2
Format returned by find_rgb_format = 5152
Layer is of Format 5152
Succesfully created surface on top of layer
Created the context succefully
Context Surface is Set Succesfully


Please give your inputs.

Thanks,
Lejin
Attachment: Compressed file GF.zip 5.88 KB
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
You are missing the gf_layer_update(). Put it after the gf_draw_end(), 
and make sure that you don't exit immediatelly because it will turn off the display -- I suggest to put in:
   gf_layer_update( layer, 0 );
   printf( "press ENTER to continue\n" );
   getchar();

after the gf_draw_end().

Also your code prints errors but doesn't exit -- for example if the layer attach fails it prints the error, and 
continues -- this can/will cause a crash later.

Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
Hi,

   This is Swetha (Lejin's colleague),
      I had tried with what u have said, we r still facing problems.

  I have attached the modified code in the below attachment 
 please chk
Attachment: Text program_GF.c.c 5.39 KB
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
What exactly are the problems?
I ran your app and it displayed a white rectangle on the screen -- I believe it is correct. 
The code has chunks of code commented out -- you may want to clean it up to make it easier to look through.
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
Hi,

   This is the output we r getting we run the application

    Number of display : 1
   Display 0: 1024x768, refresh = 60hz
   Number of layers : 4
   Attaching to Layer : 2
   Format returned by find_rgb_format = 5152
   Layer is of Format 5152
   successfully created surface on top of the layer
   Created the context succesfully
   context Surface is Set Succesfully
   Press ENTER to continue

  but there is no any image coming up,
   
   
  
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
I am attaching the 
display.con,pidin mem information and sloginfo of the above  program here.

Attachment: Text info.rar 3.8 KB
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
> I am attaching the 
> display.con,pidin mem information and sloginfo of the above  program here.
> 


Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
>
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
It looks like you are also running Photon io-graphics at the same time. I suggest to try to run your application while 
not running Photon. 
Do you see your white rectangle?
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
Hi,

   I tried to run the application without  the photon,
 but still i could not see the white rectangle
  
   i am compiling it as below, is it fine?
  
  gcc program_GF.c -lgf
  ./a.out
   
Re: How to draw a simplerectangle/polygon using QNX Graphics Framework ?  
Hi,
   
   Its working!!, Thanks a lot,
   
   I had to uncomment the below line in the code.

     if (gf_layer_attach(&layer,display,display_info.main_layer_index,0)    
    == GF_ERR_OK) {