Homebrew [Release] {beta} sf2dlib - Simple and Fast 2D library (using the GPU)

  • Thread starter Thread starter xerpi
  • Start date Start date
  • Views Views 97,245
  • Replies Replies 501
  • Likes Likes 32
Hi, I want to render a texture that is manipulated by another class ("object"). For this is the main rendering code this is done for the specific thing that causes the program to crash (when I used a local texture it worked fine):
Code:
sf2d_draw_texture_scale(gol.getMapTexture(), -mapX, -mapY, scale, scale);
In GoL.h this is how the texture is initialised (as a local variable/pointer):
Code:
sf2d_texture *tex_map = sfil_load_PNG_file("romfs:/template.png", SF2D_PLACE_RAM);
And last but not least here is the function getMapTexture():
Code:
sf2d_texture *GoL::getMapTexture(){
    return tex_map;
}
It also crashes when I do the sf2d_set_pixel operation from the object itself. Also trying to render it from the object itself also crashes, essentially doing anything with it seems to crash the program for some reason.

Anyone know what is causing this, and if I can fix this and if yes, how?
 
Hi, I want to render a texture that is manipulated by another class ("object"). For this is the main rendering code this is done for the specific thing that causes the program to crash (when I used a local texture it worked fine):
Code:
sf2d_draw_texture_scale(gol.getMapTexture(), -mapX, -mapY, scale, scale);
In GoL.h this is how the texture is initialised (as a local variable/pointer):
Code:
sf2d_texture *tex_map = sfil_load_PNG_file("romfs:/template.png", SF2D_PLACE_RAM);
And last but not least here is the function getMapTexture():
Code:
sf2d_texture *GoL::getMapTexture(){
    return tex_map;
}
It also crashes when I do the sf2d_set_pixel operation from the object itself. Also trying to render it from the object itself also crashes, essentially doing anything with it seems to crash the program for some reason.

Anyone know what is causing this, and if I can fix this and if yes, how?

Tex_map pointer is not saved in gol object. U should have a variable where u save the pointer u r trying to access on getmaptexture
 

Site & Scene News

Popular threads in this forum