# VR mode how to get pixel color on mouse click?

**URL:** <https://discourse.processing.org/t/vr-mode-how-to-get-pixel-color-on-mouse-click/33980>\
**Category:** Processing for Android\
**Created:** [December 7, 2021, 7:13am UTC](https://discourse.processing.org/t/vr-mode-how-to-get-pixel-color-on-mouse-click/33980 "2021-12-07T07:13:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimpapadop](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@dimpapadop](https://discourse.processing.org/u/dimpapadop)\
**Post date:** [December 7, 2021, 7:13am UTC](https://discourse.processing.org/t/vr-mode-how-to-get-pixel-color-on-mouse-click/33980/1 "2021-12-07T07:13:06Z")

</div>

Hallo, how could we get the pixel color when in VR mode? for example for color tracking in VR mode. I am confused

the simple 2d code

```auto
    color cc=get(mouseX,mouseY);
    println(red(cc),green(cc),blue(cc));

```

does not return the corresponding pixel clicked on one of the 2 images.

---

<div class="post-metadata">

**Author:** ![dimpapadop](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@dimpapadop](https://discourse.processing.org/u/dimpapadop)\
**Post date:** [December 11, 2021, 10:38pm UTC](https://discourse.processing.org/t/vr-mode-how-to-get-pixel-color-on-mouse-click/33980/2 "2021-12-11T22:38:05Z")

</div>

the code used is below, but i get offsetting. For example i must go up and right to select the color that appears on the center. What am i doing wrong?

```auto
import ketai.camera.*;
KetaiCamera cam;
int refresh = 0;
import processing.vr.*;
void setup() {
  fullScreen(VR);
  //cameraUp();
  cam=new KetaiCamera(this, 640, 480, 24); //60
  cam.start();
  //img = createImage(640,480,RGB);
  imageMode(CENTER);
}

float xx, yy;
PMatrix3D objMat = new PMatrix3D();
PImage img;
void draw() {
  background(0);  
  //pushMatrix();
  translate(width/2, height/2);
  if (refresh == 1) {
    cam.read();
    image(cam, 0,0);
  }
  //popMatrix();
  drawAim();
  //drawEye();
}

void onCameraPreviewEvent()
{
  cam.read();
  refresh = 1;
}

void drawAim() {
  eye();
  // if (refresh == 1) {
  // cam.read();
  // image(cam, 0, 0,width,height);
  //}
  xx=screenX(0, 0, 0);
  yy=screenY(0, 0, 0);
  //stroke(get(int(xx), int(yy)));
  stroke(get(int(xx), int(yy)));

  strokeWeight(20);
  point(0, 0, 100);
}

```
