Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualMaxjen

Posted 30 December 2012 - 07:26 AM

Hi,

I'm trying to write a 2D map editor. It is based on triangles. The problem I have is drawing the selection. Here is how it should look like when I select one vertex:
[attachment=13016:selection.png]

What I have is Triangle class which creates a vertex buffer where all the triangle vertex positions, colors and texture coordinates are. I have a separate class where I store the data for the selection. It has a stl map which maps two integers (vertex indices, lower first) to a structure which contains two bool values to decide if the vertices are selected or not. Now all I need is a way too use that information too draw the edges like in the picture. So for every entry in that map I want to draw a line which gets the positions of the vertices from the vertex buffer of the Triangle class and the information whether or not the vertices are selected from e.g. another vertex buffer in the Selection class. The problem is that I don't know how or if it is possible to bind two vertex buffer at once. If anyone knows or can think of a better way to do this please tell me.

Oh, the picture is not exactly what I want. In my case there should be a third half selected edge that goes down from the selected vertex.

#8Maxjen

Posted 30 December 2012 - 07:25 AM

Hi,

I'm trying to write a 2D map editor. It is based on triangles. The problem I have is drawing the selection. Here is how it should look like when I select one vertex:
[attachment=13016:selection.png]

What I have is Triangle class which creates a vertex buffer where all the triangle vertex positions, colors and texture coordinates are. I have a separate class where I store the data for the selection. It has a stl map which maps two integers (vertex indices, lower first) to a structure which contains two bool values to decide if the vertices are selected or not. Now all I need is a way two use that information too draw the edges like in the picture. So for every entry in that map I want to draw a line which gets the positions of the vertices from the vertex buffer of the Triangle class and the information whether or not the vertices are selected from e.g. another vertex buffer in the Selection class. The problem is that I don't know how or if it is possible to bind two vertex buffer at once. If anyone knows or can think of a better way to do this please tell me.

Oh, the picture is not exactly what I want. In my case there should be a third half selected edge that goes down from the selected vertex.

#7Maxjen

Posted 30 December 2012 - 06:52 AM

Hi,

I'm trying to write a 2D map editor. It is based on triangles. The problem I have is drawing the selection. Here is how it should look like when I select one vertex:
[attachment=13016:selection.png]

What I have is a vertex buffer where every all the triangle vertex positions, colors and texture coordinates are. I have a seperate class where I store the data for the selection. I have a map which maps two integers (vertex indices, lower first) to a structure which contains two bool values to decide if the vertices are selected or not. Now all I need is a way two use that information too draw the edges like in the picture. The problem is that I don't want the information whether a vertex is selected or not in the main vertex buffer. I would like to have it in a seperate vertex buffer and have a shader which somehow gets data from both vertex buffers if that is possible. If not, then does anyone know a better way to do this?

EDIT: Oh, the picture is not exactly what I want. In my case there should be a third half selected edge that goes down from the selected vertex.

#6Maxjen

Posted 30 December 2012 - 06:50 AM

Hi,

I'm trying to write a 2D map editor. It is based on triangles. The problem I have is drawing the selection. Here is how it should look like when I select one vertex:
[attachment=13016:selection.png]

What I have is a vertex buffer where every all the triangle vertex positions, colors and texture coordinates are. I have a seperate class where I store the data for the selection. I have a map which maps two integers (vertex indices, lower first) to a structure which contains two bool values to decide if the vertices are selected or not. Now all I need is a way two use that information too draw the edges like in the picture. The problem is that I don't want the information whether a vertex is selected or not in the main vertex buffer. I would like to have it in a seperate vertex buffer and have a shader which somehow gets data from both vertex buffers if that is possible. If not, then does anyone know a better way to do this?

#5Maxjen

Posted 30 December 2012 - 06:49 AM

Hi,

I'm trying to write a 2D map editor. It is based on triangles. The problem I have is drawing the selection. Here is how it should look like when I select one vertex:
[attachment=13016:selection.png]

What I have is a vertex buffer where every all the triangle vertex positions, colors and texture coordinates are. I have a seperate class where I store the data for the selection. I have a map which maps two integers (vertex indices, lower first) to a structure which contains two bool values to decide if the vertices are selected or not. Now all I need is a way two use that information too draw the edges like in the picture. The problem is that I want the information whether a vertex is selected or not in the main vertex buffer. I would like to have it in a seperate vertex buffer and have a shader which somehow gets data from both vertex buffers if that is possible. If not, then does anyone know a better way to do this?

#4Maxjen

Posted 30 December 2012 - 06:46 AM

Hi,

I'm trying to write a 2D map editor. It is based on triangles. The problem I have is drawing the selection. Here is how it should look like when I select one vertex:
[attachment=13016:selection.png]

What I have is a vertex buffer where every all the triangle vertex positions, colors and texture coordinates are. I have a seperate class where I store the data for the selection. I have a map which maps two integers (vertex indices, lower first) to a structure which has contains two bool values to decide if the vertices are selected or not. Now all I need is a way two use that information too draw the edges like in the picture. The problem is that I want the information whether a vertex is selected or not in the main vertex buffer. I would like to have it in a seperate vertex buffer and have a shader which somehow gets data from both vertex buffers if that is possible. If not, then does anyone know a better way to do this?

PARTNERS