FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GL Extension usage in Derelict2

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
voxel



Joined: 26 Nov 2010
Posts: 9

PostPosted: Fri Nov 26, 2010 9:12 am    Post subject: GL Extension usage in Derelict2 Reply with quote

Hi!

First of all, sorry for my basic question. Embarassed I use Derelict 1 over 2 years and now I decided to change to Derelict 2. I successfully compiled the latest Derelict 2 with dmd2 and tested it with a basic program. It worked again.

Now I am trying to compile my 3D Engine written with Derelict 1 and I cannot solve some compiler issue with GL extensions. Some of my errors:

Code:
Error: undefined identifier glGenFramebuffersEXT
Error: undefined identifier GL_FRAMEBUFFER_EXT
Error: undefined identifier glActiveTextureARB
...



I try to use extensions like before in D1:

Code:
// create fbo and attach texture to it
glGenFramebuffersEXT (1, &m_sShadowMap.shadow_fb);



I tried to import these modules, but nothing happens
Crying or Very sad. My imports were:

Code:
import derelict.opengl.glext;
import derelict.opengl.exttypes;
import derelict.opengl.extloader;
import derelict.opengl.extfuncs;


What do am I wrong? I missed some other imports? My platform is Windows7 using Code::Blocks.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Fri Nov 26, 2010 9:22 pm    Post subject: Re: GL Extension usage in Derelict2 Reply with quote

voxel wrote:

What do am I wrong?


That's hard to say. You're fine with the imports, but you really only need to import the glext module. It publicly imports exttypes and extfuncs. The extloader module is used internally, so you don't need it.

The only thing I can think of that would cause those errors is if you were compiling the Derelict libraries somehow without using the provided makefiles or DSSS. Is that the case?
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
voxel



Joined: 26 Nov 2010
Posts: 9

PostPosted: Sat Nov 27, 2010 5:28 am    Post subject: Reply with quote

No...unfortunatelly no. I build derelict2 based on documentation:

Code:
make -fwin32.mak DC=dmd


First I tried to build the latest release from svn with dmd 2.050. But it did not compiled and gived some errors. After I went back to dmd 2.047, and it compiled successfully.

I was really happy because compiling was more easy using only the makefiles.
After the libs were ready, I copied them to codeblocks lib directory.
And I copied the derelict2 includes in the phobos directory to C:\dmd2\src\phobos.

I am sure the problem is in my system. I will try to delete everything and reinstall the dmd2 and derelict2.
Back to top
View user's profile Send private message
voxel



Joined: 26 Nov 2010
Posts: 9

PostPosted: Sat Nov 27, 2010 10:55 am    Post subject: Reply with quote

I have reinstalled everyhing. Deleted dmd2 from C:\ and Derelict2. I downloaded dmd2 v0.049 and the latest Derelict2 from svn, and the latest DSSS. There were no errors or warings at building Derelict2.

The compilation error is the same, cannot solve it either building Derelict2 with DSSS or dmd2.

My simple code is:

Code:
import derelict.opengl.gl;
import derelict.opengl.glext;

void main()
{
    DerelictGL.load();
    uint b;
    glGenFramebuffersEXT(1, &b);   
    // or using
   glActiveTextureARB(1);
}


Compilation errors:

Code:
Error: undefined identifier glGenFramebuffersEXT
Error: undefined identifier glActiveTextureARB


But GL without extensions compiles:

Code:
import derelict.opengl.gl;
void main()
{
    DerelictGL.load();
    glBegin(GL_TRIANGLES);
}


It is a quite an interesting problem. Maybe my system generates incorrect Derelict2 import files during Derelict2 building?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Nov 28, 2010 12:05 am    Post subject: Reply with quote

voxel wrote:
I have reinstalled everyhing. Deleted dmd2 from C:\ and Derelict2. I downloaded dmd2 v0.049 and the latest Derelict2 from svn, and the latest DSSS. There were no errors or warings at building Derelict2.


I checked in a fix some days ago that fixed broken compilation with 2.050, so you should be able to use it with the latest svn you pulled down.

Quote:

The compilation error is the same, cannot solve it either building Derelict2 with DSSS or dmd2.


I'll check into this when I get back home in a few hours and see if I can reproduce it.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
voxel



Joined: 26 Nov 2010
Posts: 9

PostPosted: Sun Nov 28, 2010 2:50 am    Post subject: Reply with quote

Thanks Aldacron!

Here are some information, maybe usefull for you:

My system: Hungarian Windows7 Ultra edition
DMD2 install: C:\dmd2
I put it (c:\dmd2\windows\bin\) into my PATH.

IDE: Codeblocks in D:\Prog\CodeBlocks\
Derelict2: latest from svn in D:\Prog\Dlanguage\Derelict2\

After I compiled Derelict2, I added lib and import directories to Codeblocks project.

I tied with an another IDE, with D-IDE, but erros are the same. Crying or Very sad

Morover I tried Derelict1 latest with dmd1 latest and it worked fine.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Nov 28, 2010 5:15 am    Post subject: Reply with quote

OK. I see what the problem is now. The problem has to do with version statements and string mixins. I have a couple of options to fix it, but I need to think about which way I want to go. As a temporary workaround, you'll need to add -version=DerelictGL_EXT and -version=DerelictGL_ARB to your command line when compiling your app. That should eliminate the errors you're seeing.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Nov 28, 2010 5:36 am    Post subject: Reply with quote

Well, actually I suppose string mixins have nothing to with it. And when I think it about it, this is how version statements have always worked. I've just never noticed it before.

What's happening is that some time ago I split the extensions into version blocks based on extension families. DerelictGL_EXT for all GL_EXT funcitons, DerelictGL_ARB for all GL_ARB functions, DerelictGL_NV for all GL_NV functions, and so on. I figured EXT, ARB, NV, ATI, and AMD would be the most commonly required extension families, so in the makefile I turn those on by default. The rest aren't visible. This is, of course, configurable.

I thought this would be a good thing, particularly once I get around to documenting it. But I never considered that when the library is built with specific version statements, the final executable has to be built with them, too. Otherwise, when compiling the app, the versioned code from the imported Derelict modules will never be seen, since the compiler has no knowledge of which versions were used to compile the library.

So if I continue with this approach, anyone using OpenGL extensions will have to always add the appropriate versions to their command line when building. That goes against my requirement that Derelict annoy the user as little as possible. I would certainly be annoyed if I had to do that. So for now, I've turned all extensions on (DerelictGL_ALL) in the source modules rather than in the makefile. So if you do a fresh checkout, everything should compile fine without specifying any versions on the command line.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
voxel



Joined: 26 Nov 2010
Posts: 9

PostPosted: Sun Nov 28, 2010 7:04 am    Post subject: Reply with quote

Thank you Aldacron, I updated to the latest Derelict2.
Now my code compiles successfully, without any "undefined identifier" error.
Very Happy

I used Derelict1 for over 2 years before and think Derelict is a very very good stuff for the D community. I hope you will continue this great work and maintain the library for a long time.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Nov 28, 2010 8:25 am    Post subject: Reply with quote

voxel wrote:
Thank you Aldacron, I updated to the latest Derelict2.
Now my code compiles successfully, without any "undefined identifier" error.
Very Happy


You're welcome!

Quote:

I used Derelict1 for over 2 years before and think Derelict is a very very good stuff for the D community. I hope you will continue this great work and maintain the library for a long time.


Thank you!
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Tue Nov 30, 2010 12:46 pm    Post subject: Reply with quote

If Derelict is built with DerelictGL_ALL can't the application then be built with a more specialized version like DerelictGL_ARB?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Tue Nov 30, 2010 9:08 pm    Post subject: Reply with quote

Sure. But my main motivation was to reduce the compile time of DerelictGL. Ultimately, the difference is negligible. So it doesn't really matter.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group