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.


Sponji

Member Since 14 Jan 2011
Offline Last Active Today, 04:25 PM

Posts I've Made

In Topic: Terrain editing

Yesterday, 01:42 PM

You can calculate the distance to a vertex and then use a radius to choose if it's close enough or not.

 

Edit. If it's just an uniform grid, shouldn't it be quite easy to just grab the closest vertex on the grid depending on where you hit? Just divide the hit coordinates with the size of a tile on the grid and you should get the x and y for the vertex position. And with those you should get the actual vertex nicely from the array, vertices[y*w+x].


In Topic: gDebugger crash on pause?

16 November 2014 - 12:12 PM

Is there a reason you're not using AMD CodeXL? AMD gDEBugger has been succeeded by AMD’s CodeXL.


In Topic: GLSL texturing works without calling glUniform

15 November 2014 - 09:59 AM

You have to bind the index instead of GL_TEXTURE0.

int index = 0;
glActiveTexture(GL_TEXTURE0 + index); 
glBindTexture(GL_TEXTURE_2D, texture_id); 
glUniform1i(location, index);

In Topic: Tilemap array is flipped

10 November 2014 - 02:14 AM

Seems like you're mixing i and j in the Node's constructor? I think it should be also better to flip the loops, first height and then width.

 

I'd do something like this:

for (unsigned int y = 0; y < height; ++y)
{
    for (unsigned int x = 0; x < width; ++x)
    {
        map.push_back(new Node(x * 32 , y * 32 ));
        map[y * width + x] = ...;
    }
}

In Topic: SFML Passing RenderWindow reference to constructor error

08 November 2014 - 04:07 PM

Change the renderWindow to a reference and assign it in the constructor's initialization list.

private:
    sf::RenderWindow &renderWindow; // Make it a reference
// And it must be assigned in the initialization list because it's a reference
MapRender::MapRender(sf::RenderWindow &thatWindow)
: renderWindow(thatWindow)
{ }

PARTNERS