Jump to content

View more

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Direct3D 10 - Index Buffer Texture Problem

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 mushroomrealm   Members   

133
Like
0Likes
Like

Posted 19 April 2014 - 11:13 PM

Hi,

 

Having trouble with the index buffer not drawing the texture of the second triangle of a quad properly. The problem only occurs when the quad is set up using four vertices instead of six even though the index doesn't reference the last two vertices. The code below works fine but when I comment out the last two vertices, and change the array size and buffer description byte width to 4 the texture of the bottom triangle mirros the top triangle.

 

Here's the image I'm trying to draw:

Attached File  ident.bmp   12.05KB   52 downloads

 

And here's what draws if I try to remove the extra vertices:

Attached File  ident2.bmp   12.05KB   41 downloads

 

This is the code I'm using to set up the vertex and index buffers.

Vertex vertices[6];
unsigned long indices[6] = {0, 2, 1, 1, 3, 0};

//bottom left
vertices[0].position = D3DXVECTOR3(this->x, this->y, 0.0f);
vertices[0].texture = D3DXVECTOR2(0.0f, 1.0f);
 
//top right
vertices[1].position = D3DXVECTOR3(this->x + this->w, this->y + this->h, 0.0f);
vertices[1].texture = D3DXVECTOR2(1.0f, 0.0f);
 
//top left
vertices[2].position = D3DXVECTOR3(this->x, this->y + this->h, 0.0f);
vertices[2].texture = D3DXVECTOR2(0.0f, 0.0f);
 
//bottom right
vertices[3].position = D3DXVECTOR3(this->x + this->w, this->y, 0.0f);
vertices[3].texture = D3DXVECTOR2(1.0f, 1.0f);
 
//bottom left
vertices[4].position = D3DXVECTOR3(this->x, this->y, 0.0f);
vertices[4].texture = D3DXVECTOR2(0.0f, 1.0f);
 
//top right
vertices[5].position = D3DXVECTOR3(this->x + this->w, this->y + this->h, 0.0f);
vertices[5].texture = D3DXVECTOR2(1.0f, 0.0f);

What is it I'm missing that's causing this problem? Any help would be appreciated.

 

Thank you.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.