Gallium3D programming example

I’ve been seeing a lot of posts on the web about Gallium3D, but I’m not really sure how it is working (especially Direct3D part). The only thing I understand is that if I run a Direct3D game through Wine I can get native rendering if I got supporting graphic card drivers on Linux.

What I’d like to know is how to write a simple Direct3D program in C on Linux that will use Gallium3D. I tried to google it, but found nothing.

Thank you

You don’t need to worry about Gallium. It’s an API for driver development not application development. The open-source graphics drivers like the r600 and nouveau use Gallium. As far as I know, Wine has a Direct3D implementation that’s layered on top of OpenGL so there’s no real native support.

Excuse my french, but why the hell do you want to write a Direct3D app on Linux? Of course you can and then try to run it using Wine but why would you want to? O_o

I’m just exploring possibilities of writing 3d rendering software which is OS independent.

I’m actually a great fan of OpenGL but when it comes to Windows, I get mad when trying to make it work with fragment shaders. I tried googling for a method how to get latest OpenGL 4.2 (or at least 3.2) functions to work but neither of them works actually.

When you find article about how to make it work, it usually has dozens of replies of angry people saying it doesn’t work for them…

What doesn’t work? Which hardware? What do you want to do?

Everything has "dozens of replies of angry people saying it doesn’t work for them… " That doesn’t mean it doesn’t actually work.

I’d say a good 75% of them are people who didn’t read the instructions or are otherwise following them improperly. 20% are likely people who haven’t updated their drivers or otherwise have hardware that can’t run the GL version they’re using. From there, you get maybe 5% at most who are having actual problems.

Ok … I’m not really a windows fan so I’m new at using OpenGL on windows.

I’m trying to implement something like this:

Can you then point me to a step-by-step tutorial explaining which library have to be downloaded from where with simple example compiling instructions?

I’d be very grateful.

Thank you

For GL development one of the simplest ways to use GL functionality is using some extension loader. The most popular one is GLEW which has basic usage tutorials on its website. All you need to do in addition is link to OpenGL32.lib (sort of like -lGL for g++). Note that GLEW doesn’t give any ways to create a valid GL context! What windowing toolkit do you intend to use?

I have somewhere a VC++ project where I used WGL for managing windows stuff and it worked with OpenGL 1.0 functions.

So which OpenGL32.lib should I use? The one that was included with VC++ compiler or some else?
Also which include files should I use?


So which OpenGL32.lib should I use?

There is only one. Also, have you considered looking at the Getting Started page on the OpenGL Wiki?

And what about glext.h?

I remember that most tutorials for windows were about including glext.h and then calling wglGetProcAddress to get pointers to functions above OpenGL 1.1. The problem was that wglGetProcAddress always returned NULL to me.
Is glext.h necessary when using GLEW?

wglGetProcAddress needs a valid GL context to function properly. See .

Also, if you do everything with GLEW it does everything for you. No need for gl.h, glu.h, glext.h.

Thanks for the reply.

I will try to use GLEW only. I will update on progress.

Then I could finally port my code from D3D to OpenGL and use it on Linux and Windows :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.