当前位置: 首页>>代码示例>>C++>>正文


C++ GLWindow类代码示例

本文整理汇总了C++中GLWindow的典型用法代码示例。如果您正苦于以下问题:C++ GLWindow类的具体用法?C++ GLWindow怎么用?C++ GLWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GLWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CharFunc

 static void CharFunc(GLFWwindow* window, int c) {
     GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window);
     
     input::KeyEventArgs args;
     args.key    = c;
     args.state  = input::Press;
     args.isIME  = true;
     args.flag   = g_key_flag;
     
     glwnd->onKeyEvent().raise(glwnd, args);
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: upCB

void Display::upCB(Fl_Button* w, Display* d)
{
	Map* m = d->getMap();
	GLWindow* win = d->getGWin();
	//std::cout << d->tile_x <<d->tile_y<< std::endl;
	if (d->tile_y == 0)
		d->tile_y = m->getRow()-1;
	else
		d->tile_y--;
	win->setColor(d->tile_x, d->tile_y);
	win->redraw();
}
开发者ID:confuego,项目名称:CPP-OpenGL-Modeler,代码行数:12,代码来源:Display.cpp

示例3: createCB

void Display::createCB(Fl_Button* w, Display* c){
	Map* m = c->getMap();
	c->tile_x = c->tile_y = 0;
	m->setSize(c->r,c->c,c->x,c->y);
	//std::cout << c->max << std::endl;
	m->setRange(c->max, c->min);
	m->createMap();
	GLWindow* win = c->getGWin();
	win->setColor(c->tile_x, c->tile_y);
	win->setMap(m);
	win->redraw();
}
开发者ID:confuego,项目名称:CPP-OpenGL-Modeler,代码行数:12,代码来源:Display.cpp

示例4: rightCB

void Display::rightCB(Fl_Button* w, Display* d)
{
	Map* m = d->getMap();
	GLWindow* win = d->getGWin();
	//std::cout << d->tile_x <<d->tile_y<< std::endl;
	if (d->tile_x == m->getCol() - 1)
		d->tile_x = 0;
	else
		d->tile_x++;
	win->setColor(d->tile_x, d->tile_y);
	win->redraw();
}
开发者ID:confuego,项目名称:CPP-OpenGL-Modeler,代码行数:12,代码来源:Display.cpp

示例5: frameDraw

		void frameDraw(const uint32_t id)
		{
			eq::Channel::frameDraw(id);

			GLWindow* glwindow =
					dynamic_cast<GLWindow*> (getWindow()->getOSWindow());

			if (glwindow)
				glwindow->getWidget()->paintGL();
			else
				Widget::static_draw(this);
		}
开发者ID:shutter,项目名称:libMaoni,代码行数:12,代码来源:eQute.hpp

示例6: MousePosFunc

    static void MousePosFunc(GLFWwindow* window, int x, int y) {
        GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window);

        input::MouseEventArgs args;
        args.button = input::Nothing;
        args.state  = input::Move;
        args.flag   = g_key_flag;
        args.x      = x;
        args.y      = y;

        glwnd->onMouseEvent().raise(glwnd, args);
    }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例7: MouseButtonFunc

    static void MouseButtonFunc(GLFWwindow* window, int btn, int state) {
        GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window);

        input::MouseEventArgs args;
        args.button = glfw_to_ukn_mouse(btn);
        args.state  = glfw_to_ukn_mouse_state(state);
        args.flag   = g_key_flag;

        // retrieve mouse pos
        glfwGetCursorPos(window, &args.x, &args.y);

        glwnd->onMouseEvent().raise(glwnd, args);
    }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: ScrollFunc

    static void ScrollFunc(GLFWwindow* window, double a, double b) {
        GLWindow* glwnd = (GLWindow*)glfwGetWindowUserPointer(window);
        
        input::MouseEventArgs args;
        args.button = input::Nothing;
        args.state  = input::Wheel;
        args.flag   = g_key_flag;
        args.x      = a;
        args.y      = b;
        args.wheel  = 0;

        glwnd->onMouseEvent().raise(glwnd, args);
    }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: expose

static gint expose (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
  GLWindow *wnd = (GLWindow*)data;

#ifndef _WIN32
  if (event->count > 0)
    return TRUE;
#endif

  if (!g_pParentWnd->IsSleeping ())
    wnd->OnExpose ();

  return TRUE;
}
开发者ID:AEonZR,项目名称:GtkRadiant,代码行数:14,代码来源:glwindow.cpp

示例10: main

int main(int argc, char** argv)
{
	GLWindow window;

	ShaderInfo shadersText[] = { {GL_VERTEX_SHADER, "Source/GLSLShaders/text.vert" },
				{GL_FRAGMENT_SHADER, "Source/GLSLShaders/text.frag" }};

	SDL_Color textCol;
	textCol.r = 36;
	textCol.g = 133;
	textCol.b = 12;
	textCol.a = 255;
	window.RegisterTextRenderer(shadersText, 2, "Source/Resources/Fonts/helvetica.ttf", 14, textCol);

	glm::vec3 eye(0.0f, -15.0f, 15.0f);
	glm::vec3 center(0.0f, 0.0f, 0.0f);
	glm::vec3 up(0.0f, 15.0f, 15.0f);
	std::shared_ptr<Camera> cam(new Camera(eye, center, up, 45.0f, (float)WIDTH/ (float)HEIGHT, 1.0f, 100.0f));

	std::shared_ptr<CameraKeyMoveHandler> cameraKeyMoveHandler(new CameraKeyMoveHandler(cam.get()));
	window.RegisterEventHandler(cameraKeyMoveHandler.get());
	window.RegisterRenderHandler(cameraKeyMoveHandler.get());

	std::shared_ptr<CameraMouseMoveHandler> cameraMouseMoveHandler(new CameraMouseMoveHandler(cam.get(), glm::vec3(0.0f, 0.0f, 0.0f)));
	window.RegisterEventHandler(cameraMouseMoveHandler.get());

	std::shared_ptr<ShaderProgramManager> shaderManager(new ShaderProgramManager(window, cam.get()));
	window.RegisterEventHandler(shaderManager.get());
	window.RegisterRenderHandler(shaderManager.get());

	window.MainLoop();

	return 0;
}
开发者ID:vladfedchenko,项目名称:OpenGL,代码行数:34,代码来源:GLWindow.cpp

示例11: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSurfaceFormat fmt;
    fmt.setDepthBufferSize(24);
//    fmt.setVersion(3, 3);
//    fmt.setProfile(QSurfaceFormat::CoreProfile);
    QSurfaceFormat::setDefaultFormat(fmt);

    GLWindow w;
    w.show();

    return a.exec();
}
开发者ID:giarld,项目名称:MyQtDemo,代码行数:15,代码来源:main.cpp

示例12: triggerStereo

// workaround for issue seen on Windows 7 with NVIDIA 
void triggerStereo()
{
    // attributes for an OpenGL stereo window
    GLWindow::Attributes attributes;
    attributes[WGL_STEREO_ARB] = GL_TRUE;

    // create and destroy a small stereo window: this is here to work around
    // an issue with windows failing to switch to quad-buffer mode (although
    // the window is successfully created and reports a stereo pixel format)
    // note: the window is invisible (not shown) but typically causes the
    // windows desktop to flash briefly (first run only) as stereo activates
    GLWindow window;
    window.create( 0, "", 0, 0, 0, 8, 8, 0, 0, DefWindowProc, 0, attributes );
    window.destroy();
}
开发者ID:tuanthng,项目名称:Special3DGL,代码行数:16,代码来源:main.cpp

示例13: main

int main(int argc, char** argv) {
    auto glversion = gl::getAvailableVersion();
    auto major = GL_GET_MAJOR_VERSION(glversion);
    auto minor = GL_GET_MINOR_VERSION(glversion);

    if (glversion < GL_MAKE_VERSION(4, 1)) {
        MessageBoxA(nullptr, "Interface requires OpenGL 4.1 or higher", "Unsupported", MB_OK);
        return 0;
    }
    QGuiApplication app(argc, argv);

    bool quitting = false;
    // FIXME need to handle window closing message so that we can stop the timer
    GLWindow* window = new GLWindow();
    window->create();
    window->show();
    window->setSurfaceType(QSurface::OpenGLSurface);
    window->setFormat(getDefaultOpenGLSurfaceFormat());
    bool contextCreated = false;
    QTimer* timer = new QTimer();
    QObject::connect(timer, &QTimer::timeout, [&] {
        if (quitting) {
            return;
        }
        if (!contextCreated) {
            window->createContext();
            contextCreated = true;
        }
        if (!window->makeCurrent()) {
            throw std::runtime_error("Failed");
        }
        glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);
        window->swapBuffers();
        window->doneCurrent();
    });
    // FIXME need to handle window closing message so that we can stop the timer
    QObject::connect(&app, &QCoreApplication::aboutToQuit, [&] {
        quitting = true;
        QObject::disconnect(timer, &QTimer::timeout, nullptr, nullptr);
        timer->stop();
        timer->deleteLater();
    });

    timer->setInterval(15);
    timer->setSingleShot(false);
    timer->start();
    app.exec();
    return 0;
}
开发者ID:Atlante45,项目名称:hifi,代码行数:50,代码来源:main.cpp

示例14: WinMain

/* Main Method */
int CALLBACK WinMain(HINSTANCE current_instance_handle,HINSTANCE previous_instance_handle,LPSTR arguments,int show_command)
{
	std::ofstream log;
	GLWindow      window;
	

	log.open("./Debug/output.log",std::ofstream::ate);
	std::cout.rdbuf(log.rdbuf());

	
	/* Initialize the window and run it's message loop. */
	if(!window.init())
	{
		return 1;
	}

	window.setBackgroundColour(Strixa::Graphics::Colour(0,0,0,100));
	window.maximize();

    return window();
}
开发者ID:NicholasRoge,项目名称:OpenGL-Overlay,代码行数:22,代码来源:Main.cpp

示例15: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

#if defined(Q_WS_X11)
    XInitThreads();
#endif

    GLWindow *glwindow = new GLWindow();
    glwindow->create();
    glwindow->setWindowState(Qt::WindowNoState);
    glwindow->showFullScreen();
    glwindow->resume();

    int result = a.exec();

    glwindow->destroy();
    delete glwindow;

    //QCoreApplication::setAttribute(Qt::AA_NativeWindows, true);
    //QCoreApplication::setAttribute(Qt::AA_ImmediateWidgetCreation, true);

    //return a.exec();

    return result;
}
开发者ID:minimoog,项目名称:fluid,代码行数:26,代码来源:main.cpp


注:本文中的GLWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。