Advertisement

perspectives

Started by January 11, 2003 01:56 PM
2 comments, last by maddanio 22 years, 1 month ago
hi folks. i am very new with gl, and i have a problem (nice start heh? ): i have to draw and animate a bunch of squares made of 64 by 64 squares each with different colours. its all 2d, but i will need zooming. no lighting, no alpha! now i based it all on tutorial 12 from hene in cocoa (macosx). the source supplied works perfect, but when i use it i am unable to use perspective roatation (using other values in gluperspectives roatation than 0.0 makes it invisible ). also the asepct ratio part doesnt seem to be effective (while it is in the demo). last but not least i cant use full screen, right, again goes invisible. any suggestions to where the fluke might be? i dont get any errormessages, exceptions or console messages. as far as i tracked it down i do all the same as in the demo, except i dont use txture but a diaplylist of the squuares (there is some calculations in between beginlist() and endlist(), dunno if that does anything...). i use a slightly different timer setup too... i am under a bit of deadline pressure for a mediamaster project, so it would be nice if someone could help me wuick . cheers, daniel
cheers,daniel
"unable to use perspective roatation (using other values in gluperspectives roatation than 0.0 makes it invisible"

Could you post the code in this area you''re changing it to? It sounds like you''re trying to rotate the view via the perspective matrix - if you want to move the view this should be done via the modelview matrix instead. gluperspective doesn''t accept any values for rotations anyway..
Advertisement
- (void) reshape
{
NSRect sceneBounds;

[ [ self openGLContext ] update ];
sceneBounds = [ self bounds ];
NSLog([NSString stringWithFormat:@"reshaping to: %f - %f",
sceneBounds.size.width, sceneBounds.size.height]);
// Reset current viewport
glViewport( 0, 0, (unsigned int)sceneBounds.size.width, (unsigned int)sceneBounds.size.height );
glMatrixMode( GL_PROJECTION ); // Select the projection matrix
glLoadIdentity(); // and reset it
// Calculate the aspect ratio of the view

/////the perspective command////////////////////
gluPerspective( 0.0f, sceneBounds.size.width / sceneBounds.size.height, 0.1f, 100.0f );
glMatrixMode( GL_MODELVIEW ); // Select the modelview matrix
glLoadIdentity(); // and reset it
}


in the demo gulperspective''s first argument is set to 45.0 and it works.

this is just a peculiarity tho. my problems are the ratio, which doesnt seem to have any effect in my code, and the point that the whole thing vanishes when i switch to fullscreen.



cheers,

daniel

cheers,daniel
after recovering from fullscreen it doesnt come back either, its just gone

cheers,

daniel
cheers,daniel

This topic is closed to new replies.

Advertisement