LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-09-2004, 12:19 PM   #1
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Rep: Reputation: 30
Question [opengl+glut]Please help me


Hello
What is wrong with the following code?
Code:
void GameEngine::CreateWindow()
{
  glutInit(&_argc, _argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);

  if(!m_bFullscreen)
  {
    glutInitWindowPosition(150, 150);
    glutInitWindowSize(m_iHeight, m_iWidth);
  }

  glClearColor(1.0, 1.0, 1.0, 1.0);
  glMatrixMode(GL_PROJECTION);
  glOrtho(0, m_iGridX, 0, m_iGridY, 0,m_iGridZ);
  glLoadIdentity();
  m_window = glutCreateWindow("TEST");
  glutDisplayFunc(Render);

  if(m_bFullscreen)
    glutFullScreen();

  glutKeyboardFunc(KeyboardHandling);
  glutSpecialFunc(SpecialKeyboardHandling);
  glutMouseFunc(MouseHandling);
  glutIdleFunc(Render);
  glutMainLoop();
}
Because evry time i execute glutDestroyWindow(m_window); it gives a segmentation fault.

Thanx Hylke
 
Old 05-09-2004, 11:08 PM   #2
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
Well, first I suggest you look into SDL, because it doesn't suck like glut. Next I want to say that I think the glLoadIdentity is supposed to be before the glOrtho, I could be wrong however, I am not a OpenGL guru. I also think you need to create your window before setting up OpenGL viewport stuff.

SDL Rocks, does the same + a lot more than glut, and it doesn't suck!

Glut is lame, can't do all that SDL can do, really sucks, and bites also!

www.libsdl.org <- this is where you start fixing your problems
 
Old 05-10-2004, 02:16 AM   #3
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Original Poster
Rep: Reputation: 30
Thank you for your reply but that didn't helped much

Last edited by hylke; 05-10-2004 at 02:29 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
where can i download GLUT for openGl resego Linux - Newbie 2 09-15-2005 06:52 PM
Linux WS, OpenGL, and glut? pbail Linux - Software 1 12-16-2004 09:35 AM
openGL, glut and lights on C++ poeta_boy Programming 0 08-02-2004 05:21 PM
problem OpenGL - glut vihan Programming 5 04-17-2004 06:53 AM
glut/mesa/openGL gurra Programming 1 10-10-2001 03:36 PM


All times are GMT -5. The time now is 02:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration