view Renderer/Engine/viewerGL.h @ 922:655e11f6e437

moving OpenGL mode now!
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Thu, 29 Jul 2010 22:56:58 +0900
parents
children 651251d56f36
line wrap: on
line source

/**
 * OpenGLを用いてレンダリングを行うクラスです。
 * MacOSX上での高速な動作を目的としたViewerです。
 * ViewerとViewerDevice 一体型です。
 * 通常の計算(Move, Collision)はそのままです。
 * 描画の部分はTaskを使わず、OpenGLで直に記述する予定です。
 **/

#ifndef INCLUDED_VIEWER_GL
#define INCLUDED_VIEWER_GL

#include <SDL.h>
#include <SDL_opengl.h>
#include "viewer_types.h"
#include "TaskManager.h"
#include "KeyStat.h"
#include "MainLoop.h"
#include "Application.h"
#include "SceneGraphRoot.h"


class cViewerGL : public Viewer {
 public:
  cViewerGL(TaskManager *m, int b, int w, int h, int _num);
  ~cViewerGL(){};
  
  SDL_Surface *screen;
  //  SDL_Surface *bitmap;
  
  /* override function */
  void video_init(int bpp, int width, int height);
  void clean_pixels();
  void clear_screen();
  //  void free_device();
  
  void run_init(TaskManager *manager, Application *app);
  void run_loop();
  void run_finish();

  void mainLoop();
  void pickup_vertex();
  void obj_draw(float *xyz, float *tex_xyz, float *normal_xyz);
  GLuint SDL_GL_LoadTexture(SDL_Surface *surface);

 private:
    /* measure for FPS (Frame Per Second) */
    int start_time;
    int this_time;
    int frames;    
};

#endif