Jump to content

SlipperyBrick

Developers
  • Posts

    543
  • Joined

  • Last visited

Everything posted by SlipperyBrick

  1. @Josh the example code from the documentation seems to be missing this line of code. // Select an appropriate pixel format that is supported by the hdc int format = ChoosePixelFormat(hdc, &pfd); if (SetPixelFormat(hdc, format, &pfd) == 0) { RuntimeError("SetPixelFormat() failed."); } The call to SetPixelFormat() has a value of 1 as its second argument (in the documentation code example). It is apparently best practice to let Windows decide which pixel format should be set by calling ChoosePixelFormat() which selects a pixel format based on the hdc and pixel format descriptor. I am definitely no pro with Win32 (never really used it as I've always leaned on other libraries such as GLFW to do the heavy work for me). When I did a straight copy, paste using the example code in the documentation I too had nothing rendered in the viewport (not even the clear colour). After some digging around the Win32 API documentation I came across the ChoosePixelFormat() function. https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-choosepixelformat
  2. @Robert_d1968 try this code in your main.cpp #include "UltraEngine.h" #include <GL/GL.h> #pragma comment (lib, "opengl32.lib") using namespace UltraEngine; // Callback function for resizing the viewport bool ResizeViewport(const Event& ev, shared_ptr<Object> extra) { // If the window resize event is captured if (ev.id == EVENT_WINDOWSIZE) { auto window = ev.source->As<Window>(); // Get the new size of the applications window iVec2 sz = window->ClientSize(); auto viewport = extra->As<Window>(); // Set the position and size of the viewport window viewport->SetShape(200, 8, sz.x - 200 - 8, sz.y - 16); } return true; } int main(int argc, const char* argv[]) { // Get the available displays auto displays = ListDisplays(); // Create a window auto window = CreateWindow("OpenGL Example", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); // Create user interface auto ui = CreateInterface(window); // Get the size of the user-interface iVec2 sz = ui->root->ClientSize(); // Create a treeview widget auto treeview = CreateTreeView(8, 8, 200 - 16, sz.y - 16, ui->root); // Anchor left, top and bottom of treeview widget treeview->SetLayout(1, 0, 1, 1); // Add nodes to the treeview widget treeview->root->AddNode("Object 1"); treeview->root->AddNode("Object 2"); treeview->root->AddNode("Object 3"); // Create a viewport window auto viewport = CreateWindow("", 200, 8, sz.x - 200 - 8, sz.y - 16, window, WINDOW_CHILD); // Adjust the size of the viewport when the applications window is resized (this will callback to our ResizeViewport() function) ListenEvent(EVENT_WINDOWSIZE, window, ResizeViewport, viewport); // Initialize an OpenGL context (get a hdc) HWND hwnd = (HWND)(viewport->GetHandle()); HDC hdc = GetDC(hwnd); // Specify the format of the default framebuffer PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, // Flags PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, // Framebuffer colour format (R, G, B, A) PFD_TYPE_RGBA, // Framebuffer colour depth (32 bit) 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Number of bits for depth-buffer 24, // Number of bits for stencil-buffer 8, // Number of render-targets in default framebuffer 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; // Select an appropriate pixel format that is supported by the hdc int format = ChoosePixelFormat(hdc, &pfd); if (SetPixelFormat(hdc, format, &pfd) == 0) { RuntimeError("SetPixelFormat() failed."); } // Create an OpenGL rendering context using our current hdc HGLRC glcontext = wglCreateContext(hdc); if (glcontext == NULL) { RuntimeError("wglCreateContext() failed."); } wglMakeCurrent(hdc, glcontext); // Render loop (applications run loop) while (true) { // Check for events const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWPAINT: if (ev.source == viewport) { // Get and set the current size of the viewport iVec2 sz = viewport->ClientSize(); glViewport(0, 0, sz.x, sz.y); // Set clear colour of viewport background glClearColor(0.15f, 0.15f, 0.15f, 1.0f); // Clear colour and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Render our triangle glBegin(GL_TRIANGLES); // Vertex 1 glColor3f(1, 0, 0); glVertex3f(0, 0.5, 0); // Vertex 2 glColor3f(0, 1, 0); glVertex3f(0.5, -0.5, 0); // Vertex 3 glColor3f(0, 0, 1); glVertex3f(-0.5, -0.5, 0); glEnd(); SwapBuffers(hdc); } break; case EVENT_WINDOWCLOSE: if (ev.source == window) { return 0; } break; } } return 0; } Sorry for the bad indentation the online code formatter doesn't show indents. Copy and paste the above code and you should get a cool multicoloured triangle in your applications window along with a sweet looking treeview widget, just like in the documentation example ?
  3. From the solution explorer window in Visual Studio you can right-click your project and select properties. You'll have a new window open, if you look on the left you have a drop-down called Linker. Unfold the Linker option and then select the Debugging option, you should see on the right-hand side an option that says "Generate Debug Info". Select the option /DEBUG:FULL
  4. When building the App Kit library in your release configuration settings, is that set to fastlink? If so I would definitely change it to full debug or even debug. The fastlink debug setting will use symbols from your build files (the compiler generates .obj files, it is what the linker uses to stitch together your program be it an exe, lib, dll, etc). This is what makes fastlink so quick, the files generated for debugging information are almost skipped, speeding up build times. I'll take my image down in my previous post as well, considering it has file paths that shouldn't really be seen. If you want to keep fastlink enabled for quicker build times you will have to package all the build files in your intermediate directory within your project for UAK and share them with us. Otherwise you'll have to change the linkers debugging option to /DEBUG or /DEBUG:FULL (by default Visual Studio usually sets this to /DEBUG for new projects).
  5. As a solution I would recommend changing your debugging configuration settings to /DEBUG:FULL. You can do this by right-clicking your project in Visual Studio and then going to: Linker > Debugging > Generate Debug Info > /DEBUG:FULL
  6. Here is a link, the second post down gives a little insight, I'm no pro with Visual Studio's build tools and configuration settings. I just thought I'd point it out in case anyone else gets the same problem. https://social.msdn.microsoft.com/Forums/en-US/7403b259-e9cc-4c61-97ce-fb8c48420172/debugfastlink-requires-object-files?forum=vcgeneral Still, I'm having great fun with the library though, it is awesome! ?
  7. That's because you have all the build files locally on your machine for your project "App Kit" (my above screenshot points to a relative path on your computer where a .pdb file is). The fastlink option is only quicker when linking because it builds a partial .pdb file that is used to index symbols from the compilation files that are created when building your code. I get the above error because I don't have those build files locally on my machine, so when I place a breakpoint to debug and F10 through some lines of code I get that error. If you have another machine to test this on you should get the same error as me
  8. It seems there may be a bug with the debug fast link option within Visual Studio, each time you place a breakpoint to run and debug you get greeted with this error dialog: IMAGE REMOVED The default build settings in the generated project from the launcher has been set to fast link so you will always get this error message before running in debug mode. I'm not too sure why but to resolve this I have had to change from fast link to full generation of debug information (it might be a good idea to apply this change to newly generated projects created by the launcher as well). I've created and built my own project (without the launcher) and the same thing happens in there and I've resolved it the same way I mentioned above. I'd like to point out that having this error message doesn't stop you from debugging, you can still see your data in the watcher and locals but it does popup every single time you go to run and debug.
  9. UAK comes with an event class that will allow you to handle events for your window and interface, you can check that out here. I've not looked into the event stuff quite yet but I'm sure its robust enough to do some cool stuff with (handling input for viewport cameras, etc).
  10. See the Ultra Engine Documentation here OpenGL Example
  11. Where can I buy UAK? I want to get my mate a copy but can't find it on Steam (I purchased when backing it on kickstarter) EDIT: Just noticed the store button, I'm an idiot ?
  12. I gotta say though man, fantastic work! Such a clean API. Your definitely right about the resizing too, this ****s rapid! My window is resizing before I even click it, that's how quick it is, lightening speed! ? And the DPI scaling mwah! I'll for sure be using this as a frontend solution for my University major project and any other desktop applications I create. I've already been recommending it to my fellow programmer pals.
  13. Can't wait to dive into this more when I have more time, its very promising (way cooler than IMGUI or any other GUI library I've come across). Although for the sake of cleanliness it would be great to have redundant includes and dependencies removed from the source. I've been trying to link and include UAK in my own project (as opposed to using the launcher to generate a project for me) and it is a nightmare having to go through and remove the excess stuff that isn't used, I've spent a good few hours perusing around various header files removing includes myself. This may be just me and everyone else is ok with this but I like to setup my projects myself as I have complete control over my build configurations, what includes and dependencies I use, as well as general control over my project structure.
  14. The OpenGL example code doesn't work out of the box in the documentation. You'll probably get this kind of result ... I'd recommend adjusting to this ... #include "UltraEngine.h" #include <GL/GL.h> #pragma comment (lib, "opengl32.lib") using namespace UltraEngine; bool ResizeViewport(const Event& ev, shared_ptr<Object> extra) { if (ev.id == EVENT_WINDOWSIZE) { auto window = ev.source->As<Window>(); iVec2 sz = window->ClientSize(); auto subwindow = extra->As<Window>(); subwindow->SetShape(200, 8, sz.x - 200 - 8, sz.y - 16); } return true; } int main(int argc, const char* argv[]) { //Get the available displays auto displays = ListDisplays(); //Create a window auto window = CreateWindow("OpenGL Example", 0, 0, 800, 600, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); //Create user interface auto ui = CreateInterface(window); iVec2 sz = ui->root->ClientSize(); auto treeview = CreateTreeView(8, 8, 200 - 16, sz.y - 16, ui->root); treeview->SetLayout(1, 0, 1, 1); treeview->root->AddNode("Object 1"); treeview->root->AddNode("Object 2"); treeview->root->AddNode("Object 3"); //Create viewport window auto subwindow = CreateWindow("", 200, 8, sz.x - 200 - 8, sz.y - 16, window, WINDOW_EMBEDDED); //Adjust the viewport size when main window resized ListenEvent(EVENT_WINDOWSIZE, window, ResizeViewport, subwindow); //Initialize OpenGL context HWND hwnd = (HWND)(subwindow->GetHandle()); HDC hdc = GetDC(hwnd); PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, // Flags PFD_TYPE_RGBA, // The kind of framebuffer. RGBA or palette. 32, // Colordepth of the framebuffer. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, // Number of bits for the depthbuffer 8, // Number of bits for the stencilbuffer 0, // Number of Aux buffers in the framebuffer. PFD_MAIN_PLANE, 0, 0, 0, 0 }; int format = ChoosePixelFormat(hdc, &pfd); if (SetPixelFormat(hdc, format, &pfd) == 0) RuntimeError("SetPixelFormat() failed."); HGLRC glcontext = wglCreateContext(hdc); if (glcontext == NULL) RuntimeError("wglCreateContext() failed."); wglMakeCurrent(hdc, glcontext); while (true) { //Check for events const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWPAINT: if (ev.source == subwindow) { iVec2 sz = subwindow->ClientSize(); glViewport(0, 0, sz.x, sz.y); glClearColor(0.0f, 0.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SwapBuffers(hdc); } break; case EVENT_WINDOWCLOSE: if (ev.source == window) return 0; break; } } return 0; } The issues I found in the code example were GetHandle returns a void * so a cast to HWND was required to get the window handle. Also the format parameter for SetPixelFormat was hard-coded to a value of 1. According to MS documentation it is best practice to get the available match of pixel format for the device context by calling ChoosePixelFormat. And the enum in the code example for the creation of subwindow was WINDOW_CHILD, this isn't included in the current build of UAK (maybe in beta, I have no idea ?) so I used WINDOW_EMBEDDED instead. I also changed what window calls ClientSize in the render loop, subwindow now calls ClientSize instead of window which results in the correct size being handed to the viewport.
  15. Yep, I just made a quick project with the launcher and it builds and runs ?
  16. Will the final build of UAK not include all the extra dependencies (such as Newton Physics, Recast, OpenVR, etc). I was expecting some source code for us to build ourselves. I've checked the UAK API and it doesn't seem to use all the other libraries that have been bundled into the distribution we have got. I've been trying to manually link UAK into my own projects but due to the all includes in the UltraEngine header it makes it quite the task to get everything configured. I know there is the UAK app on Steam that creates projects for us, I've not been able to get this to work (admittedly I've not really got into using UAK all that much just yet). Last time I booted it up to try and make a UAK project I was getting compiler errors related to missing header files.
  17. Off the top of my head I'd say: Cherno (https://www.youtube.com/user/TheChernoProject) TheBennyBox (https://www.youtube.com/user/thebennybox) One Lone Coder (https://www.youtube.com/channel/UC-yuWVUplUJZvieEligKBkA) There is probably a few more but I've pulled focus to each of these guys as they do graphics programming. Its a good opportunity for their followers to stumble upon Leadwerks 5 ?
  18. Reviews would be your best bet I'd say. Its an honest way to get feedback and some free exposure. You'll be giving others the opportunity to freely give their opinions on what they think (no shilling required). With the right people (and hopefully good reviews) that should carry enough weight to make this a reputable product and get the customers in
  19. Totally man, review videos would be pretty cool and would get the products name out there. Ah yeah my example wasn't the clearest. I was correlating with the fact that most people that watch that guy are programmers who have probably come across the same problems you described, so you'll be hitting the right audience I'm hoping to use it for my Master's project to make a small machine learning application ?
  20. Just spit-balling here ... I follow a guy on Youtube who has a pretty big following of software developers and graphics programmers. Right now he has a whole series on game engine programming and the solution he is using for developing his editor is ImGui. It may be worth contacting him and potentially doing a collaboration. This guy has a Discord with tons of professional and hobbyist application developers so you would be targeting the right audience and word of mouth would go a pretty long way (a lot of his users are also in the ImGui server). His name is Yan Chernikov (known as the Cherno), he used to work for EA within the Dice group developing the Frostbite engine. A free key and review of UAK would probably make for an interesting video ?
  21. Just backed this beast on Kickstarter, did the Developer pledge as I would absolutely love to get myself a licence. Looking forward to the first build!
  22. I am very keen to get my hands on this as there is a project I am currently working on that I am hoping to use this for. When this releases how is the library going to be delivered? Will we have a simple zipped folder with all the source/libs, etc?
  23. You had me at documentation. I used imgui for my engines editor (a project I developed through my dissertation that has turned into a small obsession of mine) and scraping the source code was always a tedious task. Plus this looks damn sexy, and those "other features" ohhh baby, got my loins burning. The moment my wallet gets a sniff of a penny you can consider this backed!
  24. @tjheldna this might be of interested to you. Since MODO 10 they added extra tools (vertex normal toolkit) that allows you to do exactly what I mentioned above. Might be worth a shot baking the results of the weighted normals into a normal map and using that inside Leadwerks so you get those nice edges you can see in Unity into Leadwerks.
  25. I would recommend looking at what weighted vertex normals are. You can achieve weighted vertex normals in pretty much any modelling package. As a quick explanation each vertex has a normal (some modelling programs give each face it's own smoothing group which ends up giving you triple the vertices you actually have (triple the normals too, remember every vertex has a normal), to stop this you can put every face of your model in one smoothing group). Weighted vertex normals basically uses the area (the area being referred to as the "weight") of a face to shift the normal of the vertex. This provides a more pleasing look for shading on your models faces. You can use weighted vertex normals to fake rounded edges without adding extra geometry to your model by optionally baking the results to a normal map. There is slightly more to it than I explained above but to get the general gist of how it works the above explanation should give you a quick idea Here is some images: Blender: Leadwerks:
×
×
  • Create New...