|
|
Hi,
Here comes the whole cube_box::draw( routine from test/cube.cxx
void cube_box::draw() { lasttime = lasttime+speed; if (!valid()) { glLoadIdentity(); glViewport(0,0,pixel_w(),pixel_h()); glEnable(GL_DEPTH_TEST); glFrustum(-1,1,-1,1,2,10000); glTranslatef(0,0,-10); glClearColor(0.4, 0.4, 0.4, 0); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(float(lasttime*1.6),0,0,1); glRotatef(float(lasttime*4.2),1,0,0); glRotatef(float(lasttime*2.3),0,1,0); glTranslatef(-1.0, 1.2f, -1.5); glScalef(float(size),float(size),float(size)); drawcube(wire); glPopMatrix(); gl_color(FL_GRAY); glDisable(GL_DEPTH_TEST); gl_font(FL_HELVETICA_BOLD, 16 ); static GLuint DisplayList=-1; if (DisplayList<0){ glDeleteLists(DisplayList, 1); DisplayList = glGenLists (1); glNewList(DisplayList, GL_COMPILE); gl_draw(wire ? "Cube: wire" : "Cube: flat", -4.5f, -4.5f ); glEndList(); } glCallList(DisplayList); glEnable(GL_DEPTH_TEST);
// if an OpenGL graphics driver is installed, give it a chance // to draw additional graphics if (Fl::cfg_gfx_opengl) Fl_Gl_Window::draw(); }
fredag 25. september 2020 kl. 18:32:51 UTC+2 skrev Greg Ercolano:
On 2020-09-25 09:13, holm.h...@gmail.com wrote:
>
> Hello,
>
> I tried to call gl_draw into a displaylist. That was not a sucsess.Can be examplified by the cube.cxx test-code. I but the gl_draw in a displaylist (code below), but then nothing show in the screen.
>
> Suprise to me. Should that be expected, or is this a bug? Btw. to me it seems like gl_draw is pretty he heavy function/draw a lot of cpu.
>
> static GLuint DisplayList=-1;
> if (DisplayList<0){ glDeleteLists(DisplayList, 1);
> DisplayList = glGenLists (1);
> glNewList(DisplayList, GL_COMPILE);
> gl_draw(wire ? "Cube: wire" : "Cube: flat", -4.5f, -4.5f );
> glEndList();
> }
> glCallList(DisplayList);
Would need to see more code to weigh in.. can you supply a minimal
complete, compilable program so we can build and replicate?
Sometimes the problem is elsewhere, e.g. during setup.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/6027ef6d-74d7-42a3-9e8a-63d5f722360cn%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |