Page 1 of 1

FFGL Text Rendering

Posted: Fri Mar 12, 2021 21:58
by CatSack
Hi,
I am completely brand new to all of this (Resolume, FFGL, so on) but I've gotten the general gist of it. I can make a simple plugin with FFGL, and I'm pretty good with WebGL, but I have very little C++/C experience. I've been asked to code a plugin involving text rendering, which I found out you should do with FreeType. I got it imported correctly, and have been trying to follow along with some tutorials I found, but to be honest I have no idea where to put any of the code. Any help getting started would be greatly appreciated!

Re: FFGL Text Rendering

Posted: Mon Mar 15, 2021 13:53
by Zoltán

Re: FFGL Text Rendering

Posted: Mon Mar 15, 2021 18:51
by CatSack
Zoltán wrote: Mon Mar 15, 2021 13:53 This might help: viewtopic.php?f=14&t=17231
I checked that out already, that's actually where I got the idea to use FreeType. I've read enough tutorials about it to get how it works, I'm just unsure where I should put everything in my existing code. Thank you though!

Re: FFGL Text Rendering

Posted: Thu Mar 18, 2021 14:49
by Menno
Perhaps the examples in the ffgl repo can be of use to you. For example https://github.com/resolume/ffgl/blob/m ... dients.cpp

stuff you need to do once during loading go into InitGL, Rendering goes into ProcessOpenGL. If you need help with how to use c++ you're probably best off to find a tutorial or book somewhere.

Re: FFGL Text Rendering

Posted: Sun Mar 21, 2021 20:32
by CatSack
Menno wrote: Thu Mar 18, 2021 14:49 Perhaps the examples in the ffgl repo can be of use to you. For example https://github.com/resolume/ffgl/blob/m ... dients.cpp

stuff you need to do once during loading go into InitGL, Rendering goes into ProcessOpenGL. If you need help with how to use c++ you're probably best off to find a tutorial or book somewhere.
I looked around at those a little already, and I think the issue is that I'm just not very familiar with FFGL's code structure. I know what all of the FreeType tutorials are doing, I just don't know where I should put that. I've tried rearranging their code in many ways and putting it inside of different functions but it always gives a similar error about an "unresolved external symbol". I know that I've imported FreeType correctly, and the error only pops up whenever I try to use previously created FreeType variables. An example of the first chunk of code that would be used for FreeType looks like this:

Code: Select all

	FT_Library ft;
	FT_Face face;

	if( FT_Init_FreeType(&ft))
	{
		(throw error)
	}

	if(FT_New_Face(ft, "FreeSans.ttf", 0, &face))
	{
		(throw error)
	}

	FT_Set_Pixel_Sizes( face, 0, 48 );

	if( FT_Load_Char( face, 'X', FT_LOAD_RENDER ) )
	{
		(throw error)
	}

	FT_GlyphSlot g = face->glyph;
Wherever the variables ft or face get used, the error gets thrown (like the if statements or FT_Set_Pixel_Sizes). I've tried putting that code in all sorts of places but it always does the same thing.
This is about as far as I've managed to get with this, any help would be greatly appreciated!

Re: FFGL Text Rendering

Posted: Mon Mar 22, 2021 09:38
by Menno
Looks like you aren't linking freetype correctly.
Perhaps something like this could help? https://www.learncpp.com/cpp-tutorial/a ... 5-express/

freetype should have a description on how to build it from source or where to get a binary library, i think it includes project files to build the library already.