orangeduck / Corange

Pure C Game Engine
http://www.youtube.com/watch?v=482GxqTWXtA
Other
1.82k stars 199 forks source link

Compile issues Ubuntu #2

Closed RicoP closed 12 years ago

RicoP commented 12 years ago

Unfortunately I have several issues compiling and executing the demos under Ubuntu:

lut_gen:
make cp ../../libcorange.so ./lib/libcorange.a gcc -g obj/lut_gen.o obj/spline.o -L./lib -lcorange -lGL -lSDLmain -lSDL -o lut_gen obj/lut_gen.o: file not recognized: File format not recognized collect2: ld returned 1 exit status make: *\ [lut_gen] Error 1

metaballs: make cp ../../libcorange.so ./lib/libcorange.a gcc -g obj/kernel.o obj/marching_cubes.o obj/metaballs.o obj/particles.o obj/volume_renderer.o -L./lib -lcorange -lGL -lSDLmain -lSDL -lOpenCL -o metaballs /usr/bin/ld: cannot find -lOpenCL collect2: ld returned 1 exit status make: *\ [metaballs] Error 1

noise: make cp ../../libcorange.so ./lib/libcorange.a gcc -g obj/noise.o obj/perlin_noise.o -L./lib -lcorange -lGL -lSDLmain -lSDL -o noise /usr/bin/ld: i386:x86-64 architecture of input file obj/noise.o' is incompatible with i386 output /usr/bin/ld: i386:x86-64 architecture of input fileobj/perlin_noise.o' is incompatible with i386 output collect2: ld returned 1 exit status make: *\ [noise] Error 1

I can compile platformers, renderers, scotland and sea but when I execute them I get these messages: [DEBUG] Starting Corange... [DEBUG] Creating Graphics Manager... [DEBUG] OpenGL Info [DEBUG] Vendor: NVIDIA Corporation [DEBUG] Renderer: GeForce 9200M GE/PCI/SSE2 [DEBUG] Version: 2.1.2 NVIDIA 173.14.30 [DEBUG] Shader Version: 1.20 NVIDIA via Cg compiler [DEBUG] Loading OpenGL Extensions... [ERROR] src/SDL/SDL_local.c:572 Failed to load OpenGL extension glGenerateMipmap

orangeduck commented 12 years ago

Hey,

Thanks for the report!

For "noise" and "lut_gen" you should try running "make clean" first, then they should compiled okay. The issue is that it is trying to link to the object files I've built and commited from windows. I'll push a commit to the repo which removes them.

"metaballs" requires OpenCL to be installed. Take a look trying to find at a download for your CPU or GPU vendor.

As for the other demos basically the issue is that for some reason it can't find the OpenGL function glGenerateMipmap. This is an extension but your graphics card sounds like it is good enough. Are you running a Netbook of some kind? Perhaps you only have OpenGL ES or something like that.

In graphics_manager.c try adding a call to "SDL_GL_PrintExtensions()" in "graphics_manager_init()" just before "SDL_GL_LoadExtensions()".

Recompile Corange and one of the demos and tell me what the output is :)

jeffrimko commented 12 years ago

Hi, I get the glGenerateMipmap error also. I'm running Windows 7 Home Premium 64-bit on a HP laptop. Everything compiles fine using MinGW. Trying to run the Scotland demo produces the following:

[DEBUG] Starting Corange...
[DEBUG] Creating Graphics Manager...
[DEBUG] OpenGL Info
[DEBUG] Vendor: Intel
[DEBUG] Renderer: Intel(R) Graphics Media Accelerator HD
[DEBUG] Version: 2.1.0 - Build 8.15.10.2082
[DEBUG] Shader Version: 1.20  - Intel Build 8.15.10.2082
[DEBUG] Loading OpenGL Extensions...
[ERROR] (src/SDL/SDL_local.c:572) Failed to load OpenGL extension glGenerateMipmap
jeffrimko commented 12 years ago

Looked into this a bit more, glGenerateMipmap is a part of the GL_ARB_framebuffer_object extension. I used GLEW to confirm that I did not have this extension. Luckily, the latest drivers for the Intel Media HD device included support for this extension. If a driver update does not help, I'm not sure how you'd go about fixing this issue.

orangeduck commented 12 years ago

Hi,

With the driver update did GLEW report that you now had the extension or did it still report that it was missing?

Perhaps on some cards the extension function still goes under a different name such as glGenerateMipmapEXT or glGenerateMipmapARB.

When loading extensions I think I will try to add in checking so that if it doesn't find the function name it appends on EXT or ARB and tries again. Also I will make it so that it only throws a warning, means that you should still be able to run any demo which doesn't actually use that command.

Thanks for the report,

Dan

orangeduck commented 12 years ago

Take a look at the most recent commit. See if that helps at all and if not post the output. If not I'll have to take a deeper look into GLEW to see how it handles such a thing.

RicoP commented 12 years ago

Now it works fine! However I had to fix a small issue in one shader in order to make everything run.

ad41313ed726911773e69e557d5b6a964de5e59f

My Graphics card is a little bit more picky about types...

orangeduck commented 12 years ago

Fantastic! OpenGL is really a pain because of the run-time extension loading and shader compiling, but thanks for the reports!

RicoP commented 12 years ago

You are welcome. I am a beginner with OpenGL and I also run in this issues all the time.