• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Ty Typhoon
      I like to build my A - Team now.
       
      I need loyal people who can trust and believe in a dream.
      If you got time and no need for direct pay please contact me now.
       
      We cant pay now, you will recieve a lifetime percentage if the released game will give earnings. 
      If I get the best people together for a team, everything should be possible.
       
       
      What i need:
      - Programmer c++
      - Unity / Unreal - we must check whats possible, please share your experience with me.
      - Sculpter, 3D Artist
      - Animator
      - Marketing / Promotion 
       
       
      What i do:
      - Studio Owner
      - Director
      - Recruit exactly you
      - Sounddesign
      - Main theme composing
      - Vocals
      - Game design
      - Gun, swords, shields and weapon design
      - Character, plants and animal design
       
       
      Please dont ask about the Name of the Game, about Designs or Screenshots.
      The game will be defintitly affected about our and your skills if you join the team.
       
       
      Planned for the big Game:
      - 1st person shooter
      - online multiplayer
      - character manipulation
      - complete big open world with like lifetime actions and reactions
      - gunstore with many items to buy
      - many upgrades for players
      - specials like mini games
       
      So if you are interested in joining a team with a nearly complete game idea, contact me now and tell me what you can do.
       
      discord:
      joerg federmann composing#2898
       
       
    • By codelyoko373
      I wasn't sure if this would be the right place for a topic like this so sorry if it isn't.
      I'm currently working on a project for Uni using FreeGLUT to make a simple solar system simulation. I've got to the point where I've implemented all the planets and have used a Scene Graph to link them all together. The issue I'm having with now though is basically the planets and moons orbit correctly at their own orbit speeds.
      I'm not really experienced with using matrices for stuff like this so It's likely why I can't figure out how exactly to get it working. This is where I'm applying the transformation matrices, as well as pushing and popping them. This is within the Render function that every planet including the sun and moons will have and run.
      if (tag != "Sun") { glRotatef(orbitAngle, orbitRotation.X, orbitRotation.Y, orbitRotation.Z); } glPushMatrix(); glTranslatef(position.X, position.Y, position.Z); glRotatef(rotationAngle, rotation.X, rotation.Y, rotation.Z); glScalef(scale.X, scale.Y, scale.Z); glDrawElements(GL_TRIANGLES, mesh->indiceCount, GL_UNSIGNED_SHORT, mesh->indices); if (tag != "Sun") { glPopMatrix(); } The "If(tag != "Sun")" parts are my attempts are getting the planets to orbit correctly though it likely isn't the way I'm meant to be doing it. So I was wondering if someone would be able to help me? As I really don't have an idea on what I would do to get it working. Using the if statement is truthfully the closest I've got to it working but there are still weird effects like the planets orbiting faster then they should depending on the number of planets actually be updated/rendered.
    • By BenjaminBouchet
      Learning game development in Unreal Engine could be a daunting task for someone who don’t know where to start, and a cumbersome process if you don’t organize your progression correctly. One thing commonly known by experienced developers and by people unfamiliar with coding: mastering a development language is a long and difficult task.
      From blueprints to C++ in Unreal Engine
      If you want to learn fast, you need a good learning strategy. Unreal Engine contains a very powerful tool which you can use to learn C++ faster: its blueprint system. Blueprints are extremely easy to learn (and you may already have a good knowledge of them). Thus you can conveniently use them as a guide for writing code in C++. This is the reason why I am writing a tutorial series on how to make the transition from Unreal Engine blueprints to C++.
      Learn and practice C++
      Following this tutorial, you’ll acquire new concepts of C++ programming in every chapter. Then following chapters will give you reasons to reuse and practice those same concepts. There’s no better way to wire you brain.
      Link to the tutorial: [Tutorial] Learn C++ in Unreal Engine 4 by making a powerful camera
      Please do send me as much feedback as you want. I’ll be considering every constructive remarks and taking them into consideration. Your feedback will help me to improve and update the existing chapters and to make the next one better.

      View full story
    • By BenjaminBouchet
      Learning game development in Unreal Engine could be a daunting task for someone who don’t know where to start, and a cumbersome process if you don’t organize your progression correctly. One thing commonly known by experienced developers and by people unfamiliar with coding: mastering a development language is a long and difficult task.
      From blueprints to C++ in Unreal Engine
      If you want to learn fast, you need a good learning strategy. Unreal Engine contains a very powerful tool which you can use to learn C++ faster: its blueprint system. Blueprints are extremely easy to learn (and you may already have a good knowledge of them). Thus you can conveniently use them as a guide for writing code in C++. This is the reason why I am writing a tutorial series on how to make the transition from Unreal Engine blueprints to C++.
      Learn and practice C++
      Following this tutorial, you’ll acquire new concepts of C++ programming in every chapter. Then following chapters will give you reasons to reuse and practice those same concepts. There’s no better way to wire you brain.
      Link to the tutorial: [Tutorial] Learn C++ in Unreal Engine 4 by making a powerful camera
      Please do send me as much feedback as you want. I’ll be considering every constructive remarks and taking them into consideration. Your feedback will help me to improve and update the existing chapters and to make the next one better.
    • By mrDIMAS
      Hello everyone! I need to fill lua table with functions from script file like this:
      function init() end function update() end I need to create table on stack and fill it with this functions from specified file. How can I do this?
  • Advertisement
  • Advertisement

Getting 0xcccccccc error

Recommended Posts

I don't know why this is happening, in the image below you can see my current situation.

Basically I have an Utility.h header which contains wathever random stuff I think is useful at the time but don't yet deserves it's own separate file, so inside of it I've put a BaseFont class and defined it in place since I am not sure it will stay into Utility.h for long (Font is an alias for BaseFont because I wanted the internal variable name for the font to be Font, and that would collide with the class name, so that's why I have it setup like this) and right below this class, still in the header, I have a global object constructed from it so that I can use it everywhere for debug since pretty much all my .cpp #include "Utility.h". Now when I close the game I get an error that says "Breakout.exe stop working" and I tracked it down to the BaseFont destructor. On the right of the image you can see the local variable situation at that break point, which doesn't looks good...

I have some assumptions regarding the cause but I am not quite sure, can you tell me what its going wrong exactly? :P

FULL SIZE IMAGE

IbHWiGx.png

Edited by MarcusAseth

Share this post


Link to post
Share on other sites
Advertisement
2 minutes ago, Hodgman said:

Your class doesn't comply with the rule of three, which means that if anyone copies it, you'll end up with a double deletion bug in the destructor, so that could be it.

Added the code below, still in the same situation, must be something else :)

	BaseFont(const BaseFont&) = delete;
	BaseFont& operator=(const BaseFont&) = delete;
	BaseFont(BaseFont&&) = delete;
	BaseFont& operator=(BaseFont&&) = delete;

 

Share this post


Link to post
Share on other sites

More informations:

App::~App()
{
	if (Window) { SDL_DestroyWindow(Window); }
	if (Renderer) { SDL_DestroyRenderer(Renderer); }
	for (auto& elem : Textures)
	{ SDL_DestroyTexture(elem.second); }

	if (TTF_WasInit()) { TTF_Quit(); };
	SDL_Quit();
}

I think the "global static" Font Arial lifetime has to do with the problem, since I am guessing the object is probably still around after TTF_Quit() is called (which happen after main() returns basically.

But still, I tested by removing the TTF_Quit() and it improves since I don't get the "Breakout.exe stop working" anymore, but according to the debbugger when we hit that breakpoint in the image in the first post, the situation is still the same, the memory of "this" being 0xcccccccc... any idea why is that? :/

Share this post


Link to post
Share on other sites
8 minutes ago, MarcusAseth said:

the memory of "this" being 0xcccccccc... any idea why is that?

0xcc is microsoft's debug mode marker for uninitialized stack memory. You'll notice others over time too -- 0xcd is uninitialized heap memory, 0xdd/0xfeee is free'ed memory, 0xfd is guard regions to check for overruns... So this is an indication that 'this' is pointing to a region of the stack that's never been used :o

What's the call-stack when the crash happens? How are you instantiating the BaseFont class?

[edit] Taking another look at your code, a side issue is that you never initialize the 'Font' member, but read from it before ever writing to it (via "if (Font)"). This is extremely dangerous and is only working due to luck at the moment.

Share this post


Link to post
Share on other sites

I apologize, actually it appears that if I step forward into the code, the 0xcccccccc turns itself into a reasonable address when it hit the problem (as shown in the image below), and the problem I think it was calling a TTF function after TTF_Quit().

It's just strange that didn't show me the proper "this" address at the breakpoint and even after stepping forward twice, only changed into it when it hits the error, is this something that happens debugging static variables?!

Anyway I still have the problem of  TTF_Quit() being called before the font are closed...how should I do in order to have that font global? I should like wrap it into a "global static FontManager" in which I register and request fonts and it takes care of freeying all the fonts before calling TTF_Quit()? Seems the only way I think :\

Ml7Ud0b.png

Edited by MarcusAseth

Share this post


Link to post
Share on other sites

The Font is a static object created in an included header, the App object is created inside of main(), I think it has to do with it.

I placed 2 breakpoints, one on App destructor and one on the Font destructor, App's destructor get fired first :\

So that's why I thought they should be wrapped together in another class "FontManager", so that I can keep the global object behaviour for the Font and correctly order the cleanup inside of a single destructor

Edited by MarcusAseth

Share this post


Link to post
Share on other sites

Don't create code that runs before/after main. That means don't create global objects with non-trivial constructors/destructors. It only causes headaches.

If you really need a global font (hint: you don't, but whatever), then create the font object itself inside main, and create a global pointer to it.

Share this post


Link to post
Share on other sites
7 minutes ago, Hodgman said:

If you really need a global font (hint: you don't, but whatever)

Got it :D

I should probably pack it in a vector<Font> into the App class . Is ok to have it on the stack though? Or should I use unique_ptr for those as well? Font sounds like a lightweight thing, but I don't want to make assumptions...

Edited by MarcusAseth

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Advertisement