Jump to content
  • Advertisement
Sign in to follow this  
Chon-Ji

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

This topic is 4616 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
Advertisement
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
I see, thanks.

I just wonder how was this guy able to create the line around the sphere, it certainly doesn't look like an image

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!