Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenGL Rotating Problem

Status
Not open for further replies.

forlorn

Programmer
Dec 12, 2001
28
0
0
TR
Hi,

I have a simple cube-rotating program( from DevX openGL tutorial). Mouse works fine when i have this piece of code

CPaintDC dc(this);
CBitirmeDoc* pDoc = GetDocument();
pDoc->RenderScene();
SwapBuffers(dc.m_ps.hdc);

in OnPaint method.

But i want to the cube to be drawn after i press a certain button. So i deleted the OnPaint function and used the same code on my OnButton function. Cube is drawn again, but i can't rotate it anymore. Can you figure out what causes this problem?

Any help is appreciated, thanks.

 
forlorn, windows does not draw the cube once. its a complete looping process so if the is no draw when windows send a wm_paint message the windows wont draw it in anothe angle or what ever rotating you are doing. so you will have to still use the draw function and capture keys on wm_paint.
 
VC++ maps what WM(windows message) goes to which function.

This is in the AFX areas that are //{{ something like this it looks grey, it automatically handles the messages for you and warns you to not change anything within the delimiters. Look through these and you'll see what looks like a function with wm_paint, OnPaint this is the command that is routing the wm_paint message to the OnPaint() fxn. You can change this to your function, by just deleting the OnPaint fxn the AFX messaging info probably still remains unchanged and creates a bug. Just be careful on what you change in the AFX delimits, there's alot there. You can add handling for your own messages in there also.

It definitly seems like it is a WM problem your having, you could probably keep the OnPaint method and change the AFX methods to respond to your BtnID. Rocco is the BOY!!

M O T I V A T E!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top