Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Jul 2012
Offline Last Active Yesterday, 07:08 PM

#5166237 (Super) Smart Pointer

Posted by beans222 on 11 July 2014 - 10:15 AM

Read Buckeye's original post again. If the AI has a pointer *to the pointer* to the enemy, they can all see whether the enemy object exists/NULL or not with a single if-statement. No looping. The AI just sees a lack of enemy next time they get updated.

#5166107 Terrain - map editor

Posted by beans222 on 10 July 2014 - 08:00 PM

I would go height map for a terrain editor. Bullet's height map object allows for the map array to be dynamically modified. Creating a new btBvhTriangleMeshShape every time the terrain is modified may or may not be too slow, but using the height map wouldn't require quite as much Bullet-related code.


On the other hand, do you really need physics *while* the terrain is being altered/extruded/etc? You could stop physics, allow the user to extrude (terminology?) a hill, and then start simulating again after building a new btBvhTriangleMeshShape. If your editor includes placing other objects (like debris), you might need to use an invisible sphere to push away other objects before creating a new btBvhTriangleMeshShape. Or even try to detect which non-static objects would need to be moved and just warp them above the new highest point in the area and let them fall back down (the user will have to re-place them, but hey, they rose a hill there).


Disclaimer: I've never written such an editor; I use Blender (poorly).

#5165637 some assembly unknowns

Posted by beans222 on 08 July 2014 - 02:29 PM

If you use NASM to output a raw binary it will assume 16-bit code for a DOS .com executable.



#5151960 OpenGL doesn't draw triangle

Posted by beans222 on 06 May 2014 - 08:17 PM

Lack of a vertex array bound before setting up attributes? (glGenVertexArrays / glBindVertexArray)

#5130134 Drawing multiple objects

Posted by beans222 on 09 February 2014 - 01:43 PM

Sorry for the long delay between replies.


It's very strange that you would only get the error the second time through.

One thing to try would be to explicitly enable that extension using:

#extension GL_ARB_explicit_attrib_location : enable

after the version line.


Might be worthwhile to attempt to update your drivers.

#5129455 Drawing multiple objects

Posted by beans222 on 06 February 2014 - 07:02 PM

What version of GL context are you getting?

Could you post your vertex shader code?


There are functions that separate vertex format from the buffers being used, but for GL ~3.3 a vertex array per unique model is the norm. It's also perfectly normal for a great many objects to use the same shader program and to sort by shader. That error sounds like a GLSL compile error, but if you were successfully rendering one object with the same shader before your attempt to render more, I'm at a loss to solve the problem with just the information provided.


It's probably not relevant, but the second parameter to glVertexAttribPointer is the number of elements (floats here), not sizeof(float), if that helps. I don't know what your vertex format is so no idea if there's really 8 floats per vertex.

#5128758 assimp subsets problem

Posted by beans222 on 04 February 2014 - 10:45 AM

Both of those assumptions are wrong. The material ID could be i rather often, but it's possible for two subsets to use the same material (less materials than meshes). The offset cannot always be zero. If you have DX starting from the beginning of the vertex buffer everytime, each subset's indices

will always use the first X vertices and not the right ones. A subset's indices are always 0 - num_vertices for that subset.

You could add the starting vertex to all the indices for each subset, but it would be easier to just set offset.


After looking through the .net code on the linked site, he is adding vertex start to all the indices. I have to assume then that the model format

used in the book has the indices like that already.

#5117510 Mesh Physics bullet physics and assimp

Posted by beans222 on 17 December 2013 - 01:59 AM

Might be easier to use btTriangleIndexVertexArray::addIndexedMesh, http://bulletphysics.org/Bullet/BulletFull/classbtTriangleIndexVertexArray.html#a106dc4486bccc8b6a3e2c250ad7e238c


You'll want to make copies of the assimp data (just memcpy into suitably sized arrays) then feed it to bullet.

You'll also need to keep track of those pointers as bullet does not take ownership of anything it did not

allocate itself.

#5114753 Vertex Array Object + Direct State Access

Posted by beans222 on 05 December 2013 - 08:37 PM

To go one wiki page further, under glVertexAttribPointer: "GL_INVALID_OPERATION​ is generated if no vertex array object is bound."


The following thread is also relevant, but nobody explicitly says anything like "yes, I've fallen back to older GLSL and non-generic attributes":


#5042211 Starting OpenGL

Posted by beans222 on 12 March 2013 - 12:11 AM

Check that gdi32.lib is being linked.

#5036273 Best way to load a 3D object into memory from a file?

Posted by beans222 on 25 February 2013 - 01:33 AM


Assimp supports importing a wide array of file formats.

Best way to use it is to import using assimp and export to your own format.

#5031311 glGenTextures

Posted by beans222 on 11 February 2013 - 09:27 PM

It works the same way as glGenTextures, just pass 1 and a pointer to the ID.


Edit: Although based on the code above, perhaps just glTexSubImage2D or glTexImage2D would be better (or even faster) than creating an entirely new texture every frame?

#5025649 Making a Static Lib in Linux

Posted by beans222 on 25 January 2013 - 09:04 PM

The S option is likely giving you assembly text output. Use -c instead.

#5024416 OpenGL triangle example

Posted by beans222 on 22 January 2013 - 02:20 PM

There's missing () after glGetError. As is it's not getting called (what you have there is a comparison of the function's address).

#5019503 Practical rendering approach of an object

Posted by beans222 on 09 January 2013 - 10:23 AM

1. Can't really avoid putting the matrices in constant buffers. For something like world transform that is not necessarily constant frame-to-frame, more than one rotated constant buffer dedicated to the world transform would be necessary to avoid sync issues (unless you depend on drivers to do orphaning, which is far from gauranteed). It might be worth it though to simply modify a single 'matrices' constant buffer each frame for each object, and only do something more complex if you actually need to.


2. Which is essentially how tons of one object with one draw call (instancing) works.


3. Probably not worth the trouble unless you have a ton of unique non-moving objects and that single matrix multiplication in the shader is slowing things down (unlikely).