PDA

View Full Version : glRotated doesnt work??



Andreas K
06-24-2010, 12:55 PM
Hello,

the following code blits to my fbo. Works so far. But glrotated() has no effect. Why? Pls help. Thx!!!

w=paintInfo->width;
h=paintInfo->height;
// Gen Framebuffer
glGenFramebuffersEXT(1, &fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
img=texture->Id();
// Bind Texture
//glGenTextures(1, &img);
glBindTexture(GL_TEXTURE_2D, img);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, img, 0);

paintInfo->SetOpenGLTextureMode( Alpha(), cForm, xForm.IsScaled(), texture );

GLenum status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
GLASSERT(status == GL_FRAMEBUFFER_COMPLETE_EXT);
glPushMatrix();

glRotated(xForm.rotation,0, 0, 1);
err=glGetError();

ZbuffeR
06-24-2010, 01:01 PM
What do you mean no effect ?
glRotate only "multiply the current matrix by a rotation matrix" as written in the doc.
Do you draw any vertex to see the rotation ?

Andreas K
06-24-2010, 09:40 PM
My draw code looks like this and comes right after. Works e.g. for non rotated drawing and even scales my texture. But no rotation:

SDL_CurrentVideo->glBegin( GL_QUADS );
{
SDL_CurrentVideo->glTexCoord2f( texCoord[0].x, texCoord[0].y );
SDL_CurrentVideo->glVertex3i( bounds.xmin, bounds.ymin, openGLZ );

SDL_CurrentVideo->glTexCoord2f( texCoord[1].x, texCoord[1].y );
SDL_CurrentVideo->glVertex3i( bounds.xmin+bounds.Width(), bounds.ymin, openGLZ );

SDL_CurrentVideo->glTexCoord2f( texCoord[2].x, texCoord[2].y );
SDL_CurrentVideo->glVertex3i( bounds.xmin+bounds.Width(), bounds.ymin+bounds.Height(), openGLZ );

SDL_CurrentVideo->glTexCoord2f( texCoord[3].x, texCoord[3].y );
SDL_CurrentVideo->glVertex3i( bounds.xmin, bounds.ymin+bounds.Height(), openGLZ );
}
SDL_CurrentVideo->glEnd();

seelofo
06-25-2010, 01:52 AM
when do you call this piece of code exactly?
well, anyway make sure it's called after the call to glrotated() and there was no loadIdentity() in between, and also that the matrix mode is GL_ModelView.

mhagain
06-25-2010, 09:24 AM
Have you tried glRotatef instead, and if so do you see the same problems there? There is really no advantage to using the -d versions of functions, as your driver will work in regular floating point internally; best case result is that you don't actually have the extra precision you think you're getting; worst case is that it doesn't work at all and gives you unwanted side-effects.

Andreas K
06-25-2010, 10:18 AM
Yes I tried both. I didnt attach a depth buffer to fbo. Is this the problem?

andreas

Andreas K
06-30-2010, 10:11 PM
I found it. It was related to my pic processing afterwards.
Everything discussed here works well.

Thanks for all help!!

andreas