Jump to content

SpiderPig

Members
  • Posts

    2,335
  • Joined

  • Last visited

Everything posted by SpiderPig

  1. I've noticed similar things with other models where a previously loaded texture applied to a totally different model will overlay onto it. Might be a bug... no sure.
  2. I'd download in FBX. Just drop it into your models folder and it should convert to .mdl automatically. EDIT : You may have to setup a material for it though. The textures will convert when you place them in the folder too.
  3. I have a problem with the geometry shader I'm working on. If someone could tell me why it works until I un-comment the line, RunLOD(4); That'd be great. The shader, material and a grid model is attached. Thanks. EDIT : Commenting out EmitVertex() solves the linking issue - but why? EDIT : If I'd only looked at the Error log I had hidden to the edge of the screen I would have see this; 2: Line 0: Hardware limitation reached, can only emit 60 vertices of this size Well that solves that.
  4. I second this. I'm always moving it out the way.
  5. I agree. It would be nice if you could mouse over variables like C++ and see they're value. As for the above error, I think I've narrowed it down to removing a break-point while the program is running. The icon is removed but the program keeps breaking there.
  6. Spent ages trying to figure out why a certain line of code keep breaking the program. After deciding to restart Leadwerks I reopened the script file and suddenly there was a break-point at that line. I did remove it before hand, but it obviously just removed the icon, not the actual break-point. Hope this can be resolved soon.
  7. Commenting out, self:MakeNums(self.CurrentCode) in the update world loop stops the crash on the second time. But for the life of me I can't debug it with breakpoints. It's as if, with the function, it crashes second time around for a different reason? But without calling the function, it works... I'm going to need a coffee
  8. Thanks for the help. I think I'll have to do it that way. Buffer Objects aren't big enough for my needs.
  9. Does anyone know how to set a Uniform Buffer Object from c++? The Geometry shader has the following Buffer Object; layout(std140) uniform DataBlock { float terrainHeight[1024]; }; https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object Not sure how to get the program ID from a shader in Leadwerks. Or will I have to use OpenGL commands directly?I I figured out how to at least get the Data Blocks index; Shader* sh = material->GetShader(); OpenGLShader* gl_sh = (OpenGLShader*)sh; unsigned int block_index = glGetUniformBlockIndex(gl_sh->program, "DataBlock"); if (block_index != GL_INVALID_INDEX) { //bind it here } This command gets the size (in bytes) that is available for each buffer; int size; glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &size); In this case it was 65,536 bytes. I think there is a max number of buffers allowed too.
  10. I figured out how to do it now, thanks. It seems that gl_Position doesn't let the shader link when inside a loop that uses a uniform variable as a end condition. int current_level = 0; uniform int lod_level = 1; while(current_level < lod_level) { current_level++; gl_Position = pos; EmitVertex(); } This isn't all the code, but commenting out gl_positon or changing the while loop to; while(current_level < 2) will then work.
  11. Thanks. I just tried a few things and found I was wrong with the reversed axis's. I'm a little confused still on how to create a vertex in between two original vertices...
  12. I'm currently trying to subdivide a triangle in the geometry shader. I put the material using the shader on a plane made from two triangles. However it seems that the coordinates in GLSL are different to that in Leadwerks? That the positive X axis in Leadwerks is actually the negative X axis in the shader. And the same for the Z axis. The Y axis seems fine. I want the shader to turn the plane of two triangles into a more detailed grid for a terrain. I know the shader works on each triangle, so I will have to divide each triangle itself into the appropriate triangles so that the end result in game looks like a uniform grid. I've thought of tessellation but I don't think it'll give me the results I'm looking for. Any help with this is appreciated. Thanks.
  13. Hi Josh, I would like to see more flexible commands surround the surface class. This will make real-time modification of large dynamic meshes much easier and hopefully faster, allowing for more control of what type of games that can be made. AddVertices(vec3** positions) RemoveSurface(int index) RemoveSurfaces(int* indexes) RemoveVertex(int index) RemoveVertices(int* indexes) RemoveTriangle(int index) RemoveTriangles(int* indexes) SetTriangleIndice(int index, in a, int b, int c) Creating a grid of only 256 x 256 vertices seems to take a lot longer than if programming it in a bare C++ OpenGL application using VBO's. Is there a reason for this? Thanks.
  14. Thanks, that did the trick. For those who are interested here's the code I used. float cx = Math::Round(context->GetWidth() / 2); float cy = Math::Round(context->GetHeight() / 2); Vec3 mpos = window->GetMousePosition(); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); float dx = (mpos.x - cx) * lookspeed; float dy = (mpos.y - cy) * lookspeed; Vec3 prot = player->GetRotation(); prot.y = dx; player->SetRotation(prot); Quat phy_rot = player->GetQuaternion(true); player_pivot->PhysicsSetRotation(phy_rot, 1.0); The physics shape is assigned to the pivot, and the model of the player is parented to the pivot.
  15. Thanks Josh, an extra argument would be great. I tried the code but moving the mouse left and right just added to the players rotation so I changed the code from; prot.y += dx; to prot.y = dx; which did help. It gave me a rotation about the Y axis which followed the mouse. But when the player rotates 90 on the X axis and then I use this code in the update loop it goes haywire. Rotating in all manor of directions without stopping. My player is setup like this. Model* model = Model::Cylinder(); model->SetShape(Shape::Cylinder()); model->SetCollisionType(COLLISION::PLAYER); model->SetMass(10.0, 0, -1, 0, 1, 1, 1);//to make it more stable standing up model->SetPosition(Vec3(0, 5, 0)); model->SetRotation(90, 0, 0);//this makes it go hay wire Basically I'm making my own character controller because the player is pulled toward different gravity directions through out the game. So I always want the player to rotate left and right with the mouse no matter what direction is down.
  16. I second this. You would think fog would be one of the first shaders included.
  17. Yeah you're probably right. I just wanted to use a shape that wasn't a primitive.
  18. Seeing through the walls might be the material settings. Make sure depth test and depth mask are checked. Not sure about why it's on multiple walls though...
  19. I'm unsure how exactly to use Transform::Rotation in order to rotate my physics object about it's local Y axis. The code below works when the player is upright, but if it rotates 90 degrees on the X axis (lying down basically) it rotates about the global Y. How can I use this to transform to local? float cx = Math::Round(context->GetWidth() / 2); float cy = Math::Round(context->GetHeight() / 2); Vec3 mpos = window->GetMousePosition(); window->SetMousePosition(cx, cy); mpos = mpos * looksmoothing + mousepos * (1 - looksmoothing); float dx = (mpos.x - cx) * lookspeed; float dy = (mpos.y - cy) * lookspeed; Vec3 prot = player->GetModel()->GetRotation(true); prot.y += dx; Vec3 v = Transform::Rotation(prot, NULL, player->GetModel()); player->GetModel()->PhysicsSetRotation(v, 1.0); Thanks.
  20. Is a PolyMesh() trigger suposed to work? I set one up but every time objects fly straight through without invoking the collision hook. Using a sphere or box though works fine.
  21. This is also exactly what I'm after. Thanks!
  22. Great job! Simple yet fun to play. Love the music to.
×
×
  • Create New...