Kentae
Member
So I've got this custom vertex format.
It's set up like this:
And when I build a model with it I use this script:
The vertex buffer is created elsewhere wich is why you can't see it here.
That's not the problem though. The model builds and renders the way it should... with the exception of the texture. For some reason my model turns out a mint green kind of colour. This makes no sense to me :S
When I use a more standard format like this:
Without any custom values, it renders correctly, texture and everything. (obviously I change my model build script to match the format)
I tried changing "vertex_format_add_custom( vertex_type_float3, vertex_usage_tangent );"
to "vertex_format_add_custom( vertex_type_float3, vertex_usage_textcoord );" and a few others but only the one I mentioned now let my texture draw again. However the texture is kind of double at this point, with a second, slightly faded, texture that is offset a bit drawing as well.
Can anyone here make sense of this?
Am I adding custom values to my format wrong?
I use GMS 1.4.9999.
It's set up like this:
Code:
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_normal();
vertex_format_add_colour();
vertex_format_add_textcoord();
vertex_format_add_custom( vertex_type_float3, vertex_usage_tangent );
global.model_format_ktm = vertex_format_end();
Code:
vertex_begin( main_model, global.model_format_ktm );
for ( xx = 0; xx < ds_grid_width( grid_vertex ); xx++; )
{
vertex_position_3d( main_model,
ds_grid_get( grid_vertex, xx, 0 ),
ds_grid_get( grid_vertex, xx, 1 ),
ds_grid_get( grid_vertex, xx, 2 ) );
vertex_normal( main_model,
ds_grid_get( grid_normal, xx, 0 ),
ds_grid_get( grid_normal, xx, 1 ),
ds_grid_get( grid_normal, xx, 2 ) );
vertex_colour( main_model,
c_white, 1 );
vertex_texcoord( main_model,
ds_grid_get( grid_texCoord, xx, 0 ),
ds_grid_get( grid_texCoord, xx, 1 ) );
vertex_float3( main_model,
ds_grid_get( grid_tangent, xx, 0 ),
ds_grid_get( grid_tangent, xx, 1 ),
ds_grid_get( grid_tangent, xx, 2 ) );
}
vertex_end( main_model );
vertex_freeze( main_model );
That's not the problem though. The model builds and renders the way it should... with the exception of the texture. For some reason my model turns out a mint green kind of colour. This makes no sense to me :S
When I use a more standard format like this:
Code:
vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_normal();
vertex_format_add_colour();
vertex_format_add_textcoord();
global.model_format_default = vertex_format_end();
I tried changing "vertex_format_add_custom( vertex_type_float3, vertex_usage_tangent );"
to "vertex_format_add_custom( vertex_type_float3, vertex_usage_textcoord );" and a few others but only the one I mentioned now let my texture draw again. However the texture is kind of double at this point, with a second, slightly faded, texture that is offset a bit drawing as well.
Can anyone here make sense of this?
Am I adding custom values to my format wrong?
I use GMS 1.4.9999.