Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

269 Neutral

About Dekowta

  • Rank
  1. Ok seems like I solved it myself. Have to restart the audio if its playing when its updating the stream. I did actually do it earlier but the audio was stuttering (might have had a trace there thinking about it now). Was going to run all the audio in a thread since pre processed audio will still play when the screen is moved which could offset things so want all audio to run during the window move or resize event.
  2. Hi, I've got openAL and FFMPEG set up both with streaming and pre loading of audio data however I have a few issues with the streaming side which seems to set the openAL source to stop without implicitly calling the alSourceStop command.   The commands from FFMPEG that I know trigger it are av_q2d (no idea why this does it) and av_read_frame. I havent read in full detail the FFMPEG API but I have a feeling that av_read_frame may unload the any other streams currently loaded (though I hope im wrong on this) but this still doesnt really explain why it would cause any openAL sources to stop. The other trigger to stopping the buffered openAL source is moving or scaling the window no idea why this is happening. If anyone has any details on what could be triggering this it would be a great help otherwise going to try and dig deep into FFMPEG and OpenAL to see if I can find the problem. Thanks Dekowta
  3. Dekowta

    Signed Distance Field issues

    Solved the issue with the field not looking correct as I loaded the texture with the GL_NEAREST parameters which does not work with the signed distance method. Still need to solve the dead reckoning method as I would like to have a internal converter rather than having to load a pre made signed distance field in.
  4. Hi, I've been experimenting with singed distance fields in OpenGL for a bit now and I've come across a few issues I need some help to solve.   I have put all the images here http://imgur.com/DxGdGe9,1qXKq0d,8rYcS3J,U4VI01S,yYal9yV#0 as they are rather large The first is that I have the basic fragment shader for performing the alpha testing   in vec2 VTexCoord; in vec4 VColour; uniform sampler2D Tex1; out vec4 FragColour; void main() { float distance = texture( Tex1, VTexCoord ).a; float smoothWidth = fwidth(distance); float alpha = smoothstep(0.5 - smoothWidth, 0.5 + smoothWidth, distance); FragColour = vec4(VColour.rgb, alpha); } I use it on the following singed distance field generated via the tool that comes with libgtx (https://github.com/libgdx/libgdx/wiki/Distance-field-fonts) which is the first image. The result gained from using the first image can be seen in the third image which looks ok but jagged around the edges and when zoomed in (second image) its doesn't seem to be working as i expected since i thought it would retain a smooth curve rather than pixelated edges. I don't know if there are any opengl states that need to be set before applying the shader or if the texture needs have different parameters. I cant really post all the code for rendering since its rather large but its all here: https://bitbucket.org/Chris_Millin/moonlight-engine/src/87ccdb3302c5082a1ab065ec3da37923205f7197/Moonlight/Moonlight/?at=master and the implementation at the moment is   #include <MoonLight.h> using namespace std; int main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {     MLWindows::MLWindowsContext* WindowContext;     WindowContext = new MLWindows::MLWindowsContext(hInstance, hPrevInstance, lpCmdLine, nShowCmd);     WindowContext->Create(L"MoonLight Test Bed", 1280, 720, 32, true);     //set up the openGL stuff     MLRenderer::MLGLContext* GLContext = new MLRenderer::MLGLContext();     WindowContext->BindGLContext(GLContext);     GLContext->Initalise();     GLContext->SetClearColour(Vector4f(0.0f,0.5f,0.0f,1.0f));          MLInput::MLInputManager::Initalise();     MLInput::MLInputManager::CreateRawKeyboard();     MLRenderer::MLText::MLFontCore::Initalise();     MLRenderer::MLCameraManager::Initalise();     MLAudio::MLAudioManager::InitaliseAudio(false, 0);     WindowContext->SetResizeCallBack(&MLRenderer::ResizeGL);     WindowContext->SetInputCallBack(&MLInput::MLInputManager::InputMSGHandler);     MLGraphics::Initalise(5000);     MLRenderer::MLText::MLFontCore::Initalise();     MLTrueTypeFont font;     font.LoadFont("TestFont.ttf", 256);     font.SetPaddingX(15);     font.SetPaddingY(15);     font.SetTextureWidth(4096);     font.SetTextureHeight(4096);     font.LoadDefaultGlyps();     MLTexture* sdfTest = new MLTexture();     sdfTest->LoadTexture("TEST.png");     MLSprite newSprite;     MLTexture* text = font.GetFontTexture(0);     /*text->StartEditing();     text->ExportImage("TestBefore.png");     text->ConverttoGrayScale();     text->ExportImage("Test2.png");     text->ConverttoSignDistanceField(1, 4);     text->ExportImage("Test.png");     text->EndEditing();*/     newSprite.Texture = sdfTest;     newSprite.SetSizeFromTexture();     newSprite.SetSourceFromTexture();     newSprite.Colour = Vector4f(1.0f);     MLShader* sdfShader = new MLShader();     sdfShader->LoadShaderFile("shaders\\SignedDistanceField", GL_VERTEX_SHADER);     sdfShader->LoadShaderFile("shaders\\SignedDistanceField", GL_FRAGMENT_SHADER);     sdfShader->Lock();     sdfShader->BindAtt(MLRenderer::MLAttID::ML_ATT_VERTEXPOS,    BASE_SHADER_VERT_POS);     sdfShader->BindAtt(MLRenderer::MLAttID::ML_ATT_VERTEXCOL,    BASE_SHADER_VERT_COL);     sdfShader->BindAtt(MLRenderer::MLAttID::ML_ATT_TEXTURE0,    BASE_SHADER_VERT_UV);     sdfShader->LinkShaders();     sdfShader->Unlock();     while(1)     {         if(MLInput::MLInputManager::IsKeyPressed(MLKeys::Up))         {             newSprite.Scale.x += 0.02f;             newSprite.Scale.y += 0.02f;         }         if(MLInput::MLInputManager::IsKeyPressed(MLKeys::Down))         {             newSprite.Scale.x -= 0.02f;             newSprite.Scale.y -= 0.02f;         }         GLContext->StartFrame();         MLAudio::MLAudioManager::UpdateAudio();         WindowContext->Update();         MLGraphics::Begin();         newSprite.Position = Vector2f(0.0f, 0.0f);         newSprite.Shader = sdfShader;         newSprite.Effect = MLSpriteEffect::None;         MLGraphics::Draw(&newSprite);                  MLGraphics::End();         GLContext->EndFrame();                       } } The second problem Im having is that I have implemented the Dead Reckoning method to create a signed distance field but I have no idea how to limit the spread of the distance values and I end up with a mess (images four and five). The code im using for calcualting the values are the same as (http://people.sju.edu/~ggrevera/software/distance/html/class_dead_reckoning__3x3.html). My maths isn't amazing but I do understand the concept just dont really have a clue on how to limit the spread. Thanks
  5. Dekowta

    Open Source Scene Graph

    By linked in a hierarchical fashion I mean as a binary tree but where a child can only contain one parent this way any attribute of the parent node can cascade down to the child nodes.   In your case where you would require the need of a object to be linked to another object through the animation tree you would not include the animation tree into the scene graph but have a node which has a reference to the animation along with the model, any textures, special shaders and any other requirements which may effect child nodes. To create the grip object you would have the ability to reference a bone in the animation tree and then set a attribute to it, then any other object you create which has the grab attribute set to it. Once the object are running all you would have to do is set the grab object as the child of the grip object and if you have written the behavior to link the two together the two should lock together in the correct place. I believe this is what L. Sprio was getting at with the scene graph being used to assist in situations where you need cascading data (though I could be miss interpreting what he/she said).
  6. Dekowta

    Open Source Scene Graph

    From a core level it would work as a set of rules with what should and shouldn't be included into the scene graph but I still don't think it would be able to cater to every need if implemented in a fix fashion. Take for example nVida's SceniX which has a strong focus towards shader management in its scene graph I don't think their implementation would work for every situation. The proposed project though in theory should avoid this though as in the end what should be available is a 3D editor where objects can be placed and linked in a hierarchical fashion with attribute being related. Once complete you just export it as an XML or some other structured file format and load it into the specified engine (as long as some serializer is written for the file) where it chooses what to do with the information. I may be wrong though this is all part of the study; its interesting how scene graph gets interpreted by everyone.
  7. Dekowta

    Open Source Scene Graph

    This is what I would expect to be expressed in your version of the 'scene graph' there may be more items happening behind the scene but from my personal stand point the scene graph should be capable of representing anything that you need to visually see in the scene during development. But I completely agree with all your points. The major problem is that I have come to this conclusion before writing the application which is a slight requirement to my dissertation.
  8. Dekowta

    Open Source Scene Graph

    The problem with the scene graph is that it can contain any number of things that are associated with the game that may or may not be representable through the use of a modelling package. From my own opinion on what a scene graph should contain at a core is the model, texture and transformation matrix with a hierarchical parent to child relationship. From there you can go anywhere; so if you want to include collision into the scene graph data you could but maybe you don't need to and all your models calculate their own fancy collision so instead you want support for complex animation morphing. This is where my user requirements come into play as I need to know what it the most popular items that need to be expressed in a scene so there is the option to implement them. From a personal stand point I don't feel there is a need for this project as engine design and 3D graphics has come to a point where they require their own implementation to take full effect. However this is still early to call that as I need to try and implement the system first to see if there is any possibility of it working.
  9. Dekowta

    Open Source Scene Graph

    Hi, I'm not 100% sure if this is the right place to post this so please let me know so I can remove it and move it to the correct board. I am a student at The University of Portsmouth and as part of my final year project I am focusing on the development of an open source scene graph editor which is in theory designed to help work with custom built engines and is aimed at independent developers and students. Since this project focuses on development for independent developers and students I need to find out what requirements they are after to allow the software to be designed around them. This is where I need some help I have created a very small (hopefully 3-5min) survey that would aid me in completing this task. The survey can be taken online here https://www.surveymonkey.com/s/HGRMYRX. Thank you Chris
  10. I tried out what you mentioned one paper and It makes a lot of sense and is far quicker than the ideas I was coming up with. It also will help with box2D when I come to allow for concave shapes. I will code it in tomorrow or tonight and see if it all works but I believe it should do. The only time I can see it breaking is when a lines intersect which should not happen any way.
  11. Thanks for the replies so far. I'm going to have to look through them tomorrow and work out how they function. I also noticed I said convex instead of concave with the last shape. I have no problem with convex shapes its when the shape has a concave section I have a problem.  
  12. Hi, I expect this has been asked before but I honestly don't really know how to go about finding the information since most of my searches don't contain the information I expect. My problem at the moment is that I am trying to create a list of indices from a set of points. The points have to work in clockwise direction to create the custom 2D geometry. I have draw out some images to hopefully explain what I want to do and the way I am currently thinking about going about it. In Shape A (0) I have my 6 points which make up my shape and in Shape A (1) you can see what shape it should create if the points are connected one after the other starting at 1 and ending at 1. To Draw the shape I ideally would like to segment the shape into triangles and have the points of each triangle as shown in Shape A (2). Now the way I am currently thinking about doing this is to actually start with breaking the shape into as many quads as possible since I feel they are easier to work with and once all the quads have been found its just a matter of cutting them in half to create all the triangles for the shape. So in Shape A (3) I would start with points 1, 2, 3, 4 and check to see if they can create a valid quad which does not have any sides intersecting each other and that the quad does not have any of the other points of the shape inside of it. In Shape A (3) 1, 2, 3, 4 is valid and points 2 and 3 can now be ignored since they wont ever have anything else connect to them. Since there are now only 4 points left the next quad should be 4, 5, 6, 1. I haven't tried it with too many shapes on paper but I believe that system should work and in Shape B it also works but unlike shape A points 1, 2, 3, 4 don't create a valid quad as can be seen in Shape B (0). So points 2, 3, 4, 5 are then checked and again they wont make a valid quad. 3, 4, 5, 6 do how ever and 4 and 5 are now take out. 6, 7, 1, 2 should also not make a valid quad but 7, 1, 2, 3 will (1 and 2 are then take out). That then leaves 3, 6, 7 left to create a triangle. The only issue I have though is when it comes to concave shapes as can be seen in Shape C (0). 1, 2, 3, 4 is valid as well as 4, 5, 6, 7. As you can see though 4, 5, 6, 7 does not correctly create the shape and also means 5 and 6 are ignored leaving 8, 9, 1, 4 to be valid even though 5 and 6 are inside of the quad. If the concave section is spotted and is ignored correctly then Shape C (1) should be the result. Sorry if I have explained this really poorly. It all make sense in my head but I sometimes struggle explaining it. If there are any simpler method of doing this of anything that you think will help that would be good enough. Thanks Chris
  13. Hi, I'm soon going to starting my dissertation for my final year of Uni and would like to see if anyone would want or use the Application that I am proposing to design. A big part of my project is going to scripting and is what I will mainly focus on. The project I propose is to build upon the existing box2D testbed application (that comes with the C++ sdk) and add Angel Script to the framework. It will work exactly the same as it currently does but rather than having to create a new C++ class and inherit from the framework to add a test a Angel Script file can be loaded and the test can be run and modified while the application is running. What this will allow is for anyone to prototype new physics within box2D without having to wait and compile the project each time. It will also allow for scripts to be linked via #include so generic pre build scripts (such as a player hit box and movement) can be added to the simulation with ease. I know there are similar things out there but I would aim to keep box2D registered the same in Angel Script as it is in C++ so the current tests could be remade quickly in the new application. If anyone would be interested in something like this or want to make any suggestions feel free to do so. Thank you very much. - Chris
  14. Dekowta

    Ref counting

    Thanks for the reply. Sorry didn't reply sooner thought I had done already. Seems to have worked fine though the object still seems to exist after the ref count reaches 0 and the object is deleted. For example:     Aclass@ myclass = Aclass(); void initalise() {     Print("init");     myclass.printA(); } void update() {     myclass.printA(); }   The add ref function is called and then the remove ref before the initalise function is called yet the myclass object works as intended and now my map has no objects stored. not really sure what is going on though im sure im doing something wrong. The class is registered as followed   AngelManager::registerClass("Aclass", 0, asOBJ_REF); AngelManager::registerClassBehaviour("Aclass", "Aclass@ f()", asBEHAVE_FACTORY, asFUNCTION(createA)); AngelManager::registerClassBehaviour("Aclass", "void f()", asBEHAVE_ADDREF, asFUNCTION(ObjectA_AddRef), asCALL_CDECL_OBJLAST); AngelManager::registerClassBehaviour("Aclass", "void f()", asBEHAVE_RELEASE, asFUNCTION(ObjectA_Release), asCALL_CDECL_OBJLAST); AngelManager::registerClassMethod("Aclass", "void printA()", asMETHOD(Aclass, printA));  
  15. Dekowta

    Ref counting

    How then would I go about implementing reference counting on a C++ object I don't have access to adding a reference counter directly to the object?  
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!