Sign in to follow this  

Help....how to do this....

This topic is 4402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm desperate, it looked so simple to me and yet I can't come up with a way to do it. Basically, I'm trying to create something similar to this: http://s24.yousendit.com/d.aspx?id=1PP2FFNBU0A0T3B2SANZDFW1JP Tthere's no problem creating the sphere, but I don't know how to place a single line around it. I want to place like a single (sine) wave around it. If possible I don't wan't to end up in texture mapping because the image doesn't look good when the screen is resized

Share this post


Link to post
Share on other sites
If you change your aspect ratio when the window is resized then the image won't look crappy when it's resized.

E.G.
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window
{
if (height==0) // Prevent A Divide By Zero By
{
height=1; // Making Height Equal One
}

glViewport(0, 0, width, height); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
}



And then in your window class style, set CS_HREDRAW and CS_VREDRAW so if the window changes size horizontally/vertically it is redrawn, like so:
wc.style = CS_HREDRAW | CS_VREDRAW


Finally, when the windows message, WM_SIZE, is sent out, we call for our resize function like so:
case WM_SIZE:
{
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));// LoWord=Width, HiWord=Height
return 0; // Jump Back
}


That case will be where you handle window messages.

Share this post


Link to post
Share on other sites

This topic is 4402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this