PDA

View Full Version : Objects Disappear



02-14-2005, 12:37 PM
Hi. Ive written a quick test app that sets up an ortho window then draws a traingle and a quad.

The problem is, when I resize or minimize the app, both objects disappear and will not return.

Here is the resize function


SUB mgeWindow_Resize(Width:INT, Height:INT)

' Prevent divide by zero
IF Height = 0
Height = 1

ENDIF

' Set the viewport
glViewport(0, 0, Width, Height)

glMatrixMode(GL_PROJECTION)
glLoadIdentity()

' Setup ortho projection
glOrtho(-0.375, (Width - 0.375), (Height - 0.375), -0.375, -1.0, 1.0)

glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
And the message callback is a simple


CASE WM_SIZE
' Resize the OpenGL viewport to match the new client area
mgeWindow_Resize(mgeHelper_LoWord(lParam), mgeHelper_HiWord(lParam))

RETURN 0 I cannot understand why this is happening or how to fix it. Any ideas (apologies if the code formatting is iffy).

Cheers :)

malancha
02-14-2005, 07:58 PM
Are you calling your display function when a resize occurs? If you're not then that could be causing your problem.

02-15-2005, 10:21 AM
Ive traced the error back to the HiWord function I wrote - the Loword one works fine as I checked the values they were both returning - and only this one was returning trash.

Keep in mind im not using C++.


SUB mgeHelper_HiWord(Hi:UINT),WORD

RETURN (Hi & 0xFFFF0000 / 0x00010000)

ENDSUB

02-15-2005, 10:24 AM
Hold your horses Ive fixed it :D

a simple brackets addition was required

SUB mgeHelper_HiWord(Hi:UINT),WORD

RETURN ((Hi & 0xFFFF0000) / 0x00010000)

ENDSUB