PDA

View Full Version : Dimension problem in Java



Mat
04-22-2002, 01:34 AM
Hi,

I inserted an GLAnimCanvas in an JPanel which size is 931*652. In the GLAnimCanvas I draw a simple quad which size is 0.05*6.01 but it seems the quad is to big because it goes out of the JPanel I just see the top. I don't know how to configure these problems of size...
I defined the gl.glViewport method with the size of the JPanel.. as I saw in all examples


Could somebody help me?

Thank you in advance
Mat

jimmi
04-22-2002, 01:55 AM
Hi Mat,
This could be several things:
i) If your viewport is set up incorrectly gl will only render to part of your window. Make sure you call glViewport(0, 0, window_width, window_height).
ii) Your projection (gluPerspective/glFrustum/glOrtho) may be set up wrong. I think that the default is an orthographic projection (left: -1, right: 1, top: 1, bottom: -1).
iii) You may be translating (glTranslate) the object such that only half of it is visible.

I can't tell exactly what it is from your description, but check each of these and you should find the problem.

jimmi