Using Texture and vertex (with texture mapping) in OPENGL renderer

Hello all,

I’ve been googling and searching the forum, but can’t seem to find how to make this work. This may have to do with my total absence of OPENGL-knowledge.

I am drawing shapes with vertices, and apply an image as a texture on them:

textureMode(NORMAL);
beginShape();
if(use_heatmap){
  tint(255, getTrans());
}
texture(texture);
vertex(x, y, 0, 0);
vertex(x+w, y, 1, 0);
vertex(x+w, y+h, 1, 1);
vertex(x, y+h, 0, 1);
endShape();

This works, but I only got this to work when using P2D as the renderer.
Now I have to switch to the default renderer again because I want to use something like:

heatmap_graphics.beginDraw();
heatmap_graphics.image(heatmap_movie, 0, 0, width, height);
heatmap_graphics.endDraw();

And use this PGraphics as input somewhere else in the code.

So I have the problem that one piece of code is working with one renderer, the other with the default renderer.

My question: If I want to use the default renderer, how can I change the code of the vertices with UV-mapping a picture? Everything I google about OPENGL is like abracadabra to me and I get lost.

Thanks for your time and input!