Restored from previous forum. Originally posted by traumatic.
Originally posted by halo
Trauma, your example is not perspective. It's orthogonal, just from a different angle. Objects in the distance would not appear smaller.
I know - I didn't code it...
I just wanted to show you what's going on but I already mentioned you'd better try modelview/gluPerspective().
Danilo showed you a code example how to properly setup a perspective projection (ReSizeGLScene()). You can also use glFrustum() instead of gluPerspective() if you want full control.
Regarding your Glut-Example: I'll have a look at it later, maybe I can find out what's wrong.
Restored from previous forum. Originally posted by halo.
I don't have problems running games in OpenGL. The thing is, I am not sure if it's the code or my machine. If you can see something with the above code with perspective(), then please post it and I'll check.
Restored from previous forum. Originally posted by traumatic.
gluPerspective() shouldn't be a graphicscard or driver problem.
It's just a glu-implementation of glFrustum() which is supported by every hardware afaik.
Here's a working perspective version of your glut-cube.
I also added some light for you.
To make this work, delete the two lines with glMatrixMode_() and glLoadIdentity_() in your Display()-procedure (you don't change it so you don't need it inside the display loop anyway) and call the following procedure right after the call to glutDisplayFunc_(@Display()).
Procedure Init()
; setup lights
Dim light_diff.f(3)
light_diff(0)=1.0
light_diff(1)=0.0
light_diff(2)=0.0
light_diff(3)=1.0
Dim light_pos.f(3)
light_pos(0)=1.0
light_pos(1)=1.0
light_pos(2)=1.0
light_pos(3)=0.0
; Enable light
glLightfv_(#GL_LIGHT0, #GL_DIFFUSE, @light_diff())
glLightfv_(#GL_LIGHT0, #GL_POSITION, @light_pos())
glEnable_(#GL_LIGHT0)
glEnable_(#GL_LIGHTING)
; depth buffering for hidden surface removal
glEnable_(#GL_DEPTH_TEST)
; this sets up your desired view
glMatrixMode_(#GL_PROJECTION)
gluPerspectivef_(40.0, 1.0, 1.0, 10.0)
glMatrixMode_(#GL_MODELVIEW)
tz.f=-3.0 ; - play around with this value
; just to show it's working
glTranslatef_(0.0, 0.0, tz)
glRotatef_(60.0, 1.0, 1.0, 0.0)
EndProcedure
Restored from previous forum. Originally posted by halo.
Yes, I am going to sell my copy of PB if I can't get this working. Do you have a problem with that?
I think it's bad practice to not post the entire code when dealing with something like this. Now if this exact code works on your machine and not on mine, then there's definitely a hradware problem. I think I did exactly as you said:
[...]
glClearColor_(0.0,0.0,1.0,0.0)
glShadeModel_(#GL_FLAT)
glutDisplayFunc_(@Display())
Init()
glutMainLoop_()
End
because there's no need to setup everything (lights etc.) every loop... but you did that already.
Yes, I am going to sell my copy of PB if I can't get this working.
You want to sell PureBasic because you can't code?
Well, Go on then!
I think it's bad practice to not post the entire code when dealing with something like this.
Something like what? The obvious?
Sorry but I think it's even worse to spam this forum with useless posts like writing two articles instead of one just because you don't know how to use the 'edit'-feature...
And sorry if you couldn't follow my explanations but hey.... you could! Maybe the problem is that I like people to actually think about what they're doing instead of a simple copy&paste.
Nevertheless, if you can't see anything I'd really like to know what Graphicscard you've got. Think you can tell me?
Restored from previous forum. Originally posted by fred.
Originally posted by halo
God, you guys are assholes.
Please stop that immediately. I don't care about users which even don't respect elementary courtesy rules. Better sell your copy of PB and never post again on this forum.
Restored from previous forum. Originally posted by Franco.
@halo
I read this topic and I can't see why you are so upset - and use such words.
I suppose you are very young and don't know how to act in a polite way outside the family you are living in.
Some people (with more OpenGL experience that I have...) tryed to help you and to give you some hint's.
But what I can see is, that you are insulting this people in an very arrogant way.
Why?
What I can also see in the Blitz forum is, that some people over there don't share your opinion too.
So think about it and change your behaviour.
YOU CAN'T CUT THE TREE WHERE YOU ARE SITTING. TRY IT AND YOU WILL SEE!
If you have some questions - ask them in a polite way, never be arrogant or insulting.
Otherwise you get no answer - even in the Blitz forum.
BTW: OpenGL is not a easy thing to code.
Some people here try to get it running and are so kind to share their knowledge with others in this forum.
So be polite in the future and think about your behaviour...
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.