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

**URL:** <https://discourse.processing.org/t/using-texture-and-vertex-with-texture-mapping-in-opengl-renderer/14162>\
**Category:** Coding Questions\
**Created:** [September 24, 2019, 8:28am UTC](https://discourse.processing.org/t/using-texture-and-vertex-with-texture-mapping-in-opengl-renderer/14162 "2019-09-24T08:28:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![snaders](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@snaders](https://discourse.processing.org/u/snaders)\
**Post date:** [September 24, 2019, 8:28am UTC](https://discourse.processing.org/t/using-texture-and-vertex-with-texture-mapping-in-opengl-renderer/14162/1 "2019-09-24T08:28:39Z")

</div>

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:

```auto
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:

```auto
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!
