cX and cY are the current mouse coords… but when the SELECT mode is trigged… the viewport becomes only a small part of the screen and the selection of the objects can be done only there… i.e. if i draw a red rectangle and press the mouse on or near it… the screen becames red and I can only select there… so the result is always this rect. Any ideas how to fix it?
10x…
You push the projection matrix but pop the modelview matrix. All matrix modes have their own indepdendend stack, so if you push while the projection matrix is current, you must pop when it’s current too.
I don’t know what the DrawObjects function does, but it looks like you have stack overflow with projection matrix and stack underflow with modelview matrix.
Many things could go wrong:
-matrices
-viewport settings
-scissor settings
-depth test
-stencil test
-alpha test
-clip planes
-and many others
All of the above can affect vertices or pixels. I assume you’re not using alpha test, stencil test nor clip planes.
Most likely you have problem with scissor test, viewport or matrices. Make sure you handle matrices properly - otherwise your program can go bananas. Remember that vertices are transformed by both projection and modelview matrix. Tutorials and examples are definitely not enough to understand matrices - some book would definitely help.
It could be depth buffer, too - make sure you clear it.
So inspect your code and clean it up - you’ll probably find some more misuses of matrices or perhaps you will find some mysterious glScissor?
If you won’t be able to solve this yourself, then you will have to post more code.