Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 May 2012
Offline Last Active Jun 11 2015 08:23 AM

Posts I've Made

In Topic: [Freetype] Cannot render font to a bitmap

11 May 2015 - 09:00 AM

I finally found what was going on:

    // Load the face
    FT_Face face;
    if (FT_New_Memory_Face(m_library, reinterpret_cast<const FT_Byte*>(data), len, 0, &face) != 0)
        SN_ERROR("Failed to create Freetype font face from memory");
        delete[] data;
        return false;
    delete[] data; // DO NOT DELETE THIS...

When FT_New_Memory_Face is used, it doesn't takes ownership or copies the data, so I must keep it alive somewhere until I call FT_Done_Face.
I added a field in my Font class to hold this data and delete it in the destructor.


Also, it seems I had to include a few more headers so when I initialize the library, Freetype loads appropriate modules to rasterize smoothly.


Now everything works fine smile.png

In Topic: Swapping header/source in Visual Studio opens wrong file

28 April 2015 - 06:36 AM

I use .hpp to differentiate C++ files from C files. The only problem I had was with old compilers a long time ago, but I never had any problems until now.

AFAIK there is no really standard extension naming for C++ files, just wide use of common ones (cpp, cxx, hpp, h, hxx...).

It seems to me the ".h" naming was hardcoded somewhere in Visual or hidden in a config file maybe, because that's the Microsoft's convention. I thought intellisense would be used and see #include "Control.hpp", but it's not the case.

Maybe I could write a macro that handles this better...

In Topic: Swapping header/source in Visual Studio opens wrong file

27 April 2015 - 05:27 PM

I use #include "Control.hpp".


The shortcut is not a macro, it's built-in. Its name is "EditorContextMenus.CodeWindow.ToggleHeaderCodeFile".


I don't want to rename all my files just because Visual Studio does that...

Strangely, if I change my header's extension to ".h", it works. But my whole project uses .hpp for C++ headers.

In Topic: wglSetCurrent() and render to texture fails

20 April 2015 - 02:34 PM

Ok, nevermind, I found it. Just forgot to disable depth test before drawing the full-viewport quads on render textures...

Now I know RenderTextures have nothing to do with this :)

In Topic: Simple 3D transform in 2D GL_Ortho ?

16 April 2015 - 05:34 AM

Maybe you can pre-transform the vertices of your model before drawing (so it will look like a 3D ellipse), and animate the UVs so you can make it visually rotate.

If you want the model itself to rotate, you'll have to use a vertex shader and appropriate perspective projection matrices.