Jump to content

omniglitch

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by omniglitch

  1. Since I'm also creating my own GUI code using just Leadwerks commands, I've run into the same problem. Using the advice above and my own shaky understanding of Leadwerks' buffer commands, I've come up with the following: // initialization before rendering loop int viewportWidth = 177; int viewportHeight = 12; TTexture viewportTexture = CreateTexture( viewportWidth, viewportHeight ); ClampTexture( viewportTexture ); TBuffer viewportBuffer = CreateBuffer( viewportWidth, viewportHeight ); // inside the rendering loop TBuffer previousBuffer = CurrentBuffer(); SetColorBuffer( viewportBuffer, viewportTexture ); SetBuffer( viewportBuffer ); ClearBuffer(); DrawText( 0, 0, "This is a test of view port clipping." ); TTexture tempTexture = GetColorBuffer( viewportBuffer ); SetBuffer( previousBuffer ); DrawImage( tempTexture, 0, 0, viewportWidth, -viewportHeight ); It seems to work correctly. One oddity is I had to make the height parameter, for the last DrawImage command, a negative value or it would draw the texture upside down. Not sure why that happens. Anyways, I was wondering if this is the method I should use. Is it prone to any bugs? Is there a more efficient method I should be using?
  2. I recommend the book Programming Game AI by Example. http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782 It goes beyond just presenting theory and gives you actual C++ code you can use in your own projects. If you're new to programming AI (like myself), it may take a while to wrap your head around it and adapt the example code to your own purpose, but the effort is well worth it. A Finite State Machine is a good solution to the problem you described. The book gives you all the information and examples needed to implement your own FSM. It's much easier to understand if you're already familiar with virtual functions and interface classes. The examples also makes use of the Standard Template Library, so you'll want to be familiar with that as well.
  3. I've tried the chamfering technique before with other engines, but it's pretty labor intensive (or maybe I was doing it the hard way). I like the unweld feature in UU3D. It greatly multiplies the number of vertices, but the results are worth it in my opinion. I was pretty much already sold on getting the full version of UU3D, now I'm really sold on it.
  4. Something odd I've noticed is that all of the models I make in Blender (which are exported to .fbx then converted to .gmf with the fbx2gmf tool) appear Gouraud shaded by the engine, yet the sample models that came with the SDK and models created by code, like CreateCube(), appear flat shaded. To show you what I mean, the left cube in the image below was created with CreateCube() and the right cube was created in Blender--I just exported the default cube blender starts with. Both cubes use the same material, which includes both diffuse and normal textures. For most models I'd rather avoid Gouraud shading, as it's often quite ugly. Is there something I have to do in the art pipeline to have models use flat shading, like the sample models appear to use? Is there some command to set the shading type for a model?
  5. Here's where a picture--or two--is worth a thousand words... I was thinking I'd see something like this screenshot from the tutorial: But when I compile the tutorial code I see this: It looks the same when I run it on a friend's computer. Very dull, as you can see from the screenshot. I even tried throwing in a moving point light, but didn't get any shininess out of the barrels. It's like the normal/specular map is being ignored. I opened oildrumdot3.dds in Paint.NET and confirmed every pixel in the alpha channel is 255. That should make it very shiny. I was wondering, when the console output says it's Loading texture, or Loading shader, does that mean it's beginning the attempt to load it, or is it a confirmation that it's been loaded?
  6. As for a demo others can try, the code can be grabbed from the Introduction to Models tutorial. I've also tried to get normals/specular working with the LoadMesh command. For example: #include "engine.h" int main(int argc, char** argv) { Initialize(); //Create a graphics context Graphics(800,600); //Load SDK directory RegisterAbstractPath("C:\\Leadwerks Engine SDK"); //Create a world if (!CreateWorld()) { MessageBoxA(0,"Failed to create world.","Error",0); goto exitapp; } //Create a camera TEntity cam=CreateCamera(); CameraClearColor(cam,Vec4(0,0,1,1)); PositionEntity(cam,Vec3(0,-0.5,-2)); RotateEntity(cam,Vec3(-20,0,0)); //Create a light TLight light=CreateDirectionalLight(); RotateEntity(light,Vec3(45,45,0)); //Create a render buffer TBuffer buffer=CreateBuffer(800,600,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); //Load a mesh TModel mesh=LoadMesh("oildrum.gmf"); if (!mesh) { MessageBoxA(0,"Error","Failed to load mesh.",0); goto exitapp; } //Main loop while(!KeyHit(KEY_ESCAPE)) { //Update the world UpdateWorld(); //Render the scene SetBuffer(buffer); RenderWorld(); //Render lighting SetBuffer(BackBuffer()); RenderLights(buffer); //Swap the front and back buffer Flip(); } exitapp: return Terminate(); } These sorts of shaders work fine with the model viewer and with all the games I play. Not sure how I would troubleshoot a config issue other than to update my video driver, which I'll try. I'm also going to load my compiled app onto a friend's computer later today and see if normals/specular works there.
  7. I bought LE 2.43 a couple days ago and I've been working through the tutorials. When I got to Introduction to Models I ran into a display issue where the Normal/Specular shader for the oil drums don't seem to be working. They're only shaded with the diffuse texture. I've watched the video for that tutorial and saw that they should be shaded in all their normal map and specular glory using the code example from the tutorial (which I copied and pasted from the tutorial's PDF). I also downloaded the required files and placed them in my project's folder, along with the required .DLLs and shaders.pak. The oil drum model displays normals and specular correctly in the ModelViewer app, just not in my app which uses the tutorial's code verbatim. As I understand it, the LoadModel function should automatically open the .mat file which matches the filename of the .gmf file specified, which will then automatically load the textures and shaders specified in the .mat file, which is what it appears to be doing. The console's output indicates that it's loading the textures and shaders (mesh_diffuse_bumpmap.vert and mesh_diffuse_bumpmap_specular.frag) ok. It should be working. Am I missing something?
×
×
  • Create New...