Gl Graph

Gl Graph Source of glwindow.h


#ifndef GL_WINDOW_H
#define GL_WINDOW_H
 
 
#define GLX_GLXEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
#include <GL/glxext.h>
#include <GL/glut.h>
 
 
#include <drawableset.h>
#include <glscene.h>
#include "glrenderer.h"
#include "mousekeyboardstate.h"
 
enum MouseButton
{
    MOUSE_NO_BUTTON,
    MOUSE_BUTTON_LEFT,
    MOUSE_BUTTON_RIGHT,
    MOUSE_BUTTON_MIDDLE,
    MOUSE_BUTTON_MIDDLE_UP,
    MOUSE_BUTTON_MIDDLE_DOWN,
};
enum ModifierButton
{
    NO_MODIFIER,
    SHIFT_MODIFIER,
    LOCK_MODIFIER,
    CTRL_MODIFIER,
    ALT_MODIFIER,
};
 
 
 
class GlWindow : public GlRenderer  {
protected:
 
    GlScene * scene;
    int swapFlag;
    int swaMask;
    bool stopped;
 
    bool helpTextMode;
    bool helpTextModeFirstRun;
 
private:
    // set of variable in order to manage mouse and keyboard event
    MouseKeybordState mkState;
public:
    GlWindow(unsigned int width, unsigned int height);
    GlWindow(unsigned int width, unsigned int height, bool debug);
    ~GlWindow();
    void init();
    void init(DrawableSet * set);
    void initBeforeGl();
    void initAfterGl(DrawableSet * set);
 
    virtual void initGl()=0;
    virtual void setTitle(const char* title)=0;
    virtual void run()=0;
 
    std::string getPngFileName();
    void setDebug(bool debug);
    bool isDebug();
    void swapHelpTextMode();
    void swapDepthBufferEnnable();
 
    void drawScene();
    void drawAll();
    void drawHelpText();
 
    void setTextInfo(const bool textInfo);
    void drawText();
    void drawSelectionSquare();
 
 
 
 
    void processCloseEvent();
    void processTranslation(int x, int y);
    void processRotation(int x, int y);
    void processOnclick(int x, int y,int halfsizex,int halfsizey);
    void processResizeEvent(unsigned int width, unsigned int height);
 
 
 
    void onMouseMotion(int x, int y, MouseButton button,ModifierButton mod);
    void onMouseButtonPress(int x, int y, MouseButton button,ModifierButton mod);
    void onMouseButtonRelease(int x, int y, MouseButton button,ModifierButton mod);
 
 
    void processButtonPressEscape();
 
    void processButtonPressF1();
    void processButtonPressF2();
    void processButtonPressF3();
    void processButtonPressF4();
    void processButtonPressF5();
    void processButtonPressF6();
    void processButtonPressF7();
    void processButtonPressF8();
    void processButtonPressF9();
    void processButtonPressF10();
    void processButtonPressF11();
    void processButtonPressF12();
 
 
    void processButtonPressChar(char c);
 
 
    void processButtonUp();
    void processButtonDown();
    void processButtonRight();
    void processButtonLeft();
 
};
 
#endif