Tao OpenGL C# Tab Not Rotate -


why opengl not rotating when placed @ tab bar?

    private void simpleopenglcontrol1_paint_1(object sender, painteventargs e)     {         gl.glclear(gl.gl_color_buffer_bit | gl.gl_depth_buffer_bit);          gl.glmatrixmode(gl.gl_modelview);         gl.glloadidentity();          gl.gltranslated(0, 0, -5);          gl.glrotated(yrot += 1, 1, 1, 0);           gl.glpointsize(3);         gl.glpolygonmode(gl.gl_front, gl.gl_lines);         gl.glpolygonmode(gl.gl_back, gl.gl_lines);         gl.glbegin(gl.gl_quads);         {             ////vista posterior             gl.glcolor3ub(255, 0, 255);             gl.glvertex3d(0, 1, -1);             gl.glvertex3d(1, -1, -1);             gl.glvertex3d(-1, -1, -1);             gl.glvertex3d(0, 1, -1);              ////debajo             gl.glcolor3ub(0, 255, 255);             gl.glvertex3d(-1, -1, -1);             gl.glvertex3d(1, -1, -1);             gl.glvertex3d(1, -1, 1);             gl.glvertex3d(-1, -1, 1);              ////por la izquierda             gl.glcolor3ub(255, 255, 0);             gl.glvertex3d(0, 1, -1);             gl.glvertex3d(-1, -1, -1);             gl.glvertex3d(-1, -1, 1);             gl.glvertex3d(0, 1, 1);              ////por la derecha             gl.glcolor3ub(0, 0, 255);             gl.glvertex3d(0, 1, 1);             gl.glvertex3d(1, -1, 1);             gl.glvertex3d(1, -1, -1);             gl.glvertex3d(0, 1, -1);                gl.glcolor3ub(255, 0, 0);             gl.glvertex3d(0, 1, 1);             gl.glvertex3d(-1, -1, 1);             gl.glvertex3d(1, -1, 1);             gl.glvertex3d(0, 1, 1);              gl.glend();         } 

i put on tab, when click tab , opengl tab 3d object changes not rotate.

unless use timer force repaint n times per second, paint event occurs when needed.

when switch between tabs, redraw needed , paint event occurs. why see little change @ time.

you possibly see same thing reducing/maximizing window, etc...

you should:

  • use timer periodically call invalidate or equivalent function.
  • don't update yrot on paint event. because didn't know when it's called have no control on rotation speed. use timer, or time-based interpolation of value.

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -