开发者

glutGetWindow - Expression must have class type

Good Afternoon,

So I'm working with C++ (Visual Studios C++ 2010 to be exact) and am working on a seemingly easy task;

Draw a picture onto the middle of the window. If you readjust the window size, the picture/bitmap will be redrawn into the middle of the newly sized window.

I figure to get the middle of the window, I should find its rightmost and bottommost bits, then divide each by 2, but I don't know how to get the window length and height.

I currently have

centrewidth = glutGetWindow().Size.Width;
centreheight = glutGetWindow().Size.Height;

Yet for both I'm getting errors on glutGetWindow, saying开发者_如何学运维 "Error: Expression must have class type". I'm certain once I get this, it will be no problem, but this is causing a lot of trouble for me. Any advice is greatly appreciated. Thanks!


glutGetWindow doesn't return object of any class type. It's signature is this:

int glutGetWindow(void);

And you need is this (see doc):

int glutGet(GLenum eWhat);

Example,

int width = glutGet(GLUT_WINDOW_WIDTH); //Width in pixels of the current window.
int height = glutGet(GLUT_WINDOW_HEIGHT); //Height in pixels of the current window.

Have a look at the doc to know what states you can get using this function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜