コード例 #1
0
ファイル: glut.c プロジェクト: 3upperm2n/gpuSimulators
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);
}
コード例 #2
0
ファイル: main.cpp プロジェクト: jobottleson/bodyIK
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();
}
コード例 #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);
}
コード例 #4
0
ファイル: window.c プロジェクト: 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);
}
コード例 #5
0
ファイル: window.c プロジェクト: 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);
}
コード例 #6
0
ファイル: window.c プロジェクト: 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;
}
コード例 #7
0
ファイル: glut_callbacks.c プロジェクト: LeoGigliotti/opengl
static void *
glut_OverlayDisplayFuncCallback(void) {
	VALUE func = rb_ary_entry(OverlayDisplayFunc, glutGetWindow());

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

  return NULL;
}
コード例 #8
0
ファイル: window.c プロジェクト: trevorfancher/G4L
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);
}
コード例 #9
0
ファイル: qix.cpp プロジェクト: Bananattack/uoguelph
void idle()
{
	if(glutGetWindow() != mainWindow)
	{
		glutSetWindow(mainWindow);
	}
	prepareScene();
	glutPostRedisplay();
}
コード例 #10
0
void GLUTIdle(void)
{
  // Set current window
  if ( glutGetWindow() != GLUTwindow ) 
    glutSetWindow(GLUTwindow);  

  // Redraw
  glutPostRedisplay();
}
コード例 #11
0
ファイル: glutGameMode.cpp プロジェクト: looncraz/haiku
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;
}
コード例 #12
0
void gfnhDrawCompleteDataLogLTrace(void)
{		
	glColor3fv(gWindowsSettings[glutGetWindow()]->ColorScheme->Series[0]);
	
	gfduDrawSlidingTrace(gCompleteDataLogLike);
	
	gfmDrawXYAxes();

}
コード例 #13
0
ファイル: glutiv.cpp プロジェクト: Alexpux/Coin3D
// Redraw on expose events.
void
expose_cb(void)
{
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHTING);
  scenemanager[winid2idx(glutGetWindow())]->render();

  glutSwapBuffers();
}
コード例 #14
0
ファイル: glutmui.c プロジェクト: AlexGreulich/HRTFVR
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();
}
コード例 #15
0
ファイル: Toolkit.cpp プロジェクト: simonlmn/actracktive
	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;
		}
	}
コード例 #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;
}
コード例 #17
0
ファイル: window.cpp プロジェクト: CodeDJ/bsplines
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);
}
コード例 #18
0
ファイル: GlutWindow.cpp プロジェクト: VincentYu68/dart
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);
}
コード例 #19
0
ファイル: main.cpp プロジェクト: pauljnixon/Graphics
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();
}
コード例 #20
0
ファイル: glutiv.cpp プロジェクト: Alexpux/Coin3D
// 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();
}
コード例 #21
0
ファイル: OSGVCGLUTNativeWindow.cpp プロジェクト: vossg/VCoRE
void VCGLUTNativeWindow::motion(int x, int y)
{
    int id = glutGetWindow();
    VCGLUTNativeWindow *window = findWindow(id);
    if(window)
    {
        window->sendMouseWindowEvent(x, y, -1, 0);
        glutPostRedisplay();
    }
}
コード例 #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;
    }
}
コード例 #23
0
ファイル: glwindow.cpp プロジェクト: nosilence/jira-skype-app
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();
}
コード例 #24
0
ファイル: main.cpp プロジェクト: gakimaru2/public
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();
}
コード例 #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;
		}
	}
コード例 #26
0
ファイル: 00-simplest.cpp プロジェクト: CaptEmulation/svgl
void
keypress(unsigned char key, int x, int y)
{
  switch (key) {
  case 27: /*ESC*/
    glutDestroyWindow(glutGetWindow());
    exit(0);
    break;
  }
}
コード例 #27
0
void GLUTWindow::activate(void)
{
    if((_sfDrawMode.getValue() & PartitionDrawMask) == SequentialPartitionDraw)
    {
        if(glutGetWindow() != getGlutId())
            glutSetWindow(getGlutId());

        Inherited::doActivate();
    }
}
コード例 #28
0
ファイル: glutmui.c プロジェクト: AlexGreulich/HRTFVR
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);
}
コード例 #29
0
ファイル: glview.cpp プロジェクト: dkurtaev/planets_factory
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;
}
コード例 #30
0
ファイル: MeshGui.cpp プロジェクト: FeiZhan/smf_view
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();
}