Advanced Graphics

Hi Sir,

I am working on Advanced Graphics Qnx 6.4, I have an issue with it
can u please help me
I am unable to do gf_attach_layer() in the below example

I am getting the error : gf_attach_layer() failed

I am runing this application on vmware and compiling it like this

gcc filename.c -lgf
is it fine, plz guide me

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#include <stdint.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>
#include <GLES/egl.h>
#include <GLES/gl.h>
#include <gf/gf.h>

int main() {

gf_dev_t gdev;
gf_dev_info_t gdev_info;
gf_display_t display;
gf_display_info_t display_info;
int i;

if (gf_dev_attach(&gdev, GF_DEVICE_INDEX(0), &gdev_info) != GF_ERR_OK) {
printf(“gf_dev_attach() failed\n”);
return (-1);
}

printf(“Number of displays: %d\n”,gdev_info.ndisplays);

for (i = 0; i < gdev_info.ndisplays; i++) {
printf(“Display %d: “, i);
if (gf_display_attach(&display, gdev, i, &display_info) == GF_ERR_OK) {
printf(”%dX%d, refresh = %dHz\n”, display_info.xres,
display_info.yres, display_info.refresh);
printf(“Number of layers: %d\n”, display_info.nlayers);
} else {
printf(“gf_display_attach() failed\n”);
}
}

if (display != NULL) {
gf_layer_t layer;

// if (gf_layer_attach(&layer,display,display_info.main_layer_index, 0) == GF_ERR_OK) {
if(gf_layer_attach(&layer,display,0, 0) == GF_ERR_OK) {
printf("Attaching to Layer : %d\n ",display_info.main_layer_index);
}
else {
printf(“gf_layer_attach() failed\n”);
}
}
gf_dev_detach(gdev);
return 0;
}

u have to select the option no photon from the dispaly settings and restart your machine. Now Photon will not start & your QNX shell will appear. Type pidin and check that io-display is running and also check under /dev you have io-display. now goto your application folder and run the application. it will work.

For OpenGL applications io-display should run but not io-graphics(i.ePhoton).now the default layer 0 will be attached.

regards,
Madhu