Jump to content

Sanctus

Members
  • Posts

    122
  • Joined

  • Last visited

Everything posted by Sanctus

  1. Don't know if you solved this or not but if you use SetBlend with alpha blend you should set the blend back to none before drawing the scene. That worked for me.
  2. Hey I'm trying to make this work in C# (note that I'm not using any headers). Since I want to create worlds and stuff in C# I only put the actuall OpenGL initialization in a c++ dll. CGLContext::CGLContext(HWND hwnd) { RECT rect; hWnd = hwnd; GetClientRect(hwnd,&rect); hDC = GetDC(hwnd); int depth = 32; PIXELFORMATDESCRIPTOR pfd = {0}; int pixelformat; pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.dwLayerMask = PFD_MAIN_PLANE; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = depth; pfd.cDepthBits = depth; pfd.cAccumBits = 0; pfd.cStencilBits = 0; pixelformat = ChoosePixelFormat(hDC, &pfd); SetPixelFormat(hDC, pixelformat, &pfd); hGLRC = wglCreateContext(hDC); wglMakeCurrent(hDC,hGLRC); glEnable(GL_DEPTH_TEST); width = rect.right -rect.left; height = rect.bottom -rect.top; glViewport(0,0,width,height); currentContext = this; } After this I create the context in C# context = CreateGLContext(this.Handle); backBuffer = LE.CreateCustomBuffer(GetSize, MakeCurrent); I just used a simple LE.RenderWorld(); command and a flip to test if the custombuffer works. Sadly it doesn't and GetSize and MakeCurrent are never called. They are defined like this void _stdcall GetSize(int* width,int* height); void _stdcall MakeCurrent(); and CreateCustomBuffer takes some delegates. I tested and if I manually call GetSize the debugger stops there. Any clues to why this may be?
  3. Yes.. C++ can do it all. But.. can you make it fast? I mean C++ is good for the hardcore stuff and C# is good for the part where you just want to do some nice GUI in th shortest time. I for one love using both in the same projects.
  4. If by that you mean speed of execution you are wrong. Assambler is the best at speed and C++ is the next best thing. When I started my own engine the first mock-up was in C#. A scene with 1000 lit and textures polys was lagging. However if you use C++ and Assambler for the stuff that has to be done fast and C# for the rest you achieve great results. It's all about knowing what to use and when.
  5. New problem. This time I'm really clueless. I created a terrain. I use this to modify it for(int i=p.Z-radius;i<p.Z+radius;i++) { for(int j=p.X-radius;j<p.X+radius;j++) { float oh = TerrainHeight(terrain,i+512,j+512); float d = (radius-dist(p.Z,p.X,i,j))/5000.0f*strength; if (d>=0) { if(currentTool==TOOL_RISE) { SetTerrainHeight(terrain,i+512,j+512,oh+d); } if(currentTool==TOOL_LOWER) { SetTerrainHeight(terrain,i+512,j+512,oh-d); } } } } UpdateTerrainNormals(terrain); I saved it's heightmap using SaveTerrainHeightmap and the in the same way I loaded it back into a new terrain. If I try to modify a loaded terrain it aparently modifies it as if it had no heightmap data. Studied the problem more and TerrainHeight does not return the height from the new heightmap that I loaded. Can anyone help me here? EDIT: Even more.. Aparently when you save a heiightmap and load it back. It get's rotated and flipped. I attached before and after images.
  6. Well you know a target moves. You know it's speed and direction. You know the distance to the target as well. Based on that distance you calculate the time needed for a bullet to get there (in millisecs). Knowing that time you calculate where the target will be by that time. Then just fire there.
  7. Ah I did this on my own gizmo. You just scale it with the distance from the camera multiplied by a general size. It might not be the best due to the perspective projection but I didn't see anything wrong till now. Anyway: +
  8. Well sadly I installed the new drivers twice and it went bad. I mean my maximum resolution was 640x480 with 16 colors. Nice eh? Downloaded drivers from laptopvideo2go.com (or something like that) and from nvidia oficial page. Now I installed back the old driver which seams to work. Also note that my windows instalation(XP) is basically a wreck. I'm still hanging on it untill it will crash and I'll have to install windows 7 or something. Anyway from my experience with OpenGL the setblend command is clearly not a driver issue. Btw.. thanks guys for your answers. You've been helpfull I still have a problem with terrain raycast but I'll try to see it more indeep before thinking it's a bug.
  9. Hm.. I'm running this on a laptop so I'm not sure if you have the same card.(Altough I know M stands for mobile-> laptops) Anyway last time I checked the drivers from the Dell were really old or something. Is there any place to download them?
  10. Hm.. When I tried this I tought I wasn't doing something right.
  11. Well I just used SetBlend(BLEND_ALPHA) somewhere to be able to have transparent interface. Anyway I'm quite sure this is a little bug. Stragely it only happens to terrain. If I comment the terrain creation I see everything fine even without the SetBlend(BLEND_NONE) command. If it is indeed a bug maybe it can be fixed in LE 2.32
  12. I edited the code while you were writing... Huh... solved. Playing with SetBlend is a bad ideed (I do this in my interface) Using a SetBlend(BLEND_NONE) before drawing the scene seems to fix it.
  13. Well since the project is a bit more large I can't really post the code plus that I'm not sure I'm allowed (I have to do this for someone). No framewerk. I really don't like that thing. No sandbox (this is supposed to be a type of sandbox it'self). Just one world without any skyboxes. Here are some chunks of code float omx; float omy; SetUp(); CreateInterface(); TVec3 camRot = EntityRotation(viewCam); TMesh cube = CreateCube(); terrain = CreateTerrain(1024); The way I draw the scene in the while loop: UpdateWorld(); SetBuffer(buffer); RenderWorld(); SetBuffer(BackBuffer()); RenderLights(buffer); UpdateInterface(); Flip(0); Also here is the log(nothing wrong with it as far as I can see):
  14. I updated to 2.3 and now I don't have that command anymore However now when I try to load a terrain I get a very weird visual bug: It's as if the image is not clearing anymore when I move the camera around. I tried to find a command to clear the screen but I don't think there is one. My one code was terrain = CreateTerrain(1024); I have a cube there.. a directional light and a point light. Intresting is the fact that the point light draws over and over on the terrain untill it becomes totally white. I faced this problem when I wasn't clearing the screen but this only happens on the terrain. Is it just me or is this a bug?
  15. For Leadwerks I'd say C# is not the greatest way to go. I currently use C++ but I also used BlitzMax in the past and it was mosly the same(as in ease of use)
  16. Yeah thanks. I'll have to send that information again to Josh once I receive my key.
  17. No.. actually because I am using LE 2.22 I had to call BuildTerrain(terrain) as well. I figured it out when I looked at the change log on the old forum but I didn't know how to delete this topic. Anyway maybe some future user might need this info Thanks for answering tho.
  18. Okay I see that the payment is back on but isn't there anyway to pay with paypal? It's the only option I have right now and I'm quite in a hurry. EDIT: sorry now I've seen the post before where paypal is allowed. Paid and waiting
  19. Yes but take in account that if the player and the enemy are at different heights then the enemy would be rotated up or down. I think you want this only on the Y axis in which case you can use ATan2(playery-enemyy,playerx-playerx) (not sure if this command exists in leadwerks but it's in math.h anyway)
  20. Hey guys. Before anything I'm using LE 2.22 so this may be a issue (after that I started to have strange bugs). Anyway. How can I create a terrain just from code? I tried this "terrain = CreateTerrain(512,2); UpdateTerrainNormals(terrain);" but it doesn't seem to work at all. I see nothing. I tried loading a heightmap but again I see nothing. I tested the lights and other things with a cube which shows pretty well. I just want to have a terrain to which I can set my elevations manually. I'm trying to make a scene editor (since I don't fancy the original one all that much).
  21. I allready have this stuff done in my own engine. The commands are exactly like blitzmax. I Josh want's I would glady donate some code. It's actually quite simple. ImagesCollide and ImagesCollide2(from blitzmax ) would also help. I could donate that code as well.
  22. Yeah but doesn't leadwerks support this natively? I mean I basically want to do what's in the sandbox. I don't want to add a parent to the actual window. I want to put it in another window as a control. I'm sorry if this is stupid but my win32 programming skills are close to none( I can make a window with a button and that's all).
  23. Thanks man. Do you mind if I ask for some actual code? I can't really find the commands on wiki.
  24. Hey guys. I decided to start a project using LE 2.22 untill Josh get's back and I can buy LE 2.3 Anyway thing is I need to use Leadwerks in a windows forms application. I think I'll write my own C# headers for this but first I'd like to know (in c++) how can I start the engine using a HWND or in a way that I can use it over a custrom controll. In my own engine(not public) I have CreateEngine(HWND hwnd,int renderer) and CreateEngineWindow(int width,int height,int depth,int renderer). (note that I don't want to brag about it) Can I do something similar here?
  25. Well Leadwerks is written using OpenGL not DirectX and I think xbox360 is DX only... So I can guess that you won't see any xbox360 support in the near future (or the far) Anyone correct me if I'm wrong.
×
×
  • Create New...