-
Posts
854 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by klepto2
-
-
-
Hi,
I have started a small project called Leadwerks.Extensions. The goal is to provide some deeper functionality from Blitzmax to other languages (not Blitzmax commands directly, but eg missing commands from the provided dll. I have started a test dll which should made my realtime cubemap code available to all languages. Unfortuntly I become errors in the code itself.
The function access itself works well, but in the buffer creation function i get access violation errors (protected memory) when using glGenFramebuffersEXT.
Here is my current Blitzmax code:
SuperStrict Framework leadwerks.ENGINE Const COMPILE_DLL:Int = True Private Function ObjectPointer:Byte Ptr(o:Object) If o=Null Return Null Local p:Byte Ptr p=o p:-8 Return p EndFunction Public Type TCubeBuffer Field texture:TTexture Field buffer:TBuffer Field rb:Int[1] Field fb:Int[1] Field sb:Int[1] Field db:Int[1] Function Create:TCubeBuffer(texture:TTexture,buffer:TBuffer) Local cb:TCubeBuffer = New TCubeBuffer Notify "Debug 1" cb.Texture = texture Notify "Debug 2" cb.Buffer = buffer Notify "Debug 3" cb._BuildBuffer() Notify "Debug 4" cb.Buffer.Framebuffer = cb.fb[0] Notify "Debug 5" cb.Buffer.colorbuffer[0] = texture Notify "Debug 6" Return cb End Function Method _BuildBuffer() Notify "Debug 3.1" Local w:Int = texture.reference._Width Notify "Debug 3.2" Local h:Int = texture.reference._Height Notify "Debug 3.3" glBindTexture(GL_TEXTURE_CUBE_MAP , texture.reference._index) Notify "Debug 3.4" glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_X,0,GL_RGBA8 ,w,h,0,GL_RGBA,GL_UNSIGNED_BYTE,Null glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_Z,0,GL_RGBA8 ,w,h,0,GL_RGBA,GL_UNSIGNED_BYTE,Null glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_X,0,GL_RGBA8 ,w,h,0,GL_RGBA,GL_UNSIGNED_BYTE,Null glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,0,GL_RGBA8 ,w,h,0,GL_RGBA,GL_UNSIGNED_BYTE,Null glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_Y,0,GL_RGBA8 ,w,h,0,GL_RGBA,GL_UNSIGNED_BYTE,Null glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_Y , 0 , GL_RGBA8 , w , h , 0 , GL_RGBA , GL_UNSIGNED_BYTE , Null glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE) ; glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP , GL_TEXTURE_MIN_FILTER , GL_LINEAR) ; Notify "Debug 3.5" glGenFramebuffersEXT(1 , fb ) Notify "Debug 3.5.1" glGenRenderbuffersEXT(1 , rb) Notify "Debug 3.5.2" glGenRenderbuffersEXT(1 , sb) Notify "Debug 3.6" glBindFramebufferEXT(GL_FRAMEBUFFER_EXT , fb[0]) ; glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT , GL_TEXTURE_CUBE_MAP , texture.reference._index, 0) ; Notify "Debug 3.7" glBindRenderbufferEXT(GL_RENDERBUFFER_EXT , rb[0]) ; glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24 ,W, H); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT , GL_DEPTH_ATTACHMENT_EXT , GL_RENDERBUFFER_EXT , rb[0]) Notify "Debug 3.8" glBindFramebufferEXT(GL_FRAMEBUFFER_EXT , 0) glBindRenderbufferEXT(GL_RENDERBUFFER_EXT , 0) ; End Method Method Set(cubeface:Int) SetBuffer(buffer) Select cubeface Case 0 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT ,GL_TEXTURE_CUBE_MAP_POSITIVE_X,texture.reference._index,0) Case 1 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT ,GL_TEXTURE_CUBE_MAP_NEGATIVE_X,texture.reference._index,0) Case 2 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT ,GL_TEXTURE_CUBE_MAP_POSITIVE_Y,texture.reference._index,0) Case 3 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT ,GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,texture.reference._index,0) Case 4 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT ,GL_TEXTURE_CUBE_MAP_POSITIVE_Z,texture.reference._index,0) Case 5 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT , GL_COLOR_ATTACHMENT0_EXT ,GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,texture.reference._index,0) End Select End Method Method Unset() glBindFramebufferEXT(GL_FRAMEBUFFER_EXT , 0) End Method Method CheckFBOStatus:Int(index:Int = 0) Local status:Int = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) Select status Case GL_FRAMEBUFFER_COMPLETE_EXT Print index + ": FBO Complete" Case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT Print index + ": Incomplete attachment" Case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT Print index + ": Missing attachment" Case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT Print index + ": Incomplete dimensions" Case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT Print index + ": Incomplete formats" Case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT Print index + ": Incomplete draw buffer" Case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT Print index + ": Incomplete read buffer" Case GL_FRAMEBUFFER_UNSUPPORTED_EXT Print index + ": Framebufferobjects unsupported" EndSelect Return Status End Method End Type Function CubeBuffer_Create:TCubeBuffer(cubemap:TTexture , cubemapbuffer:TBuffer) "win32" If COMPILE_DLL Then GCEnter() Notify "Create_Start" If cubemap <> Null Then Notify "Cubemap valid" If cubemapbuffer <> Null Then Notify "cubemapbuffer valid" Local b:TCubebuffer = TCubeBuffer.Create(cubemap , cubemapbuffer) Notify "buffer created" Return b End Function Function CubeBuffer_ActivateFace(cubebuffer:TCubebuffer , face:Int = 0) "win32" If COMPILE_DLL Then GCEnter() cubebuffer.Set(face) End Function Function CubeBuffer_Deactivate(cubebuffer:TCubebuffer) "win32" If COMPILE_DLL Then GCEnter() cubebuffer.UnSet() End Function Function CreateCubemap:TTexture(width:Int , height:Int) "win32" If COMPILE_DLL Then GCEnter() Return Leadwerks.Engine.CreateCubemap(width , height) End Function
I have added some debug notfiies to check where the error occurs. The same code called from Blitzmax works. Using it from C# it fails and throws the error in line 64. (glGenFramebuffersEXT(1 , fb )
) The CreateCubemap command works well.
Does anybody know what is causing this and maybe how to solve this issue?
thx in advance
-
you don't need an extra class in C. You can simple load the entity and adjust the settings via SetEntityKey.
-
You may have to change the OpenGL states to fit the needs of MyGui.
try something like this:
leglBegin(GetLayerCamera(background), cameraZoom); MyGUImanager.Render(); leglEnd(true); // End and specify that we used 3D projection
legl.h
// Includes, libs #pragma comment(lib,"opengl32.lib") #pragma comment(lib,"glu32.lib") #include "engine.h" #include <gl/gl.h> // Standard opengl include. #include <gl/glu.h> // GLU include. // Constants enum CullMode { CULL_NONE, // Both sides of faces are drawn. CULL_DRAW_CCW, // Only faces defined by vertices declared in ccw order will be drawn (default). CULL_DRAW_CW // Same as above but cw. }; // Commands (declarations) void leglBegin (TCamera camera = NULL, float zoom = 1.0f, CullMode cm = CULL_DRAW_CCW); void leglEnd (bool was3D = false); void leglBindTexture(TTexture texture); // Implementations (definitions) // Use NULL for the camera to set up 2D drawing instead of 3D. // The "zoom" parameter is only required because there's no GetCameraZoom() function. void leglBegin(TCamera camera, float zoom, CullMode cm) { // Setup projetion according to argument if (NULL != camera) { // Save current projection matrix. Then reset glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); // Calculate the view frustum float nearRange, farRange; GetCameraRange(camera, nearRange, farRange); float theta = 1.0f / zoom; // tan(45°) = 1.0f float aspect = float(BufferWidth(CurrentBuffer()))/BufferHeight(CurrentBuffer()); glFrustum (-nearRange*theta, nearRange*theta, -nearRange/aspect*theta, nearRange/aspect*theta, nearRange,farRange); // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); // LE uses a differently handed coordinate system than ogl does glScalef(1.0f, 1.0f, -1.0f); // Calculate the LookAt vectors (camera direction and up vector)... TVec3 from = EntityPosition(camera, true); TVec3 to = {0,0,-1}; to = TFormVector(to, camera, NULL); to += from; TVec3 up = {0,1,0}; up = TFormVector(up, camera, NULL); // Set LookAt gluLookAt(from.X, from.Y, from.Z, to.X, to.Y , to.Z, up.X, up.Y, up.Z); } else { glPushMatrix(); // Set orthographic projection (used for 2D drawing) // Get the current viewport/buffer size. int vPort[4]; glGetIntegerv(GL_VIEWPORT, vPort); // Set the projection gluOrtho2D(0, vPort[2], vPort[3], 0); // like glOrtho(0, vPort[2], vPort[3], 0, -1, 1); // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); } // Setup default drawing settings. // Alpha blending. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Backface culling. if (CULL_NONE != cm)glEnable(GL_CULL_FACE); if (NULL != camera)glCullFace((CULL_DRAW_CCW == cm) ? GL_BACK : GL_FRONT); else glCullFace((CULL_DRAW_CCW == cm) ? GL_FRONT : GL_BACK); // Depth test for 3D projection if (NULL != camera)glEnable(GL_DEPTH_TEST); // Drawing color. glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } // Use NULL (0) for the texture to reset (bind no texture) void leglBindTexture(TTexture texture) { if(NULL != texture) { glEnable(GL_TEXTURE_2D); BindTexture(texture, 0); // LE command. } else { glBindTexture(GL_TEXTURE_2D, NULL); glDisable(GL_TEXTURE_2D); } } // End drawing. Set "was3D" to true if you specified a camera at leglBegin (= used 3D projection). void leglEnd(bool was3D) { // Undo changes only made in 3D mode (camera != NULL) if (was3D) { glMatrixMode(GL_PROJECTION); glPopMatrix(); glDisable(GL_DEPTH_TEST); } else glPopMatrix(); // Reset transformation. glMatrixMode(GL_MODELVIEW); glPopMatrix(); // Undo changed settings. glDisable(GL_BLEND); glCullFace(GL_BACK); glDisable(GL_CULL_FACE); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); leglBindTexture(NULL); }
-
newer Version is available here: http://leadwerks.com/werkspace/index.php/topic/3104-day-night-script/
-
I have seperated the properties into new sections. I have also noticed new bug with the Ambient settings, as a workaround place a normal Ambient light and use this instead.
-
Hi,
thx for the feedback. I have uploaded an updated version ( Download at first post).
Changes:
- Removed unneeded references to lua files
- Fixed the ambientlight bug.
- Reordered the Options and splitted them in different categories
-
thx macklebee,
I will add it to the toolbox as soon as it is stable and balanced enough. Currently the dawn and dusk effect is a bit out of sync (the effect starts to early and stays to long). intensity.lua and suncolor.lua are data scripts i have used in an earlier version and i have forgotten to delete the references in the current script. They are not needed.
-
Hi, after long silence I want to present a small wip script/shader which replaces the Atmosphere script in the Editor with a dynamic sky tool. The other options from the old atmosphere script are all available through mine.
[screen]
[Download]
[installation]
Unzip this in the models/Environment folder (or somewhere you like within your SDK/Editor folder) and restart the Editor.
Keep in mind that this is still WIP and needs tweaking on various aspects, also I will add moving clouds in a later version.
I hope you like it and I waiting for feedback.
thx klepto2
-
// - Save new Mesh (wip)
I was always interested: what that "wip" means?
wip = Work in progress
Save Mesh will save the mesh with the new materials and ready to use with LE. I'm also thinking about adding the abillity to load meshes in different formats / edit them and make them LE ready. It will also split (optionally) the mesh by worlds. eg: a house normally imported as one Mesh with submeshes and surfaces, the walls etc will be located in the main world, but things like windows should normally be rendered in the transparent world. My tool will split the meshes by the world and create a lua script with a base mesh, which will provide the submeshes to the correct worlds, even colored shadows will be supported.
-
Hi, I want to introduce you to a tool i'm currently developing. Yes it is a material editor (again ) but this one will have some more features in the end.
Features i want to include:
- Realtime Material Editing (done)
- Save new Mesh (wip)
- Export as prefab ( you will be able to add entities like particles, othe meshes etc. and my tool will create a prefab mesh with a lua script/materials etc ready for LE Editor)
- and much more.
Here is a small preview of the material editor:
I'm using the new C# headers (thx to Lazlo and tyler).
I will keep you informed on progress and will provide a demo as soon as possible.
-
First thx for the fast fix.
1. GetPrefferedMaterialName was critical for me because I wasn't able to access surface properties at all. This was due an internal Entrynotfound exception and causes the running program to stop.
2. Global/Local Vectors (ok bad description) Position and Rotation of an entity have a global and a local value. How to get them?
3. I don't use a reflector, but i have tried to implement SetVertexColor/GetVertexColor to my CoreAdditions as I need them for highlighting selected surfaces. And by doing this i have noticed this issue. If i have used a reflector i might have seen that this is wanted behaviour .
Why are you making the mesh.Scale so complicated? Why don't you just renew the mesh.Scale property with MeshScale and then you can access them like this:
m.Scale ; ScaleMesh
((Entity)m).Scale ; ScaleEntity
-
Ok, some more things i have found.
-- ScaleMesh isn't included in the OOP header.
-- How to retrieve global or local vectors?
-- GetPreferedMaterialName isn't defined in the Engine.dll !! Critical !! Cant use the Surface object
-- Color cast from float[] to Color doesn't multiply with 255 (backcast from color to float[] devides by 255)
-
Wow guys, this is looking great!
Can we use Leadwerks in conjunction with Windows Forms (e.g. render to a picturebox)? This would be the way to go then certainly for Leadwerks GUI tools.
I have succesfully converted my LEControl yesterday and i will contribute it as soon as it is tested and works stable.
-
At first congrats for releasing it and thx for the hard work you both have done so far.
I have found some small additions/bugs:
Missing functions
-- CreateSurface | Declared only in Core but not in Mesh or Surface
-- Get/SetVertexColor | Not declared in Core
Small bug:
-- TriangleVertex returns void, but should return int.
Hope this will be fixed soon Currently I have a small workaround for this (Klepto.CoreAdditions).
Otherwise it seems very complete and nice.
[Edit]
found out that you can use mesh.surfaces.add([material]) as CreateSurface
the standard functions should still be accessable IMHO
@Rick: I believe he means extra getter / setter which are not available in the other languages because the engine.dll provided with LE doesn't offer these. The C# header uses a modified dll with much more functions. When using this sll with c++ or other languages, they can provide these features as well.
-
Don't use Entity.NullPointer, these Pointers are needed if you use the standard Pointer functions and not the OOP classes. Replace it with null or don't use it at all, it is an optional parameter.
-
Emitter fire = new Emitter()
use the standard constructor.
-
Hi
I hope i can help you.
1. You need to download the package from the first post as it includes all needed references like OpenTK, Leadwerks.dll etc.
2. Download tha latest version of the Control here : http://leadwerks.com/werkspace/index.php?/topic/2429-new-letkcontrol-beta/page__view__findpost__p__22982
3. Make sure you have set all References set correctly: you need a Reference to Leadwerks.dll and a reference to the 3 delivered OpenTK dlls.
If you have done this, you should be able to run the sample.
-
Hi,
here is my current C# Header of the gmfsdk. The Header Assembly is located in the Libs folder together with the gmfsdk dll.
Also the project itself is a C# Version of one of the sdk samples.
Download: GMFSDK_Header.zip
- 1
-
Reputation added
-
Nice suggestions Lazlo.
- Scilexer.dll doesn't need to be distributed as it is just for the scripteditor and not needed for the engine itself.
- Currently i notice that a lot of bmx users also distribut engine.dll --> not needed in bmx.
- I remember a chat with Josh about having Scripts in a pak file and I also rememer that this should be possible with > 2.32. @Rick he means the model scripts, not the general script folder.
- I have a Batch Asset creator in the works. I have already converted > 300MB Packages from Arteria and Dexsoft in less than 5 minutes.
Currently it is just a prototype, but it already let you convert from GMF, FBX, Obj to GMF format. Rescaling is implemented and it autogenerates materials if it can't find proper materials.
It also generates normalmaps and simple scripts. Currently the pipeline is not that easy as it sounds, but this is what i'm currently working on. Least it packs the converted models into a clean
ordered Folder.
Otherwise +1 for the other things.
-
Which engine.dll do you use? If i remember correctly you need the 2.3 dlls and not the 2.4 dlls.
-
You need to copy the engine.dll, newton.dll, jointlibrary.dll, shader.pak and if you use scripting the whole Script Folder into the Output Folder of your app (both, debug and release)
-
Rick, here is a new version:Klepto.Controls.dll
Changes:
- Added an AfterFrameworkRender eventhandler, please test if this helps and works
- Fixed MouseZ bug.
btw, its no problem that you find bugs thats why i call this beta.
PS: the FPS thing is something i need to work on. Somehow the TKcontrol limits the rendering speed and the timer is a also a bit weird.
Currently I'm experimenting with BackgroundWorkers which should work better.
[Edit]
Changes:
- Changed Timing from timer to backgroundworker. RefreshRate works now correct, set RefreshRate to -1 for fullspeed.
Awesomium in C#
in Programming
Posted
hi,
it was me who was contacting you. I'm currently working on some Extensions to the LE.Net Wrapper including a class which handle Awesomium. Some details can be found in my blog here:
http://www.leadwerks.com/werkspace/blog/16/entry-672-extending-lenet/
And here is a newer screenshot which shows a small test app with interactive Awesomium on a cube. (Mouse and Keyboard input is working)
Feel free to contact me via MSN/ICQ or Mail.