using opengl directly

Help with the Ecere 3D Graphics Engine: Camera, Mesh, Object, Material, OpenGL integration, etc.
Post Reply
carver413
Posts: 8
Joined: Fri Jun 18, 2010 7:44 am

using opengl directly

Post by carver413 »

I would like to know how to use opengl and other c libs directly. the current graphic system is incomplete and poorly documented and there for a poor choice to try to build a game engine off of and while there are plans to upgrade it. there are too few people working on ecere to think that this is going to happen any time soon. by having a wrapper for opengl it would be a better choice for gamers to want to use ecere to develop on. I tried to insert a few gl comands in just to see if it were possible to and I made it as far as the linker before it broke.

Linking...
debug\Untitled 2.o: In function `__ecereMethod_Test3D_OnRedraw':
Untitled 2.ec:46: error: undefined reference to `_glBegin@4'
Untitled 2.ec:48: error: undefined reference to `_glColor3f@12'
Untitled 2.ec:49: error: undefined reference to `_glVertex2f@8'
Untitled 2.ec:50: error: undefined reference to `_glColor3f@12'
Untitled 2.ec:51: error: undefined reference to `_glVertex2f@8'
Untitled 2.ec:52: error: undefined reference to `_glEnd@0'
collect2: ld returned 1 exit status

this is what I got. I know your using gl comands in the opengldisplaydriver so why wont they work elsewhere ? please help.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: using opengl directly

Post by jerome »

Hi there,

You are part right about that. There are plans to make it better. It might take some time.

However don't underestimate what you can do with the current engine...
The Mesh class is quite flexible. But you can definitely mix in OpenGL commands in. The best way to do this is to use the Ecere 3D objects such as the camera, and thus let Ecere setup all the viewport, clipping, and projection and modelview matrices (especially the projection matrix). This will make all your graphics fit in nicely with the GUI toolkit & 3D engine.

I believe there are a few samples demonstrating how to use OpenGL directly, such as

3D\OpenGL\glDemo.ec & 3D\orbitWithMouse\orbitWithMouse.ec

The way to do this is quite simple. From your output (linker errors) it looks like you have not added the OpenGL library to your project settings. In Project, Settings, Linker tab, Additional Libraries, just add 'opengl32'. That should do it.

Let me know if you have any other questions.
carver413
Posts: 8
Joined: Fri Jun 18, 2010 7:44 am

Re: using opengl directly

Post by carver413 »

thankyou very much and I'll check out those samples I must have overlook them. as far as missing features there are many rendering options like rayshaders, terrain maps, partical generators, and I'm sure the list goes on and on. while some of these things won't be a big deal at first I want to know that they can infact be done on ecere before I spend a year or two perfecting my engine. besides that most of the tutorials are done in opengl so it would be the easiest path to follow.
thanks again Rob
carver413
Posts: 8
Joined: Fri Jun 18, 2010 7:44 am

Re: using opengl directly

Post by carver413 »

ok I figured out why I haven't tried any of the other examples in the latest release. ecere won't let me open them. perhaps because the version change? is that version compliable with windows ?
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: using opengl directly

Post by jerome »

Yes you need to build the latest release from the source code and install it.

If you have the previous version installed, doing 'make' inside the extracted package directory, followed by 'make install' (Assuming you are an Administrator) should update to the new version. You will also need to rename C:\Program Files\Ecere SDK\mingw\bin\make.exe to mingw32-make.exe for the IDE to be able to build projects.

You should then be able to run the new samples.

Sorry about the inconvenience. We're trying to wrap up the next release which should come with an installer as well.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: using opengl directly

Post by jerome »

As far as completeness support is concerned, the Ecere 3D engine, through the Mesh and Display objects, offers some fairly low level functionality which can be used to render all the basic OpenGL primitives. One of the advantage is that it will also run on top of Direct3D as well.

But there are some limitations, it does not cover the entire OpenGL API. You can work around that by using OpenGL calls directly for those particular purposes.
Post Reply