LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-20-2009, 05:48 AM   #1
jamwaffles
Member
 
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131

Rep: Reputation: 19
glPointPerameterf glext libs and OpenGL


hello all

i am writing a particle engine in C++/OpenGL and i am using point sprites (oooh clever). everythign works fine, but i can't get the attenuation (particles vary in size according to distance from camera) to work. As far as i can gather i need glext to use the extensions contained within that library. i have included it and i have linked to it from my Makefile with the flag -lglext to no avail. i have looked in /usr/include/GL and glext is there with the stuff i need in it, but i have looked in /usr/lib and there is no libglext or anything like it. maybe i should post this on a linux forum, but if youre reading this its too late :P.

in short, how can i get point sprite attenuation to work. thankyou to any replies, helpful, funny or just plain annoying, as there is NO documentation on this.

another thing, in this closed post http://www.gamedev.net/community/for...opic_id=403529 it talks about this, but there is no evidence of an extension library being used. can enyone enlighten me? all the same problem really

james waples, 14
 
Old 02-21-2009, 07:44 AM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Afaik opengl extensions don't have a library, only header file. If extension is supported by your driver, then function is declared within opengl library (-lopengl), without separate library.
If you want to be able to use extensions easily (and want code to be portable to windows), you should use ether GLEE or GLEW. However, you can work without them - you simply need to #include glext.h AND #define corresponding GL_VERSION level before that include. This is not portable and won't work on Windows(because OpenGL support on windows is crap - by default windows libopengl library (or opengl32.lib) has support for OpenGL 1.1 functions only(which is problem) - so you won't get anywhere without extension library on windows - you'll need to do a lot of wglGetProcAddress calls(you can see that in exapmle)).

Note that glPointParameter is part of OpenGL standard since version 1.4 and normally (on linux) don't need extension. To use it on linux either use
Code:
#define GL_VERSION_1_4
#include <GL/glext.h>
and link to libopengl.
or use glee or glew library (see which has better license).
Either of them won't work if your videocard/driver doesn't support OpenGL 1.4 or corresponding extension.

Personally, I prefer "billboards" (camera aligned squares with textures - using shaders(which is better) or manually(which is slower)) to pointsprites, because point-spirtes has maximum size limitation, there will be a trouble if you change camera FOV (you'll need to recalculate attenuation), you can't rotate them (clockwise/counterclockwise) and when I worked with pointsprites last time (few years ago, on DirectX) ATI cards (Radeon 9000 at that time) had buggy pointsprite support so they didn't support attenutations at all with certain techniques. Also, you don't need extensions to create billboards - every card with texturing support will do.

On other hand, managing pointsprites is easier and you can get rid of attenuations by writing vertex shader which will calculate point size according to current projection matrix, point size and position. Unfortunately I haven't done that in OpenGL, so I simply don't remember if pointsize is available within shader (in OpenGL) and can be changed by shader or not. Also, although such shader is possible, it won't solve all possible problems with pointsprites - AFAIK pointsprite is always square which can be a problem. Also, GLSL (shader language) requires OpenGL 2.0 or 1.5 with extensions, which can be too much for basic application.

In short - if you want to use GL extensions in easy/portable way - use either GLEE or GLEW library.

Last edited by ErV; 02-21-2009 at 08:27 AM.
 
Old 02-22-2009, 05:31 AM   #3
jamwaffles
Member
 
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131

Original Poster
Rep: Reputation: 19
i have managed to get everything working with GLee - someone on GameDev.net pointed it out to me. your point with point sprites (pun intended) exactly what i have done, although i am thinking about looking into shaders. thankyou for your time and help

james
 
  


Reply

Tags
c++, opengl, point, sprites


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
opengl window not having title bar-using freeglut for opengl programming in c++ ashjas Fedora 0 01-19-2008 02:46 AM
link-time libs need to be run0time libs says curl's make install UniquelyAm Linux - Software 0 06-09-2007 01:40 AM
OpenGL libs missing? bertNernie Programming 4 02-12-2006 06:17 AM
Overwrite Mesa OpenGL with ATI OpenGL Carl-Fredrik Slackware 12 10-01-2004 03:33 PM
Where would one go to acquire OpenGL devel libs? Baldorg Linux - Software 1 12-05-2003 09:33 PM


All times are GMT -5. The time now is 05:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration