Author Topic: GLUT  (Read 11315 times)

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
GLUT
« on: March 18, 2006, 11:22:02 am »
Hi all, I want to make a simple window with GLUT, this is what I get when I compile it:

Project : OpenGL Application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\C\Projects\GLUT_Window--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\C\Projects\GLUT_Window\GLUT.exe
.objs\main.o:main.cpp:(.text+0x48): undefined reference to `glutInit'
.objs\main.o:main.cpp:(.text+0x5c): undefined reference to `glutInitWindowPosition'
.objs\main.o:main.cpp:(.text+0x70): undefined reference to `glutInitWindowSize'
.objs\main.o:main.cpp:(.text+0x7c): undefined reference to `glutCreateWindow'
.objs\main.o:main.cpp:(.text+0x88): undefined reference to `glutDisplayFunc'
.objs\main.o:main.cpp:(.text+0x9f): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)

The glut operations dont work for a weird reason. I Included the latest glut library file for the latest glut .dll file, and added the latest glut .h file. What could else be wrong?

Code:

#define GLUT_DISABLE_ATEXIT_HACK
#include <GL/add/glut.h>

bool init()
{
return true;
}

void display()
{

}

int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(50, 50);
glutInitWindowSize(500, 500);
glutCreateWindow("01 - GLUT Window");
glutDisplayFunc(display);
if (!init())
{
return 1;
}
glutMainLoop();
return 0;
}

Noone of the functions are working :S.

The linker files are:

-lopengl32
-lglu32
-lglut32 (or -lglut or -glut)

Any help will be appreciated :)
Check out my website: http://www.daevius.com

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: GLUT
« Reply #1 on: March 18, 2006, 11:43:50 am »
If I delete the glutInit(); function, the window appears, but has no inside color, it has the underlaying picture in the frame... if you get what I mean.
Check out my website: http://www.daevius.com

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: GLUT
« Reply #2 on: March 18, 2006, 04:36:26 pm »
Hi all, I want to make a simple window with GLUT, this is what I get when I compile it:
It might help if you post the complete compiler log, though. To enable it please go to Settings -> Compiler and debugger -> tab "Other" -> set the "Compiler logging" to "Full command line".
Furhtermore did you try the OpenGL template that ships with C::B? This really works and you'd only have to change this "hello OpenGL world" example to fit your purposes. It would also be very helpful if you could tell what version of C::B you are using. What OpenGL library are you using? The GLUT DevPak? Becasue if not you might want to try this - this is definetely compatible to C::B/MinGW (GCC).
Finally you could also search through the forum. There are plenty of OpenGL examples and issues that have already been provided and solved.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: GLUT
« Reply #3 on: March 19, 2006, 03:12:54 pm »
Okay thx, is the OGL template one of the best and fastest window generations?
Check out my website: http://www.daevius.com

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: GLUT
« Reply #4 on: March 19, 2006, 08:09:44 pm »
Its working now without any settings changement...weird.
Check out my website: http://www.daevius.com

Offline Decrius

  • Multiple posting newcomer
  • *
  • Posts: 81
    • Daevius
Re: GLUT
« Reply #5 on: March 24, 2006, 05:29:41 pm »
In the OGL template...what is the Init() function? where to set the init things?
« Last Edit: March 24, 2006, 11:26:56 pm by Decrius »
Check out my website: http://www.daevius.com

Offline bluekid

  • Multiple posting newcomer
  • *
  • Posts: 57
  • What is blue ? Blue is the invisible becoming visi
Re: GLUT
« Reply #6 on: March 28, 2006, 09:56:02 am »
first download
http://mywebpage.netscape.com/PtrPck/glutming.zip
extract files
glut.dll -> CodeBlocks bin directory
libray files -> CodeBlocks Library directory
header files -> CodeBlocks include  directory

open new console project
using  "Project->build options->linker-> link libraries ->add" add opengl32,glu32,glut32
write code and use
Code
#include <windows.h>
#include <gl\gl.h>
#include <gl\glut.h>

void init(void);
void display(void);


int main(int argc, char *argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,200);
glutCreateWindow("My First Glut/OpenGL Program");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

void init(void)
{
glClearColor(0.0f ,0.0f ,0.0f ,0.0f);
glColor3f(0.0f,0.0f,1.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)250/(GLfloat)250,0.1f,100.0f);
}

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, -10.0f);
glVertex3f(-1.0f,-1.0f, -10.0f);
glVertex3f( 1.0f,-1.0f, -10.0f);
glEnd();
glutSwapBuffers();
}

What is blue ? Blue is the invisible becoming visible.

Offline bluekid

  • Multiple posting newcomer
  • *
  • Posts: 57
  • What is blue ? Blue is the invisible becoming visi
Re: GLUT
« Reply #7 on: March 30, 2006, 07:44:33 pm »
full Glut !
- Library Files for Mingw32
- C::B Template for GLUT
- Tutorial with Example C::B projects
- glut-3.spec.pdf
- Glut-Puzzle ! - from FLTK examples-

http://derindelimavi.blogspot.com/2006/03/code-blocks-ile-glut.html
What is blue ? Blue is the invisible becoming visible.