Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


dlan

Member Since 06 Oct 2013
Offline Last Active Mar 16 2015 11:30 AM

Posts I've Made

In Topic: Good C (not C++) math library?

10 November 2014 - 06:06 PM

Kazmath seems a library that could suit your need, it's cross-platform and is used by cocos2d-x (even though the last version have transitioned to a c++ math library). I personally use only a small subset of it, but so far the library is robust enough.


In Topic: Drawing Text using glTextImage2D + FreeType : GL_INVALID_ENUM error

29 October 2014 - 06:31 AM

actually, you should only have one value from freetype, so GL_RED should be enough, sorry my mistake.

 

yes,  edit your shader where the r value of your color will contain you alpha value.

 

or use a swizzle mask like explained here, in your case it would be:
 

//after binding the texture
GLint swizzleMask[] = {GL_RED, GL_RED, GL_RED,GL_RED};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);

with this you don't need to change your shader.


In Topic: Drawing Text using glTextImage2D + FreeType : GL_INVALID_ENUM error

29 October 2014 - 05:53 AM

It should be GL_LUMINANCE_ALPHA instead of GL_ALPHA, freetype output a luminance value + an alpha value per pixel.

 

Also, keep in mind that GL_ALPHA and GL_LUMINANCE_ALPHA have been removed starting with core OpenGL 3.1, you might want to use a different format and edit your shader to copy the value in the corresponding color channel (explained on this stackoverflow page) . You can also just create your own bitmap buffer with 4 byte per pixel and copy the luminance value in the RGB channels directly.


In Topic: Ogre3D Animation Help

21 May 2014 - 12:10 PM

How do you export your model to Ogre3D format? The exporter usually create a mesh and skeleton file where you have all you animation separated. For me you got a problem with how you export your model.

 

In my case, the modeling software I used export the mesh / skeleton and animation definition in xml form that I later convert into Ogre mesh format with the Ogrexmlconverter tool.

 

I never tried to clone animations at runtime, but I suppose you can use getNodeTrackIterator() to get all the track for an animation (a track is associated to a bone, which is derived from a node), then iterate on each keyframes of a track to get it content (with getNodeKeyFrame of the nodetrack object) and use the getTime() function of the KeyFrame to filter out unneeded frames. After that, you will need to use CreateNodeTrack and CreateNodeKeyFrame on your node track to create your frames on your new animation.

 

 

Here's a sample of an animation xml file that can be converted to Ogre format, to give you an idea of the hierarchy used by Ogre:







<animations>
	<animation name="Idle" length="3.33333" >
	<tracks>
	<track bone="LeftHand" >
		<keyframes>
			<keyframe time="0" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0" >
					<axis x="0" y="0" z="-1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			<keyframe time="0.673401" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0" >
					<axis x="0" y="0" z="-1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			
		</keyframes>
	</track>
	<track bone="RightHand" >
		<keyframes>
			<keyframe time="0" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0.0872659" >
					<axis x="0" y="0" z="1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			<keyframe time="0.673401" >
				<translate x="0" y="0" z="0" />
				<rotate angle="0.0872659" >
					<axis x="0" y="0" z="1" />
				</rotate>
				<scale x="1" y="1" z="1" />
			</keyframe>
			
		</keyframes>
	</track>
	<tracks>
	</animation>
</animations>

In Topic: how to go to be considered when making save/load functionality?

09 April 2014 - 02:40 PM

Protobuf is a library to consider when dealing with serialization / creation of custom file type, I personally use it for storing levels data. You just create a proto file with your class structure like this:



message InventorySlot
{
  required int32 itemId = 1;
  required int32 itemcount = 2;
}

message CharacterData {
     required string name = 1;
     required int32 health = 2;
     repeated InventorySlot inventory = 3;
}

then you use the generator to create your c++ classes (or other language, there is a lot of decent third party protobuf library / generator available : http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns ), and you can use the built-in SerializeToOstream function to save your objects content into a binary file. 

 

Another library I used for save file in one of my RPG project is SQLite, which is a file based database library. No need to have a server or anything, just include the library in your project, and you can open a database file and use SQL command like it's a normal database. It's geared toward speed and small memory footprint.  you need to know a little about SQL, but the advantage is that you can patch your save file really easily. I also played around with integrating an economy system, built-in sql function make it easy to do so.


PARTNERS