Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


karwosts

Member Since 15 Sep 2009
Offline Last Active Feb 19 2013 11:51 PM

#4756945 Matrix Begins To Rotate Incorrectly

Posted by karwosts on 10 January 2011 - 05:27 PM

What you are seeing is the correct behaviour, there's nothing wrong with your code. A camera will start to roll even if you're only inputting a sequence of pitch and yaw operations, because these are applied on the local coordinate system instead of the global coordinate system.

If you imagine holding a camera, hold it pointed straight ahead, then rotate it upward 90 degrees so it points up, then "pitch" it 90 degrees to the right. You'll find that it has in a sense "rolled" by 90 degrees, in that the bottom of the camera is no longer pointing to the ground. That's the similar effect that you're seeing.

If you want to force no roll whatsoever, than store an internal count of pitch degrees and yaw degrees, and build your view matrix each frame from a pitch then yaw. This will give you more typical behaviour like you might expect in a first person camera.


#4756850 Deferred Shadow Mapping And Shading

Posted by karwosts on 10 January 2011 - 02:19 PM

In typical graphics you've got three matrices:

Model Matrix (transforms object space to world space)
View Matrix (transforms world space to eye space)
Projection Matrix (transforms eye space to screen space)

The model matrix is just the first of those three. Old fixed pipeline combined the model and view matrix together into the modelview matrix because it never required them separately. If your deferred renderer is defining the "position" in world space than you need the model matrix alone to do this transform. If you multiply a vertex by the modelview matrix you're going to get it's position in eye space, which probably isn't what you want.

All the built in gl_blahMatrix matrices are deprecated now anyway, you're supposed to be managing all matrices yourself on the client side, and then use uniform matrices to upload them to the shader.


#4746763 Question about OpenGL

Posted by karwosts on 16 December 2010 - 06:20 AM

Yes, a good portion of the old functions were deprecated (and no longer in the latest API).

glBegin/End were some of those functions. If you look at the 4.0 Reference Card anything that you see in blue is deprecated.

Most of these were deprecated in version 3.2, so any tutorial you find for OpenGL 3 should put you on the right track. 3 and 4 are pretty similar.




#4646655 FBO blit framebuffer

Posted by karwosts on 11 May 2010 - 11:15 AM

Is it possible that its black just because nothing is getting rendered to the fbo? Maybe your depth buffer is rejecting everything. Try disabling depth test and see if its still black?

I'm pretty rusty with my FBO's so I could be wrong, but wouldn't you want to call glClear after you bind your FB? I would guess that it only clears the active FB.


//Render to FBO
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushAttrib(GL_VIEWPORT_BIT | GL_ENABLE_BIT);
glViewport(0, 0, ResolutionX, ResolutionY);
glBindTexture(GL_TEXTURE_2D, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Gbuffers[0].FramebufferID);






PARTNERS