Exemplo n.º 1
0
void glut_overlay_display_func(void)
{
	struct glut_event_t *event;

	event = glut_event_create(glut_event_overlay_display);
	event->u.keyboard.win = glutGetWindow();

	glut_event_enqueue(event);
}
Exemplo n.º 2
0
void myGlutIdle(void)
{
	// make sure the main window is active
	if (glutGetWindow() != main_window)
		glutSetWindow(main_window);

	// just keep redrawing the scene over and over
	glutPostRedisplay();
}
Exemplo n.º 3
0
void ae_really_reshape(int w, int h) {
  assert(glutGetWindow() == ae_win);
  ae_width = w;
  ae_height = h;
  glMatrixMode(GL_PROJECTION);
  glViewport(0, 0, w, h);
  glutPostRedisplay();
  glutSetWindow(disp_win);
}
Exemplo n.º 4
0
Arquivo: window.c Projeto: vrld/G4L
static void _motion(int x, int y)
{
	if (!get_callback(glutGetWindow(), "mousedrag"))
		return;
	// TODO: get mouse buttons
	lua_pushinteger(LUA, x);
	lua_pushinteger(LUA, y);
	lua_call(LUA, 2, 0);
}
Exemplo n.º 5
0
Arquivo: window.c Projeto: vrld/G4L
static void _passiveMotion(int x, int y)
{
	if (!get_callback(glutGetWindow(), "mousemove"))
		return;

	lua_pushinteger(LUA, x);
	lua_pushinteger(LUA, y);
	lua_call(LUA, 2, 0);
}
Exemplo n.º 6
0
Arquivo: window.c Projeto: vrld/G4L
static int l_window___index(lua_State* L)
{
	luaL_getmetatable(L, INTERNAL_NAME);
	lua_pushvalue(L, 2);
	lua_gettable(L, -2);
	if (!lua_isnoneornil(L, -1))
		return 1;

	if (!lua_isstring(L, 2))
		return 0;
	const char* key = lua_tostring(L, 2);

	Window* win = l_toWindow(L, 1);
	if (get_callback(win->id, key))
		return 1;

	int current = glutGetWindow();
	glutSetWindow(win->id);
	if (0 == strcmp("pos", key))
	{
		lua_createtable(L, 2, 0);
		lua_pushinteger(L, glutGet(GLUT_WINDOW_X));
		lua_setfield(L, -2, "x");
		lua_pushinteger(L, glutGet(GLUT_WINDOW_Y));
		lua_setfield(L, -2, "y");
	}
	else if (0 == strcmp("x", key))
	{
		lua_pushinteger(L, glutGet(GLUT_WINDOW_X));
	}
	else if (0 == strcmp("y", key))
	{
		lua_pushinteger(L, glutGet(GLUT_WINDOW_Y));
	}
	else if (0 == strcmp("size", key))
	{
		lua_createtable(L, 2, 0);
		lua_pushinteger(L, glutGet(GLUT_WINDOW_WIDTH));
		lua_setfield(L, -2, "width");
		lua_pushinteger(L, glutGet(GLUT_WINDOW_HEIGHT));
		lua_setfield(L, -2, "height");
	}
	else if (0 == strcmp("width", key))
	{
		lua_pushinteger(L, glutGet(GLUT_WINDOW_WIDTH));
	}
	else if (0 == strcmp("height", key))
	{
		lua_pushinteger(L, glutGet(GLUT_WINDOW_HEIGHT));
	}
	else
	{
		lua_pushnil(L);
	}
	glutSetWindow(current);
	return 1;
}
Exemplo n.º 7
0
static void *
glut_OverlayDisplayFuncCallback(void) {
	VALUE func = rb_ary_entry(OverlayDisplayFunc, glutGetWindow());

	if (!NIL_P(func))
		rb_funcall(func, call_id, 0);

  return NULL;
}
Exemplo n.º 8
0
static void _keyboard(unsigned char key, int x, int y)
{
	if (!get_callback(glutGetWindow(), "keyboard"))
		return;
	lua_pushlstring(LUA, (const char*)(&key), 1);
	lua_pushinteger(LUA, x);
	lua_pushinteger(LUA, y);
	lua_call(LUA, 3, 0);
}
Exemplo n.º 9
0
void idle()
{
	if(glutGetWindow() != mainWindow)
	{
		glutSetWindow(mainWindow);
	}
	prepareScene();
	glutPostRedisplay();
}
Exemplo n.º 10
0
void GLUTIdle(void)
{
  // Set current window
  if ( glutGetWindow() != GLUTwindow ) 
    glutSetWindow(GLUTwindow);  

  // Redraw
  glutPostRedisplay();
}
Exemplo n.º 11
0
status_t
GlutGameMode::Enter()
{
	display_mode* mode = _FindMatchingMode();
	if (!mode)
		return B_BAD_VALUE;

	BScreen screen;
	if (!fActive) {
		// First enter: remember this workspace original mode...
		fGameModeWorkspace = current_workspace();
		screen.GetMode(fGameModeWorkspace, &fOriginalMode);
	}

	// Don't make it new default mode for this workspace...
	status_t status = screen.SetMode(fGameModeWorkspace, mode, false);
	if (status != B_OK)
		return status;

	// Retrieve the new active display mode, which could be
	// a sligth different than the one we asked for...
	screen.GetMode(fGameModeWorkspace, &fCurrentMode);

	if (!fGameModeWindow) {
		// create a new window
		fPreviousWindow = glutGetWindow();
		fGameModeWindow = glutCreateWindow("glutGameMode");
		if (!fGameModeWindow)
			return Leave();
	} else
		// make sure it's the current window
		glutSetWindow(fGameModeWindow);

	BDirectWindow *directWindow
		= dynamic_cast<BDirectWindow*>(gState.currentWindow->Window());
	if (directWindow == NULL)
		// Hum?!
		return B_ERROR;

	// Give it some useless title, except for debugging (thread name).
	BString name;
	name << "Game Mode " << fCurrentMode.virtual_width
		<< "x" << fCurrentMode.virtual_height
		<< ":" << _GetModePixelDepth(&fCurrentMode)
		<< "@" << _GetModeRefreshRate(&fCurrentMode);

	// force the game mode window to fullscreen
	directWindow->Lock();
	directWindow->SetTitle(name.String());
	directWindow->SetFullScreen(true);
	directWindow->Unlock();

	fDisplayChanged = true;
	fActive = true;

	return B_OK;
}
Exemplo n.º 12
0
void gfnhDrawCompleteDataLogLTrace(void)
{		
	glColor3fv(gWindowsSettings[glutGetWindow()]->ColorScheme->Series[0]);
	
	gfduDrawSlidingTrace(gCompleteDataLogLike);
	
	gfmDrawXYAxes();

}
Exemplo n.º 13
0
// Redraw on expose events.
void
expose_cb(void)
{
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHTING);
  scenemanager[winid2idx(glutGetWindow())]->render();

  glutSwapBuffers();
}
Exemplo n.º 14
0
void mui_glutmotion(int x, int y)
{
    Window win = &winList[glutGetWindow()-1];

    muiSetActiveUIList(win->uilist);
    if (win->mbleft == 0) return;
    muiHandleEvent(MUI_DEVICE_DOWN, 0, x, win->mui_ysize-y);
    glutPostRedisplay();
}
Exemplo n.º 15
0
	Window::Ptr getCurrentWindow()
	{
		WindowsBimap::left_map::iterator found = windows.left.find(glutGetWindow());
		if (found == windows.left.end() || found->second->getState() != Window::CREATED) {
			return Window::Ptr();
		} else {
			return found->second;
		}
	}
Exemplo n.º 16
0
// Find the current WindowData
SubWindowData *GetCurrentSubWindowData()
{
    int i, currWinID;
    currWinID = glutGetWindow();
    for (i = 0; i < 2; i++)
        if (g_SubWindowData[i].WinID == currWinID)
            return &g_SubWindowData[i];
    return NULL;
}
Exemplo n.º 17
0
void oak::Window::resizeCb(int width, int height)
{
    Window* window = _windowMap[glutGetWindow()];

    glViewport(0, 0, width, height);

    window->resizeEvent(width, height);
    if (window->_resizeFunc)
        window->_resizeFunc(window, width, height);
}
Exemplo n.º 18
0
inline GlutWindow* GlutWindow::current() {
  int id = glutGetWindow();
  for (unsigned int i = 0; i < mWinIDs.size(); i++) {
    if (mWinIDs.at(i) == id) {
      return mWindows.at(i);
    }
  }
  std::cout << "An unknown error occured!" << std::endl;
  exit(0);
}
Exemplo n.º 19
0
void myGlutIdle(void)
{
	/* According to the GLUT specification, the current window is
	undefined during an idle callback.  So we need to explicitly change
	it if necessary */
	if (glutGetWindow() != main_window)
		glutSetWindow(main_window);

	glutPostRedisplay();
}
Exemplo n.º 20
0
// Reconfigure on changes to window dimensions.
void
reshape_cb(int w, int h)
{
  int idx = winid2idx(glutGetWindow());

  scenemanager[idx]->setWindowSize(SbVec2s(w, h));
  scenemanager[idx]->setSize(SbVec2s(w, h));
  scenemanager[idx]->setViewportRegion(SbViewportRegion(w, h));
  scenemanager[idx]->scheduleRedraw();
}
Exemplo n.º 21
0
void VCGLUTNativeWindow::motion(int x, int y)
{
    int id = glutGetWindow();
    VCGLUTNativeWindow *window = findWindow(id);
    if(window)
    {
        window->sendMouseWindowEvent(x, y, -1, 0);
        glutPostRedisplay();
    }
}
Exemplo n.º 22
0
inline GlutWindow *GlutWindow::getGlutWindow() {
    int gWindowID = glutGetWindow();
    if (gWindowID < MAX_GLUT_WINDOWS && gWindowID >= 0
            && glutWindows[gWindowID] != NULL) {
        return glutWindows[gWindowID];
    } else {
        std::cerr << "Invalid GLUT Window ID: " << gWindowID << std::endl;
        return NULL;
    }
}
Exemplo n.º 23
0
void glWindow::queryFrame()
{
	if ( !ipc.isNewFrameAvailable() )
		return;
	/* We have a new frame. Let glut now that this window needs repainting.
		*/
	if ( win_id != glutGetWindow() )
		glutSetWindow( win_id );
	glutPostRedisplay();
}
Exemplo n.º 24
0
void displayGLUT()
{
	if (glutGetWindow() != g_window_handle){ return; }
	glClearColor(0.f, 0.5f, 0.5f, 1.f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	drawGLUT();
	glutSwapBuffers();
}
Exemplo n.º 25
0
	/*
	Calculates the time taken to render the previous frame and uses the calculation
	to calculate the fps. Afterward it puts it in the titlestring and gives it to GLUT
	for the window.
	*/
	void updateFPS(void)
	{
		if(!c->fullscr && glutGetWindow() != 0)
		{
			currentTime = glutGet(GLUT_ELAPSED_TIME);
			sprintf(titleString, "FPS: %2.2f", (1000/float(currentTime-previousTime)));
			glutSetWindowTitle(titleString);
			previousTime = currentTime;
		}
	}
Exemplo n.º 26
0
void
keypress(unsigned char key, int x, int y)
{
  switch (key) {
  case 27: /*ESC*/
    glutDestroyWindow(glutGetWindow());
    exit(0);
    break;
  }
}
Exemplo n.º 27
0
void GLUTWindow::activate(void)
{
    if((_sfDrawMode.getValue() & PartitionDrawMask) == SequentialPartitionDraw)
    {
        if(glutGetWindow() != getGlutId())
            glutSetWindow(getGlutId());

        Inherited::doActivate();
    }
}
Exemplo n.º 28
0
static void mui_Reshape(int width, int height)
{
    Window win = &winList[glutGetWindow()-1];

    win->mui_xorg = glutGet(GLUT_WINDOW_X);
    win->mui_yorg = glutGet(GLUT_WINDOW_Y);
    win->mui_xsize = width;
    win->mui_ysize = height;
    glViewport(0, 0, win->mui_xsize, win->mui_ysize);
}
Exemplo n.º 29
0
GLView* GLView::GetActiveGLView() {
  const int handle = glutGetWindow();
  const unsigned size = inherited_views_.size();
  for (unsigned i = 0; i < size; ++i) {
    if (inherited_views_[i]->window_handle_ == handle) {
      return inherited_views_[i];
    }
  }
  return 0;
}
Exemplo n.º 30
0
void MeshGui::idle( void )
{
	// According to the GLUT specification, the current window is undefined during an idle callback.  So we need to explicitly change it if necessary
	if ( glutGetWindow() != main_window )
	{
		glutSetWindow(main_window);
	}
	// GLUI_Master.sync_live_all();  -- not needed - nothing to sync in this application
	glutPostRedisplay();
}