raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
22.65k stars 2.27k forks source link

[models] all examples atempting to texture and obj segfault #1378

Closed chriscamacho closed 4 years ago

chriscamacho commented 4 years ago

see the examples, for example shader_basic_lighting

raysan5 commented 4 years ago

@chriscamacho It works perfectly on my side... Please, could you provide more details?

chriscamacho commented 4 years ago
Thread 1 "shaders_basic_l" received signal SIGSEGV, Segmentation fault.
main () at shaders_basic_lighting.c:68
68      modelA.materials[0].maps[MAP_DIFFUSE].texture = texture;
(gdb) bt
#0  main () at shaders_basic_lighting.c:68
    // Assign texture to default model material
    modelA.materials[0].maps[MAP_DIFFUSE].texture = texture;

It would be nice to have a robust RetextureModel(MeshId, TextureId)

which would allocate a material if needed...

modelA.materials[0].maps[MAP_DIFFUSE].texture = texture;

was a quick hack the first time I did it meaning to find the "proper" api way to do it later....

raysan5 commented 4 years ago

@chriscamacho sorry, I can't reproduce the issue. Are you using latest raylib from github master branch? Platform? GPU? Compiler? Versions? Could you list the examples that fail for you? Thanks.

chriscamacho commented 4 years ago

current pull from github Linux 64-bit PLATFORM_DESKTOP

./shaders_basic_lighting ./shaders_custom_uniform ./shaders_fog ./shaders_model_shader ./shaders_postprocessing ./shaders_simple_mask ./models_yaw_pitch_roll

right thats enough !

grep -n "MAP_DIFFUSE].texture" * -Ri models/models_mesh_picking.c:40: tower.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture models/models_mesh_generation.c:42: for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MAP_DIFFUSE].texture = texture; models/models_loading.c:42: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture models/models_loading.c:79: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set current map diffuse texture models/models_loading.c:90: model.materials[0].maps[MAP_DIFFUSE].texture = texture; models/models_yaw_pitch_roll.c:38: model.materials[0].maps[MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture models/models_yaw_pitch_roll.c:40: GenTextureMipmaps(&model.materials[0].maps[MAP_DIFFUSE].texture); models/models_yaw_pitch_roll.c:172: UnloadTexture(model.materials[0].maps[MAP_DIFFUSE].texture); models/models_heightmap.c:32: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture models/models_cubicmap.c:34: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture models/models_first_person_maze.c:35: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture shaders/shaders_postprocessing.c:77: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture shaders/shaders_model_shader.c:54: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Bind texture to model shaders/shaders_fog.c:65: modelA.materials[0].maps[MAP_DIFFUSE].texture = texture; shaders/shaders_fog.c:66: modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; shaders/shaders_fog.c:67: modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; shaders/shaders_basic_lighting.c:68: modelA.materials[0].maps[MAP_DIFFUSE].texture = texture; shaders/shaders_basic_lighting.c:69: modelB.materials[0].maps[MAP_DIFFUSE].texture = texture; shaders/shaders_basic_lighting.c:70: modelC.materials[0].maps[MAP_DIFFUSE].texture = texture; shaders/shaders_simple_mask.c:63: model1.materials[0].maps[MAP_DIFFUSE].texture = texDiffuse; shaders/shaders_simple_mask.c:64: model2.materials[0].maps[MAP_DIFFUSE].texture = texDiffuse; shaders/shaders_custom_uniform.c:50: model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture

On Wed, 16 Sep 2020 at 15:08, Ray notifications@github.com wrote:

@chriscamacho https://github.com/chriscamacho sorry, I can't reproduce the issue. Are you using latest raylib from github master branch? Platform? GPU? Could you list the examples that fail for you? Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raysan5/raylib/issues/1378#issuecomment-693430759, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFO4SM5M7GUUIE7FX3CYS3SGDBHLANCNFSM4ROOFRLA .

--

blog bedroomcoders.co.uk http://bedroomcoders.co.uk

Disclaimer: By sending an email to ANY of my addresses you are agreeing that:

  1. I am by definition, "the intended recipient"

  2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it where I please.

  3. I may take the contents as representing the views of your company.

  4. This overrides any disclaimer or statement of confidentiality that may be included on your message.

chriscamacho commented 4 years ago

INFO: GLAD: OpenGL extensions loaded successfully INFO: GL: OpenGL 3.3 Core profile supported INFO: GL: OpenGL device information: INFO: > Vendor: Intel INFO: > Renderer: Mesa Intel(R) UHD Graphics (CML GT2) INFO: > Version: 4.6 (Core Profile) Mesa 20.1.7 INFO: > GLSL: 4.60 INFO: GL: Supported extensions count: 220 INFO: GL: DXT compressed textures supported INFO: GL: ETC2/EAC compressed textures supported INFO: GL: Anisotropic textures filtering supported (max: 16X)

raysan5 commented 4 years ago

Could you try reproducing on a 32bit platform? Did you notice this issue from a certain commit?

I have no idea why this could be failing...

chriscamacho commented 4 years ago

noticed it yesterday I think...

I don't own any 32-bit hardware! well maybe PI somewhere but that would need setting up...

On Wed, 16 Sep 2020 at 16:06, Ray notifications@github.com wrote:

Could you try reproducing on a 32bit platform? Did you notice this issue from a certain commit?

I have no idea why this could be failing...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raysan5/raylib/issues/1378#issuecomment-693468636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFO4SLUIHBFNH2DOJKTL4LSGDIAZANCNFSM4ROOFRLA .

--

blog bedroomcoders.co.uk http://bedroomcoders.co.uk

Disclaimer: By sending an email to ANY of my addresses you are agreeing that:

  1. I am by definition, "the intended recipient"

  2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it where I please.

  3. I may take the contents as representing the views of your company.

  4. This overrides any disclaimer or statement of confidentiality that may be included on your message.

chriscamacho commented 4 years ago

I'll see about rolling back till it stops and let you know the commit....

chriscamacho commented 4 years ago

b870b9f is bad any idea how i get a list of recent commit hashes ?

chriscamacho commented 4 years ago

90befff4b8ee15d52d8497957af4acff76fd5410 segs 43b9113c0c776d7b1b7f6205dbf9816ca237e808 segs dace2172d194c057359ccc101278d38cf2f75649 segs

grabbing a fresh clone and taking that back in case its something silly...

chriscamacho commented 4 years ago

sorry wasn't wasn't using your fork - sorry for the noise ! (:embarased:)

While were on though this is a little hacky

modelA.materials[0].maps[MAP_DIFFUSE].texture = texture;

A function to apply a texture to a model that will cope with even models without previously assigned materials, would be nice!

raysan5 commented 4 years ago

@chriscamacho ok, thanks for letting me know! I was worrying about it! :D

chriscamacho commented 4 years ago

me too!

Whats your thoughts on a re-texture model function

On Wed, 16 Sep 2020 at 17:59, Ray notifications@github.com wrote:

@chriscamacho https://github.com/chriscamacho ok, thanks for letting me know! I was worrying about it! :D

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raysan5/raylib/issues/1378#issuecomment-693535486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFO4SP7OQC5PDBD6P2JCW3SGDVFHANCNFSM4ROOFRLA .

--

blog bedroomcoders.co.uk http://bedroomcoders.co.uk

Disclaimer: By sending an email to ANY of my addresses you are agreeing that:

  1. I am by definition, "the intended recipient"

  2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it where I please.

  3. I may take the contents as representing the views of your company.

  4. This overrides any disclaimer or statement of confidentiality that may be included on your message.

raysan5 commented 4 years ago

@chriscamacho I thought about it... here there are a couple of options:

SetModelTexture(Model *model, int materialId, int mapType, Texture2D texture);
SetMaterialTexture(Material *mat, int mapType, Texture2D texture);

Personally I find more simple just accessing the model members directly, that's one of the advantages of raylib...

chriscamacho commented 4 years ago

is

SetModelTexture

fairly new?

On Fri, 18 Sep 2020 at 01:19, Ray notifications@github.com wrote:

@chriscamacho https://github.com/chriscamacho I thought about it... here there are a couple of options:

SetModelTexture(Model model, int materialId, int mapType, Texture2D texture);SetMaterialTexture(Material mat, int mapType, Texture2D texture);

Personally I find more simple just accessing the model members directly, that's one of the advantages of raylib...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raysan5/raylib/issues/1378#issuecomment-694570505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFO4SJF3SW74IV5RGRROGDSGKRQRANCNFSM4ROOFRLA .

--

blog bedroomcoders.co.uk http://bedroomcoders.co.uk

Disclaimer: By sending an email to ANY of my addresses you are agreeing that:

  1. I am by definition, "the intended recipient"

  2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it where I please.

  3. I may take the contents as representing the views of your company.

  4. This overrides any disclaimer or statement of confidentiality that may be included on your message.

raysan5 commented 4 years ago

Actually those functions do not exist, they are just an idea. Similar functions existed in the past but were removed.

chriscamacho commented 4 years ago

personally i think they are less dawnting for the newer coderer, people can be intimidated by "hacking" away at internal structures...

yes that's okay if you (think!) you know what you are doing... but fancy explaining it to a 10 year old you're teaching python too? (any why shouldn't said 10 year old have access to raylib straight away - i'd have loved something like this 40+ years ago!)

On Fri, 18 Sep 2020 at 07:55, Ray notifications@github.com wrote:

Actually those functions do not exist, they are just an idea. Similar functions existed in the past but were removed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/raysan5/raylib/issues/1378#issuecomment-694692340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFO4SK6K5IHG7X5Q2NCR3LSGL745ANCNFSM4ROOFRLA .

--

blog bedroomcoders.co.uk http://bedroomcoders.co.uk

Disclaimer: By sending an email to ANY of my addresses you are agreeing that:

  1. I am by definition, "the intended recipient"

  2. All information in the email is mine to do with as I see fit and make such financial profit, political mileage, or good joke as it lends itself to. In particular, I may quote it where I please.

  3. I may take the contents as representing the views of your company.

  4. This overrides any disclaimer or statement of confidentiality that may be included on your message.