本文整理汇总了C++中GLContext::make_current方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::make_current方法的具体用法?C++ GLContext::make_current怎么用?C++ GLContext::make_current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLContext
的用法示例。
在下文中一共展示了GLContext::make_current方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _new
/**
* create a new canvas
* args: width, height, [title]
*/
int Canvas::_new(lua_State *l) {
const char *title = "Aroma";
int width = luaL_checkint(l, 2);
int height = luaL_checkint(l, 3);
if (lua_gettop(l) > 3) {
title = luaL_checkstring(l, 4);
}
GLContext* context = new GLFWContext(width, height, title);
if (!context->make_current()) {
return luaL_error(l, "fatal error: failed to open window");
}
_canvas = new Canvas(context);
Viewport &view = _canvas->view;
lua_newtable(l);
// functions
setfunction("run", Canvas::_run);
setfunction("rect", Canvas::_rect);
setfunction("line", Canvas::_line);
setfunction("viewport", Canvas::_viewport);
setfunction("view3d", Canvas::_view3d);
setfunction("look", Canvas::_look);
setfunction("strip", Canvas::_strip);
setfunction("rotate", Canvas::_rotate);
setfunction("scale", Canvas::_scale);
setfunction("translate", Canvas::_translate);
setfunction("noise", Canvas::_noise);
setfunction("save", Canvas::_save);
setfunction("restore", Canvas::_restore);
setfunction("getTime", Canvas::_getTime);
setfunction("clear_color", Canvas::_clearColor);
setfunction("clear", Canvas::_clear);
setfunction("flush", Canvas::_flush);
setfunction("set_mouse", Canvas::_setMouse);
setfunction("hide_mouse", Canvas::_hideMouse);
setfunction("show_mouse", Canvas::_showMouse);
setfunction("key", Canvas::_key);
setfunction("key_up", Canvas::_key_up);
setfunction("key_down", Canvas::_key_down);
// load libraries
AromaRegister *lib = aroma_libs;
while (*lib) {
(*lib++)(l);
}
// properties
setnumber("dt", 0);
setnumber("time", glfwGetTime());
setnumber("width", view.getWidth());
setnumber("height", view.getHeight());
// mouse input
lua_newtable(l);
setint("x", 0);
setint("y", 0);
setbool("left", false);
setbool("right", false);
lua_setfield(l, -2, "mouse");
// create the input table
lua_newtable(l);
setnumber("xaxis", 0);
setnumber("yaxis", 0);
setbool("left", false);
setbool("right", false);
setbool("up", false);
setbool("down", false);
setbool("a", false);
setbool("b", false);
setbool("c", false);
setbool("d", false);
setbool("start", false);
setbool("select", false);
//.........这里部分代码省略.........