# Molehill: VertexBuffer3D's vector from copyPixels

**URL:** https://forum.kirupa.com/t/molehill-vertexbuffer3ds-vector-from-copypixels/320248
**Category:** flash
**Created:** [March 18, 2011, 4:01am UTC](https://forum.kirupa.com/t/molehill-vertexbuffer3ds-vector-from-copypixels/320248 "2011-03-18T04:01:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jwopitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jwopitz/32/1556_2.png) [@jwopitz](https://forum.kirupa.com/u/jwopitz)
#### Post date: [March 18, 2011, 4:01am UTC](https://forum.kirupa.com/t/molehill-vertexbuffer3ds-vector-from-copypixels/320248/1 "2011-03-18T04:01:24Z")

</div>

Firstly… could we maybe get a thread prefix for molehill / GPU / 3D related threads?

Ok so I am working on my own Molehill 2D painting classes. I took a look at Ely Greenfield’s M2D stuff but I found it a tad overkill for what I am looking for. So I want to do my own. I have been working off of Polygonal’s example. You can check out my code here - [http://j.mp/hI3wcj](http://j.mp/hI3wcj)

Assume I want to paint one entity that is a rectangular bitmap image using two triangles (essentially a quad). Basically I am having a hard time understanding how to translate this:

```auto
bitmapData.copyPixels( sourceBitmapData, sourceRectangle, destinationPt.. );

```

to this (assuming I am using a x, y, u, v vector pairing):

```auto

vertexBuffer3D.uploadFromVector( Vector.<Number>([....]), 0, 4 );

```

For when the sourceRectangle = sourceBitmapData.rect I use these vector values and it works as expected:

```auto

Vector.<Number>
([
   0, 0, 0, 0,
   1, 0, 1, 0,
   1, 1, 1, 1,
   0, 1, 0, 1 
]);

```

Specifically if the source rectangle doesn’t contain the same values of the sourceBitmapData.rect. What if I want to paint only a portion of a bitmap onto a quad? Or stretch a portion of the image across a quad.
