Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Atemu

Member Since 08 Mar 2012
Offline Last Active Oct 23 2014 04:21 PM

Posts I've Made

In Topic: OpenGL 4 and Index Buffer

13 January 2014 - 04:27 PM

Alright, thanks for your answers :)


In Topic: Very strange problem

12 January 2014 - 08:57 AM

If you need a pointer to the elements in the original array, why not return the pointer directly instead of allocating a new array that you aren't deleting anywhere? If you need to return a copy, and not a pointer to the internal data (you only pass it to OpenGL anyway, so a copy shouldn't be needed), then at least return an std::vector or whatever dynamic array you appear to be using.

Thank you for your help, I'm using GLM and I didn't know I could use the glm::vec3 in a VBO so that's why I tried to generate a float array of points extracted from the glm::vec3 vector.

Everything is now working :)


In Topic: Very strange problem

12 January 2014 - 08:33 AM

Start by removing code until the problem disappears. The problem is then likely related to the piece of code you removed. For example, if this problem is not directly related to either OpenGL or GLFW, then you should be able to remove all OpenGL and GLFW function calls. In the code you posted, that would effectively leave you with a constructor call to the Cube object and a matching destructor at the end, a call to Cube::getArrayOfPoints and two calls to readShaderFile.

Well I tried to find where the problem is by using your idea (which I should have thought lol). The probleem seems to be with:

float *points = cube.getArrayOfPoints();

And the code of that method:

float *Mesh::getArrayOfPoints() {
	const int size = points_.size() * 3;
	float *array = new float[size];

	int j = 0;
	for (int i = 0; i < size; i++) {
		array[j++] = points_[i].x;
		array[j++] = points_[i].y;
		array[j++] = points_[i].z;
	}

	return array;
}

As you can see my class Cube is inheriting from the class Mesh.


In Topic: Very strange problem

12 January 2014 - 08:12 AM

is there a particular reason you think it's points that's being freed? Does the pointer match the one that is being complained of?

To be honest, I've no idea where the problem is :(


In Topic: Trying to compile using C++11

11 January 2014 - 10:45 AM

I think you'll need to show us the header and the source for RenderWindow. However, I think your invocation of g++ maybe wrong. It looks like you are trying to compile main but you are asking it to build a binary. Perhaps you meant to use -c instead of -o?

 

-Josh

Thank you so much !!! I removed the -c option accidentally :) It's now compiling !


PARTNERS