Results 1 to 4 of 4

Thread: Objects Disappear

  1. #1
    Guest

    Objects Disappear

    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
    Code :
    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

    Code :
     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

  2. #2
    Member Contributor
    Join Date
    Mar 2004
    Location
    Bangalore, India
    Posts
    51

    Re: Objects Disappear

    Are you calling your display function when a resize occurs? If you're not then that could be causing your problem.

  3. #3
    Guest

    Re: Objects Disappear

    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++.

    Code :
     SUB mgeHelper_HiWord(Hi:UINT),WORD
     
    RETURN (Hi & 0xFFFF0000 / 0x00010000)
     
    ENDSUB

  4. #4
    Guest

    Re: Objects Disappear

    Hold your horses Ive fixed it

    a simple brackets addition was required

    SUB mgeHelper_HiWord(Hi:UINT),WORD

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

    ENDSUB

Similar Threads

  1. Objects disappear after intermittent time
    By Talan77 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-11-2014, 04:39 AM
  2. Objects disappear when rotating
    By metalac in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-22-2008, 04:57 PM
  3. after reshape some objects disappear
    By syncmaster in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-08-2008, 12:57 AM
  4. To disappear objects & then making them re-appear
    By queries in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-14-2004, 07:21 AM
  5. huge objects disappear
    By mekron in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-25-2003, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean