织梦CMS - 轻松建站从此开始!

罗索

glfw若干函数列表

落鹤生 发布于 2011-04-22 15:36 点击:次 
glfw若干函数列表说明。
TAG:

1. int glfwInit( void )  返回值 GL_TRUE 或者 GL_FALSE

2. void glfwTerminate( void )

屏幕设置

3.  int glfwOpenWindow( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode ) 

    mode可选值: GLFW_FULLSCREEN , GLFW_WINDOW

4.  void glfwCloseWindow( void )

关于键盘

5. int glfwGetKey( int key )

交换前后端渲染缓冲

6. glfwSwapBuffers();

7. glfwPollEvents()

屏幕设置

标题设置

8. void glfwSetWindowTitle( const char *title )

9. void glfwOpenWindowHint( int target, int hint )

改变屏幕尺寸

10. void glfwSetWindowSize( int width, int height)

11. void glfwSetWindowPos( int x, int y )

查询屏幕属性

12.int glfwGetWindowParam( int param )

13.void glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun )

14. cbfun应该是这样的 void GLFWCALL fun( int width, int height )

15. void glfwGetWindowSize( int *width, int *height )

渲染

16.void glfwSwapBuffers( void )

17. void glfwSwapInterval( int interval )  (选择最小的number of vertical retraces the video raster line should do before swapping the buffers)

查询视频模式

18. int glfwGetVideoModes( GLFWvidmode *list, int maxcount )

模式结构如下:

typedef struct

{
     int Width, Height; // Video resolution
     int RedBits; // Red bits per pixel
     int GreenBits; // Green bits per pixel
     int BlueBits; // Blue bits per pixel
} GLFWvidmode;

19. void glfwGetDesktopMode( GLFWvidmode *mode )

输入处理

GLFW gives three options for getting keyboard input:
 Manually polling the state of individual keys.
 Automatically receive new key state for any key, using a callback function.
 Automatically receive characters, using a callback function.

检查一个键按下了没有使用

20. int glfwGetKey( int key )

在处理连锁键的时候就要

21.glfwEnable( GLFW_STICKY_KEYS );

当然也可以使用

22. void glfwSetKeyCallback( GLFWkeyfun cbfun )

字符输入

23. void glfwSetCharCallback( GLFWcharfun cbfun )

这里:

The argument fun is a pointer to a callback function. The callback function shall take two integer arguments. The first is a Unicode character code, and the second is GLFW_PRESS if the key that generated the character was pressed, or GLFW_RELEASE if it was released.

24.键重复 glfwEnable( GLFW_KEY_REPEAT );

25. 特殊系统键glfwDisable( GLFW_SYSTEM_KEYS );

鼠标输入

26. void glfwGetMousePos( int *x, int *y )    这里x,y是鼠标的绝对路径

27. void glfwSetMousePosCallback( GLFWmouseposfun cbfun )  这是回调函数

28. int glfwGetMouseButton( int button ) 这是鼠标按键

这里 int 可以为:

GLFW_MOUSE_BUTTON_LEFT

GLFW_MOUSE_BUTTON_RIGHT 

GLFW_MOUSE_BUTTON_MIDDLE

29. void glfwSetMouseButtonCallback( GLFWmousebuttonfun fun )

获取鼠标滑轮位置

30. int glfwGetMouseWheel( void )

31. void glfwSetMouseWheelCallback( GLFWmousewheelfun fun )
32. 隐藏鼠标 glfwDisable( GLFW_MOUSE_CURSOR );

33.开启鼠标  glfwEnable( GLFW_MOUSE_CURSOR );

关于jostick

34. int glfwGetJoystickParam( int joy, int param )

35. int glfwGetJoystickPos( int joy, float *pos, int numaxes )

36. int glfwGetJoystickButtons( int joy, unsigned

glfw在定时方面的应用

37. double glfwGetTime( void )

38. void glfwSetTime( double time )

39. void glfwSleep( double time )

读入图片

从tga获取数据

40. int glfwLoadTexture2D( const char *name, int flags )

41. int glfwReadImage( const char *name, GLFWimage *img, int flags )

42. void glfwFreeImage( GLFWimage *img )

感觉蛮简单的  过年好好学学这个-_-

(ccsdu2004)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201104/11273.html]
本文出处:CSDN博客 作者:ccsdu2004
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容