Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Jan 2007
Offline Last Active Jun 29 2014 02:06 PM

Topics I've Started

Working with Sprite Batches

14 May 2014 - 01:34 AM

I'm working with OpenGL ES 2.0 and OpenGL 2.1, and I've run into this issue where I need to sort my vertices for my sprite batch. For example, if I set the depth too high for a sprite where its vertices are at the beginning of the vertex buffer, then it'll draw on top (expected), but any alpha borders will draw on top of it too. I did post a thread on this months ago, but wasn't able to get to it at the time, and forgot. The solution that was proposed was to sort the indices, which I think is a good idea. Currently, I'm not using an IBO or VBO for indices or vertices. Would VBO/IBOs be useful at all? I currently use an STL vector for my vertex array and another for my index array since it's mutable whenever I need to add/remove, possibly reorder or transform the sprites in any way. I'd like give each sprite its own matrix to pass to the shader, but then I'd be uploading huge amounts of uniform matrices when I have many sprites onscreen.


So, would it be wise to re-sort my entire index buffer whenever sprite is added or its depth changes? This would work well for an axis-aligned orthographic camera, but what if the camera rotates? This would happen quite a bit if I ever wanted to use my sprites with a perspective camera. I'd also like to support billboarding with my sprite batch for perspective purposes. If I were to billboard, wouldn't I need to ensure that each billboard is drawn from back-to-front each frame (assuming glDepthFunc is setup that way)? What would be a decent way to sort my sprites by depth? Should I just re-order the index buffer (not the vertices) based on signed distance to the camera drawing them? A dynamic camera could easily change the depth of a sprite's (aka, "billboard's") distance on a frame-to-frame basis simply by moving and re-orientating the camera.


Another issue I'm running into is disabling sprites. What if I don't want to render a sprite? I treat all sprites as a Transform subclass in my code, like models, particles system and other entities my scene manager updates and renders. The differences is that it doesn't own its own geometry data because it's grouped together in a huge batch vector. Would it just be wise to set the alpha for my disabled sprites' vertices to zero, or would it be wise to move its vertices out of the vertex/index vectors until it's re-enabled? Setting alpha to zero can be heavy on mobile hardware, especially if it's a large sprite.


Any thoughts on the matter would be really helpful!

Animated File Format for Blender and Assimp?

07 May 2014 - 09:28 PM

I'm trying to find a good intermediary model file format that both Blender and the Assimp 3.0 C/C++ library both support (as the topic title suggests, lol). It seems that .blend, FBX and COLLADA aren't totally supported by Assimp. The FBX exporter I'm using with blender doesn't work import, the .blend files I've been able to "successfully" generate an Assimp scene from doesn't provide any geometry. Would Microsoft's deprecated, .x format fair pretty well for the two? I haven't had the chance to try yet, but if anyone has any suggestions for supporting animated models with the two, I'm all ears.


Btw, I haven't had any luck with Doom 3's MD5 exporter with Blender.

Compiling Qt Interface Designer UI Files

04 May 2014 - 05:42 PM

Hey all, I've been wanting to build a multi-platform GUI application, and I like the Qt Designer's interface. I started learning Qt again, but I'm not enjoying the IDE. It turns all of my tabs into spaces, and I'm having indentation issues. Linking to libraries, and the way we structure our code are also annoying. I'm using CodeBlocks as my main C++ IDE, and it's pretty decent. I'd like to develop everything in CodeBlocks, and use Qt Interface Designer to develop my UI. Does anyone know of a way to use Qt Designer's UI files with CodeBlocks?


I wouldn't mind using another cross-platform UI system such as wxWidgets, but the UI looks old, and I haven't found a designer application for that. GTK+ also has its quirks too.

QT Creator + Other IDEs

02 May 2014 - 12:19 AM

I'm developing a model viewer that'll rely on my own OpenGL-based game engine to do the processing and rendering. I was able to get an OpenGL view working in my QT application just fine, but I'm having issues getting the game engine to hook into it.


My build tree in QT Creator consists of two projects:


-Model Viewer


The engine is built as a shared object (I'm using Debian), and everything compiles fine. The Model Viewer project references my Engine project going the External Library route because I couldn't get my built library to appear in the Internal Library's drop-down. I included by engine's header, and was able to make a call to my game engine's static Engine::Start() method. It compiles, but my Model Viewer application crashes before the window even draws. It doesn't give me anymore information, so I'm not sure what exactly's going on... Does anyone have any ideas on how to debug this? I'm kind of new to debugging in QT Creator.


EDIT: I figured out the crash: I forgot to initialize GLEW before making gl* calls. My question below still remains, however ;)


On a side now, I am comfortable with CodeBlocks, and a lot of my projects using my engine uses that. Is there a way to build my QT-based UI in its Interface Designer, save it out as a .ui file, then get it to load using the QT SDK in CodeBlocks? The way I understand it is even though QT is a C++ SDK, it uses its own compiler to compile code as it has extra keywords such as "signal", "slot", etc.

Library For Downloading Files

24 April 2014 - 12:26 PM

I'm looking into open-source libraries for sending and receiving data over a network. I use libcurl for doing things like HTTP requests, which has been helpful. I also need to download files from a server such as xml/png images for loading a dynamic, in-game store. I see that libcurl can download files, but that requires setting up a file writing handler that'll write/save the files. After some Googling for an FTP library in C, I found this thread talking about sticking with libcurl. I may take up that offer, but I was just wondering if there were any other alternatives out there.