Results 1 to 3 of 3

Thread: window problem

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2002
    Location
    hyderabad,india
    Posts
    4

    window problem

    when ever we move the mouse onto the cross button and move back onto the window the sceen is again drawn. if any change of shape or orientation is there they too change
    though we dont really close the window or that particular event has occured. why is this happening?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2002
    Posts
    201

    Re: window problem

    Your scene is redrawing itself for some reason. do you do a redraw in your mouse function by any chance?

  3. #3
    Halcyon
    Guest

    Re: window problem

    Every time you resize your window you need to resize your view port and reset your model and project matrices along with the perspective. Here is the code to do it. Put this under the windows WM_SIZE procedure. The width and height can be obtained by taking the LOWORD(lparam) and HIWORD (lparam) respectively. Cast them into ints and store then into variables width and height. Anyways...here is the code:

    Code :
    	//resize viewport
    	glViewport(0,0,width,height);
     
    	//Load projection matrix
    	glMatrixMode(GL_PROJECTION);
    	//Clear projection matrix
    	glLoadIdentity();
    	//Reset perspective (from 0.1f to 100.0f)
    	gluPerspective(45.0f,(float)width/(float)height,0.1f,100.0f);
     
    	//Load Modelview Matrix
    	glMatrixMode(GL_MODELVIEW);
    	//Clear Modelview matrix
    	glLoadIdentity();

Similar Threads

  1. a problem with the window
    By Hartman in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-29-2010, 10:04 PM
  2. window resizing problem - help please
    By pmr2004pmr in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-31-2004, 01:21 PM
  3. A problem about Win32 window
    By crazy in forum OpenGL: Windows
    Replies: 6
    Last Post: 04-22-2004, 08:09 AM
  4. Zoom Window Problem
    By shincheng in forum OpenGL: Basic Coding
    Replies: 15
    Last Post: 02-28-2001, 02:14 AM
  5. Problem with Ogl window
    By NewROmancer in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 08-17-2000, 10:23 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