Loffen
Well-known member
OK. heres my idea:
I want to make some tilebased game, were the user/player can place structures on the map. I am pretty sure you have seen this before: There are some green squares under the "not yet placed structure". If i now move the mouse over a rock, some of the squares (the ones overlapping the rock) change to red, showing the player he cant place it there. I guess thats it.
And heres my problem:
Earlier i moved my sprite by destroying the vertexbuffer and recreated it with different vertex coordinates. I figured this was VERY inefficent, so i learnt how to move the world. Now, in the very same piece of code, while filling the vertexbuffer, i set a color. How can i change this color "in game" without destroying and recreating the vertexbuffer?? I dont want to recreate the vertexbuffer as this was extremely inefficent.
Got any ideas, links, suggestions or code snippets?? please post them here...
EDIT: When i use a color when filling the buffer, the result is only a lighter or darker square. Not even a glimpse of a color
-- Loffen
I want to make some tilebased game, were the user/player can place structures on the map. I am pretty sure you have seen this before: There are some green squares under the "not yet placed structure". If i now move the mouse over a rock, some of the squares (the ones overlapping the rock) change to red, showing the player he cant place it there. I guess thats it.
And heres my problem:
Earlier i moved my sprite by destroying the vertexbuffer and recreated it with different vertex coordinates. I figured this was VERY inefficent, so i learnt how to move the world. Now, in the very same piece of code, while filling the vertexbuffer, i set a color. How can i change this color "in game" without destroying and recreating the vertexbuffer?? I dont want to recreate the vertexbuffer as this was extremely inefficent.
Got any ideas, links, suggestions or code snippets?? please post them here...
EDIT: When i use a color when filling the buffer, the result is only a lighter or darker square. Not even a glimpse of a color
-- Loffen