Sign in to follow this  

Newbie Questions

This topic is 4750 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

Hi guys, a couple of simple ones for you:- 1. is there any way that i can change how far back i can place my models without them suddenly dissapearing as the point of my game is that they come closer and closer but i want them to start pretty far back. 2. how can i make it so that my models dont really get so small even when i put them in the distance, i want them to start pretty far away and i want them to come really close but i dont want them to be too small when they are in the distance if its possible. thanks everyone :)

Share this post


Link to post
Share on other sites
I can answer your first question, but I'm not sure of what you mean in the second one.
To set the distance of the far-clipping plane (is this the right name?) you have to change the last value passed to gluPerspective() in your initialization code.

About the big/small models: if they're too small for you, it means they're too far away.
If they were closer they would appear larger (that's what perspective is all about).

Share this post


Link to post
Share on other sites
thanks for the reply, much appreciated. i would like it if the models were not so small when they are in the distance, maybe if they could keep their size wherever they are in the distance, see i'm making a space invaders game and it looks silly when the aliens are really really small in the distance.
thanks everyone

Share this post


Link to post
Share on other sites
If you don't want the enemies to be bigger or smaller as you get nearer and farther than essentially you don't want perspective mode. What you want is 2D mode, or Ortho mode in OpenGL.

Share this post


Link to post
Share on other sites
inserted the following into my code and now the models have dissappeared!!! :(
//GL11.glOrtho(0.0f,Display.getDisplayMode().getWidth(),Display.getDisplayMode().getHeight(),0.0f,-1.0f,1.0f);

private void initGL() {
GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
GL11.glClearDepth(1.0); // Depth Buffer Setup
GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do

GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
GL11.glLoadIdentity(); // Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window
GLU.gluPerspective(45.0f,(float) Display.getDisplayMode().getWidth() /
(float) Display.getDisplayMode().getHeight(),0.1f,100.0f);

// ortho view
//GL11.glOrtho(0.0f,Display.getDisplayMode().getWidth(),Display.getDisplayMode().getHeight(),0.0f,-1.0f,1.0f);

GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Modelview Matrix

// Really Nice Perspective Calculations
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

Share this post


Link to post
Share on other sites

This topic is 4750 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