• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] d3d_model_vertex_colour is always grey

Hey okay i'm trying to use a surface buffer to get the colours of pixels but when i do and create a 3d model using d3d_model_vertex_colour() it's all greyed out. I'm not sure why it keeps doing it. Here is the code i'm using:
Code:
///sprite_make_model(index)

var sprite = argument[0];
var w = sprite_get_width(sprite);
var h = sprite_get_height(sprite);

var surf = surface_create(w,h);
surface_set_target(surf);
draw_clear_alpha(c_black,0);
draw_sprite(sprite,0,0,0);

var _buff = buffer_create(w*h*5, buffer_fixed, 4);
buffer_get_surface(_buff, surf, 0, 0, 0);

var model = d3d_model_create();
d3d_model_primitive_begin(model,pr_trianglelist);

for(i=0;i<w;i+=1)
{
    for(j=0;j<h;j+=1)
    {
        var _col = buffer_read(_buff, buffer_u32);
        var _a = (_col >> 24) & 255;
        var _b = (_col >> 16) & 255; //r
        var _g = (_col >> 8) & 255; //g
        var _r = _col & 255; //b
        var color = make_colour_rgb(_r, _g, _b);
   
        if _a > 0
        {

        d3d_model_vertex_colour(model,i,j,0.5,color,1);
        d3d_model_vertex_colour(model,i+1,j,0.5,color,1);
        d3d_model_vertex_colour(model,i,j,0,color,1);
   
        d3d_model_vertex_colour(model,i+1,j,0.5,color,1);
        d3d_model_vertex_colour(model,i+1,j,0,color,1);
        d3d_model_vertex_colour(model,i,j,0,color,1);
   
        d3d_model_vertex_colour(model,i,j,0.5,color,1);
        d3d_model_vertex_colour(model,i+1,j,0.5,color,1);
        d3d_model_vertex_colour(model,i,j+1,0.5,color,1);
   
        d3d_model_vertex_colour(model,i+1,j,0.5,color,1);
        d3d_model_vertex_colour(model,i+1,j+1,0.5,color,1);
        d3d_model_vertex_colour(model,i,j+1,0.5,color,1);
        }
    }

}
buffer_delete(_buff);
d3d_model_primitive_end(model);

surface_reset_target();
surface_free(surf);

return model;
Please can someone help. The model i get is greyed out.

EDIT: I have debugged it abit and it seems like it wont draw any colour i set with d3d_model_vertex_colour

EDIT: SOLVED. I was using lighting which because i had no normals it messed up.
 
Last edited:
Top