Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Load 3D Texture: SDL/OpenGL on Linux Eclipse(Load 3D Texture: SDL/OpenGL on Linux Eclipse)
icon3.gif  Load 3D Texture: SDL/OpenGL on Linux Eclipse [message #697133] Fri, 15 July 2011 15:50 Go to next message
threaderslash  is currently offline threaderslash Friend
Messages: 4
Registered: September 2009
Junior Member
There is a strange issue with Eclipse and SDL textures in C OpenGL programming on FC15. Shocked

For set-up test purpose, the NeHe example code is used - lesson07.

The program runs and loads the texture if we run it on console with

$ make
$ ./lesson07

-- therefore, all the environment required libs are installed and present in the linux development environment. However, if we try to do the same on IDE Eclipse, the program runs, but no texture is loaded, so we can only see a white box with no texture on it.

The setup for the project environment has the libs into the Linker Libraries(L), such as SDL, SDLmain, SDL_image, GL, GLU, etc -- e.g.: OpenGL and GLUT in Eclipse on OS X.

Programs with SDL works fine for input with keyboard etc. However, the texture does not load.

In the Makefile provided from NeHe that is used run the command line in the console, I noticed the following info:

CC = gcc -Wall -ansi
all:
$(CC) lesson07.c -o lesson07 -lGL -lGLU `sdl-config --cflags --libs`

Then, reading the Makefile that is generated automatically on IDE Eclipse, I observed that apparently this additional flag is missing: sdl-config --cflags --libs. Should be this additional flag what is preventing the command SDL_LoadBMP to display the texture?

If so, some suggestion about how to properly tune this additional info for the Eclipse's settings to allow the generated IDE Makefile to work properly?

All comments are highly appreciated. Very Happy
Re: Load 3D Texture: SDL/OpenGL on Linux Eclipse [message #697396 is a reply to message #697133] Sat, 16 July 2011 15:09 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
On 07/15/2011 10:50 AM, threaderslash wrote:
> There is a strange issue with Eclipse and SDL textures in C OpenGL
> programming on FC15. 8o
> For set-up test purpose, the NeHe example code is used - lesson07.
>
> The program runs and loads the texture if we run it on console with
>
> $ make
> $ ./lesson07
> -- therefore, all the environment required libs are installed and
> present in the linux development environment. However, if we try to do
> the same on IDE Eclipse, the program runs, but no texture is loaded, so
> we can only see a white box with no texture on it.
>
> The setup for the project environment has the libs into the Linker
> Libraries(L), such as SDL, SDLmain, SDL_image, GL, GLU, etc -- e.g.:
> OpenGL and GLUT in Eclipse on OS X.
>
> Programs with SDL works fine for input with keyboard etc. However, the
> texture does not load.
>
> In the Makefile provided from NeHe that is used run the command line in
> the console, I noticed the following info:
>
> CC = gcc -Wall -ansi
> all:
> $(CC) lesson07.c -o lesson07 -lGL -lGLU `sdl-config --cflags --libs`
>
> Then, reading the Makefile that is generated automatically on IDE
> Eclipse, I observed that apparently this additional flag is missing:
> sdl-config --cflags --libs. Should be this additional flag what is
> preventing the command SDL_LoadBMP to display the texture?
>
> If so, some suggestion about how to properly tune this additional info
> for the Eclipse's settings to allow the generated IDE Makefile to work
> properly?
>
> All comments are highly appreciated. :d
If the texture is loaded from a file, then the problem could be a path
issue. If the program is using a relative path to locate the texture
file, then the working directory where the executable is run is very
important. On the launch config in Eclipse, you can set the working
directory on the Arguments tab.
Re: Load 3D Texture: SDL/OpenGL on Linux Eclipse [message #697397 is a reply to message #697133] Sat, 16 July 2011 15:09 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
On 07/15/2011 10:50 AM, threaderslash wrote:
> There is a strange issue with Eclipse and SDL textures in C OpenGL
> programming on FC15. 8o
> For set-up test purpose, the NeHe example code is used - lesson07.
>
> The program runs and loads the texture if we run it on console with
>
> $ make
> $ ./lesson07
> -- therefore, all the environment required libs are installed and
> present in the linux development environment. However, if we try to do
> the same on IDE Eclipse, the program runs, but no texture is loaded, so
> we can only see a white box with no texture on it.
>
> The setup for the project environment has the libs into the Linker
> Libraries(L), such as SDL, SDLmain, SDL_image, GL, GLU, etc -- e.g.:
> OpenGL and GLUT in Eclipse on OS X.
>
> Programs with SDL works fine for input with keyboard etc. However, the
> texture does not load.
>
> In the Makefile provided from NeHe that is used run the command line in
> the console, I noticed the following info:
>
> CC = gcc -Wall -ansi
> all:
> $(CC) lesson07.c -o lesson07 -lGL -lGLU `sdl-config --cflags --libs`
>
> Then, reading the Makefile that is generated automatically on IDE
> Eclipse, I observed that apparently this additional flag is missing:
> sdl-config --cflags --libs. Should be this additional flag what is
> preventing the command SDL_LoadBMP to display the texture?
>
> If so, some suggestion about how to properly tune this additional info
> for the Eclipse's settings to allow the generated IDE Makefile to work
> properly?
>
> All comments are highly appreciated. :d
If the texture is loaded from a file, then the problem could be a path
issue. If the program is using a relative path to locate the texture
file, then the working directory where the executable is run is very
important. On the launch config in Eclipse, you can set the working
directory on the Arguments tab.
icon3.gif  Re: Load 3D Texture: SDL/OpenGL on Linux Eclipse [message #697846 is a reply to message #697397] Mon, 18 July 2011 07:56 Go to previous message
threaderslash  is currently offline threaderslash Friend
Messages: 4
Registered: September 2009
Junior Member
Here is the solution -- (thanks datenwolf!): Very Happy
stackoverflow.com/questions/6709258/load-3d-texture-sdl-opengl-on-linux-eclipse
If running the program on command line, the texture file must be in the same folder as the executable file. But if running on IDE Eclipse, by default it must be located in the root folder of the project, e.g. lesson07/data/crate.bmp, while the executable will be in the Debug folder - lesson07/Debug/lesson07.exe .

Hope this can be useful for others too.
Previous Topic:Generated resource conflict: two resources of the same name
Next Topic:Configuration Help Needed
Goto Forum:
  


Current Time: Fri Mar 29 04:39:15 GMT 2024

Powered by FUDForum. Page generated in 0.02939 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top