hi,
im wondering why this code crashs at setting a texturestage in set_texture?
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "texturePool.h"
#include "cardMaker.h"
#include "textureStage.h"
PandaFramework framework;
WindowFramework *window;
GraphicsEngine *engine;
PT(ClockObject) globalClock = ClockObject::get_global_clock();
PT(AsyncTaskManager) taskMgr = AsyncTaskManager::get_global_ptr();
CardMaker cmTEST("test");
PT(TextureStage) stage1;
NodePath camera,testPLANE(cmTEST.generate());
PT(Texture) textureTEST;
float offsetV;
void windowOPEN() {
WindowProperties *props = new WindowProperties();
props->set_size(640,480);
props->set_undecorated(false);
window = framework.open_window(*props,0);
window->get_graphics_window()->get_active_display_region(0)->set_clear_color(Colorf(0,0,0,1));
}
void getCAMERA() {
camera = window->get_camera_group();
}
void billboards() {
textureTEST=TexturePool::load_texture("test.tif");
testPLANE.reparent_to(window->get_render_2d());
testPLANE.set_transparency(TransparencyAttrib::Mode alpha,1);
testPLANE.set_scale(.1,0,.8);
testPLANE.set_texture(stage1,textureTEST,1);
}
void animate() {
offsetV -= .1;
testPLANE.set_tex_pos(stage1,0,offsetV,0); // EDIT: i had here a wrong piece of code in, i changed the names of my vars for this online doc. before i used instead of offsetV the var timer. but thats not the problem
}
AsyncTask::DoneStatus mainTASK(GenericAsyncTask* task, void* data) {
animate();
return AsyncTask::DS_cont;
}
int main(int argc, char *argv[]) {
framework.open_framework(argc, argv);
windowOPEN();
getCAMERA();
billboards();
taskMgr->add(new GenericAsyncTask("main task", &mainTASK, (void*) NULL));
framework.main_loop();
framework.close_framework();
return (0);
}