Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


beans222

Member Since 21 Jul 2012
Offline Last Active Today, 06:36 PM

#5185443 Access vertex array in compute shader

Posted by beans222 on 06 October 2014 - 10:08 PM

std140 layout pads a vec3 to 4.




#5183209 [FIXED]Open simple obj file -> nothing

Posted by beans222 on 26 September 2014 - 03:36 PM

Have you set up the depth buffer?

Needs to be enabled, cleared each frame, and the most common clear value is 1.0.

Here's a wiki page about is: http://www.opengl.org/wiki/Depth_Buffer

 

edit: also obj indices start at 1, need to adjust to 0 for gl elements if you haven't already.




#5183155 [FIXED]Open simple obj file -> nothing

Posted by beans222 on 26 September 2014 - 10:33 AM

GL_POLYGON draws a *single* polygon. Try hitting 'triangulate' in blender before exporting to obj and rendering GL_TRIANGLES.




#5182560 [FIXED]Open simple obj file -> nothing

Posted by beans222 on 23 September 2014 - 08:56 PM

Can you share the code where you create the array? How are you using the faces data from the file?

 

This. You are sending the 8 vertices of a cube to GL, but drawing triangles that's not going to work (cube has 6 faces that are quads = 12 total triangles). You need to make a GL_ELEMENT_ARRAY buffer out of the faces section of the obj file data.

 

If you haven't already seen this online book, stop now and read: http://arcsynthesis.org/gltut/




#5181962 Noob question about glDrawArrays

Posted by beans222 on 21 September 2014 - 04:29 PM

2904 / 3 = 968. (it is divisible)




#5181960 Can you use the same vertex data more than once per draw call?

Posted by beans222 on 21 September 2014 - 04:14 PM

It sounds like instancing is extactly what you want.


I don't think so... I have instancing working with a different ModelView matrix for every instance of drawing a set of 2 triangles that make up a quad for a sprite. My "problem" with that way of doing things was that I was sending 6 identical vertices for every single quad, and then just altering their position later in the shader using a different ModelView matrix for each instance. Meaning I had a lot of essentially redundant data that I felt I should be able to reduce. My question is probably as relevant to the behaviour of glDrawArrays as it is to glDrawArraysInstanced.

You can create a vertex array with only the instance attribute(s) enabled/setup and avoid using the 6 vertices all together, then in the shader use gl_VertexID​ to determine which vertex of the quad it is. Use glDrawArraysInstanced normally [eg for 2 instances of the quad: glDrawArraysInstanced(GL_TRIANGLES, 0, 6, 2) ]




#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.

 

http://www.nasm.us/doc/nasmdoc6.html




#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":

http://www.gamedev.net/topic/649916-valve-opengl-tips-and-tricks/






PARTNERS