Hi, I'm a new user . I'm now coding for wiz using libcastor and openwiz toolchain but I've some problems. How can I use opengl?(I don't need a tutorial on opengl function, i need to know how to set up it)
Second, how can I read the touchscreen coords? With GP2X F200 I used this code, but it doesn't work with Wiz:
CODE
typedef struct {
uint16_t pressure;
uint16_t x;
uint16_t y;
uint16_t pad;
struct timeval stamp;
} TS_EVENT;
struct Stylus{
int x, y, pressure, calibX, calibY, NewPress, Held, Released;
}Stylus;
void CalibTouch(){
int fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
TS_EVENT ts_event;
do{
read(fd, &ts_event, sizeof(TS_EVENT));
}while(ts_event.pressure!=0);
Stylus.calibX = ((ts_event.x-200)*320/3750)/4;
Stylus.calibY = (((ts_event.y-200)*240/3750))/4;
Stylus.x = 160;
Stylus.y = 120;
close(fd);
}
void UpdateStylus(){
int fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
TS_EVENT ts_event;
read(fd, &ts_event, sizeof(TS_EVENT));
Stylus.NewPress = 0;
if(ts_event.pressure>0){
Stylus.x = ((ts_event.x-200)*320/3750)-Stylus.calibX;
Stylus.y = (240 - ((ts_event.y-200)*240/3750))-Stylus.calibY;
if(Stylus.Held==0){
Stylus.NewPress = 1;
Stylus.Held = 1;
}
}else{
Stylus.Held = 0;
}
Stylus.pressure = ts_event.pressure;
close(fd);
}
How can I resolve?
Thanks
Second, how can I read the touchscreen coords? With GP2X F200 I used this code, but it doesn't work with Wiz:
CODE
typedef struct {
uint16_t pressure;
uint16_t x;
uint16_t y;
uint16_t pad;
struct timeval stamp;
} TS_EVENT;
struct Stylus{
int x, y, pressure, calibX, calibY, NewPress, Held, Released;
}Stylus;
void CalibTouch(){
int fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
TS_EVENT ts_event;
do{
read(fd, &ts_event, sizeof(TS_EVENT));
}while(ts_event.pressure!=0);
Stylus.calibX = ((ts_event.x-200)*320/3750)/4;
Stylus.calibY = (((ts_event.y-200)*240/3750))/4;
Stylus.x = 160;
Stylus.y = 120;
close(fd);
}
void UpdateStylus(){
int fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
TS_EVENT ts_event;
read(fd, &ts_event, sizeof(TS_EVENT));
Stylus.NewPress = 0;
if(ts_event.pressure>0){
Stylus.x = ((ts_event.x-200)*320/3750)-Stylus.calibX;
Stylus.y = (240 - ((ts_event.y-200)*240/3750))-Stylus.calibY;
if(Stylus.Held==0){
Stylus.NewPress = 1;
Stylus.Held = 1;
}
}else{
Stylus.Held = 0;
}
Stylus.pressure = ts_event.pressure;
close(fd);
}
How can I resolve?
Thanks