SDL + CEGUI + openGL display problem
Posted: Wed Mar 11, 2009 19:52
by kewur
Hello
I have set my app for SDL and CEGUI
i have put some events to fire . like when pushing a button drawing a square or tea pot.
my code is like this
Code: Select all
bool DrawSquare(const CEGUI::EventArgs &e)
{
glutDisplayFunc(dene);
return true;
}
and the dene function is
Code: Select all
void dene()
{
glutWireTeapot(3.2)
}
what may be the problem ? when i click draw square it crashes without any warning and in debug it doesnt seem to show me where the problem is
Posted: Wed Mar 11, 2009 21:55
by kewur
since i cant find any function to draw lines with SDL
this is the code where i initilise SDL
void setupSDL()
{
if ((SDL_Init(SDL_INIT_VIDEO))<0)
{
fprintf(stderr, "Unable to initialise SDL: %s", SDL_GetError());
exit(0);
}
if ((surface = SDL_SetVideoMode(800,600,0,SDL_OPENGL))==NULL)
{
fprintf(stderr, "Unable to set OpenGL videomode: %s", SDL_GetError());
SDL_Quit();
exit(0);
}
SDL_WM_SetCaption("CSE452 Paint Program", NULL);
//Draw_Line(surface, 100,100, 30,0, 3);
//gluLookAt(100, 0, 20, 0, 0, -1, 0, 1, 0);
glEnable(GL_CULL_FACE);
glDisable(GL_FOG);
glClearColor(.2f,.3f,.3f,1.0f);
//glViewport(0,0, 800,600);
SDL_ShowCursor(SDL_DISABLE);
SDL_EnableUNICODE(1);
}
i was thinking if i may have the camera position wrong.
btw i found a SDL_draw library im trying to get it work right now. but its stubborn.
Posted: Sat Mar 14, 2009 08:27
by CrazyEddie
Hi,
With regards to the crash, <shrugs>. What type of crash is it? A segfault or something, or maybe an application exception? Anything in the log? Remember, you have
all the information and couldn't identify the issue, we have only the information you posted - what chance do we have of identifying issues from that information? Help us to help you
I don't understand the second post at all; was there a question in there somewhere?
With regards to cameras and CEGUI, that makes no difference since CEGUI is always renders in screen-space.
CE.
Posted: Tue Mar 17, 2009 17:29
by LennyH
I haven't messed with openGL direct in a long long time, but shouldn't you be doing some form of glClear and glFlush before and after the teapot?