opengl - Unable to call multiple display list glCallList() -


when create display list :

gluint tampilkan() {     gluint id = 0;  id = glgenlists(1);  glnewlist(id, gl_compile);  //bench glpushmatrix(); glscalef(1.5,0.2,1.5); gambarku(); drawbox(); glpopmatrix();   //backbench glpushmatrix(); gltranslatef(0.0f,2.5f,-1.3f); glscalef(1.5,1.5,0.2); gambarku2(); drawbox(); glpopmatrix();  .... foot using same pattern push-pop matrix   glendlist();    //========================================================= return id;  }` 

then call display list in "display" function :

    glclear(gl_color_buffer_bit | gl_depth_buffer_bit);  glpushmatrix(); glloadidentity(); gltranslatef(0.0f, 0.0f, -7.0f); glrotatef(yrot, 0.0f, 1.0f, 0.0f); glcalllist(tampilkan()); glpopmatrix();  glpushmatrix(); glloadidentity(); gltranslatef(0.0f, 0.0f, -5.0f); glrotatef(yrot, 0.0f, 1.0f, 0.0f); glcalllist(tampilkan()); glpopmatrix();   glutswapbuffers();  glflush(); 

why showing 1 bench? (in other words showing 1 of display list)

it should 2 bench translation z point @ -5.0f , -7.0f

and when change first calllist gltranslatef(0.0f,0.0f,-8.0f) doesn't change in output. but, when change second calllist gltranslatef(0.0f,0.0f,-8.0f) bench, output bench did translated position -8.0f (further before -5.0f)

all is, code shows second display list (with z point @ -5.0f) , ignoring first display list.

anyone me this? did wrong?

i don't know if going solve problem, you're not supposed create new display list every time draw it. not twice same.

when initializing program, create display list once, , store name (id). when rendering, call glcalllist(id), twice in case.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -