View Full Version : Gallium3D programming example
05-24-2012, 11:43 PM
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.
05-25-2012, 01:07 AM
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
05-25-2012, 01:56 AM
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...
05-25-2012, 02:05 AM
What doesn't work? Which hardware? What do you want to do?
05-25-2012, 02:09 AM
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.
05-25-2012, 02:24 AM
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.
05-25-2012, 04:34 AM
For GL development one of the simplest ways to use GL functionality is using some extension loader. The most popular one is GLEW (http://glew.sourceforge.net) 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?
05-25-2012, 04:42 AM
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?
05-25-2012, 05:02 AM
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 (http://www.opengl.org/wiki/Getting_started#Writing_an_OpenGL_Application)?
05-25-2012, 05:50 AM
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?
05-25-2012, 05:56 AM
wglGetProcAddress needs a valid GL context to function properly. See http://msdn.microsoft.com/en-us/library/dd374386%28v=vs.85%29.aspx .
Also, if you do everything with GLEW it does everything for you. No need for gl.h, glu.h, glext.h.
05-25-2012, 06:20 AM
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 :)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.