In article <[EMAIL PROTECTED]>,
Kezhong Zhou <[EMAIL PROTECTED]>
wrote:
Pointing out some remarks in the code:
> class GlWindow : public Fl_Gl_Window {
> public:
> GlWindow(int X, int Y, int W, int H, const char *L = NULL)
> : Fl_Gl_Window(X, Y, W, H, L) {
> valid = false;
You don't need to handle "valid". This should be handled by fltk, not
you. The documentation for Fl_Gl_Window has many of these issues
mentioned.
Also, use
mode(FL_DOUBLE|FL_RGB);
directly in the constructor to initialize the display mode for the GL
window.
> int handle(int i)
> {
> if(i == FL_PUSH && Fl::event_button () == 1)
> {
> if(persent > 0.99999f)
> persent = 0;
> else
> persent += 0.05f;
> draw();
Call redraw() here, don't call draw() directly.
> void draw()
> {
> if(!valid)
Use if(!valid()) here.
> swap_buffers();
swap_buffers() is not needed. It's done by FLTK already.
> void draw()
> {
> glWindow->redraw();
> Fl_Menu_Window::draw();
> }
Why are you doing this? Child elements are redrawn automatically.
> int main()
> {
> ContainerWindow mainWindow(0, 0, 700, 700, "Ray Casting");
> Fl::visual(FL_DOUBLE|FL_RGB);
My bad here, Fl::visual selects the visual mode for the application, not
for GL. The default mode for Fl_Gl_Window is FL_DOUBLE|FL_RGB|FL_DEPTH.
Maybe the depth buffer is causing some problems.
Try again by fixing the source as I mentioned.
I won't by able to try your code until several hours.
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs