OpenGL - Nerds Needed
Moderator: Dust
- MindyMcfly
- Die-Harder
- Posts: 4283
- Joined: 17 Dec 2007 19:47
- Location: Nottingham, Midlands - Go Robin Hood!
- Contact:
OpenGL - Nerds Needed
Ok, so my quest to learn C++ is going slow but ok, I have been playing with openGL and SDL, however I cant get my head into using the modern versions of openGL.
I know I need a dev kit 2.1 onwards, anyone help with what I need/is best?
I know I need a dev kit 2.1 onwards, anyone help with what I need/is best?
----------------------------------------
GM of Real-Life™
(\__/)
(='.'=)
(")_(")
GM of Real-Life™
(\__/)
(='.'=)
(")_(")
- Tiel
- Die-hard
- Posts: 2154
- Joined: 01 Jan 1970 01:00
- Location: Utrecht, Netherlands
- Contact:
Re: OpenGL - Nerds Needed
Wish I could help, but I haven't touched any openGL libraries in 12 years or soMindyMcfly wrote:Ok, so my quest to learn C++ is going slow but ok, I have been playing with openGL and SDL, however I cant get my head into using the modern versions of openGL.
I know I need a dev kit 2.1 onwards, anyone help with what I need/is best?
A colleague of mine talked about it and said it was a real pain these days to get it running on a Windows development environment. Like Microsoft is almost deliberately making it impossible.
I'm sure there are lots of people with the same problem, there have to be some how-to's out there.
- Dust
- The Boss
- Posts: 9093
- Joined: 01 Jan 1970 01:00
- Contact:
Re: OpenGL - Nerds Needed
The Modern OpenGL is really low level. To make proper use of it, you really need to know computer graphics algorithms, linear algebra and so on (because you get to write those yourself in GLSL :)
On windows, you also need a binder library like GLEW (which is what we use at work), since Microsoft is stuck two decades ago with OpenGL 1.1 or so. To make use of such a binder you also need to have OpenGL drivers from your graphics card vendor with OpenGL support.
It's easier to get running on OS X of course :)
If you want to play around, GLUT will do, but if you want to make something useful, consider using Qt (if you use C++ that is), it has a nice platform independent API and strong OpenGL support. Or you could take a look at that new WebGL stuff. Maybe it's easier to get started since it runs in a web browser... never tried that myself though.
On windows, you also need a binder library like GLEW (which is what we use at work), since Microsoft is stuck two decades ago with OpenGL 1.1 or so. To make use of such a binder you also need to have OpenGL drivers from your graphics card vendor with OpenGL support.
It's easier to get running on OS X of course :)
If you want to play around, GLUT will do, but if you want to make something useful, consider using Qt (if you use C++ that is), it has a nice platform independent API and strong OpenGL support. Or you could take a look at that new WebGL stuff. Maybe it's easier to get started since it runs in a web browser... never tried that myself though.
I do what I think is right. But I don't think that what I think is right can not be wrong.
- Tiel
- Die-hard
- Posts: 2154
- Joined: 01 Jan 1970 01:00
- Location: Utrecht, Netherlands
- Contact:
Re: OpenGL - Nerds Needed
Depends what you're building. WebGL has lots of potential and a lot of power, and performance might even come very close to native OpenGL. I believe the instructions to be sent directly to the GPU in the latest browsers, so performance might even be at equal speeds. You do need significant JavaScript knowledge, but it isn't that complicated.
Browser support is pretty good, in Firefox, Chrome and Opera you'll be fine, but IE only gets (some) support in version 11 which isn't out yet (bundled with Windows 8.1 afaik). Then again, your users might be smart enough to use a proper browser and ditch IE. It depends on what you're making and the type of your users.
So, what are you making? Or just playing around? And why?
Browser support is pretty good, in Firefox, Chrome and Opera you'll be fine, but IE only gets (some) support in version 11 which isn't out yet (bundled with Windows 8.1 afaik). Then again, your users might be smart enough to use a proper browser and ditch IE. It depends on what you're making and the type of your users.
So, what are you making? Or just playing around? And why?
- MindyMcfly
- Die-Harder
- Posts: 4283
- Joined: 17 Dec 2007 19:47
- Location: Nottingham, Midlands - Go Robin Hood!
- Contact:
Re: OpenGL - Nerds Needed
Currently using openGL with SDL which is openGL 2.1 so thats ok for me for now. Dont like the glut system too much. Just wondered the best way to get speed out of rendering it out. Im not that advanced but upto looking at build lists... lol (my poor head).
#include <iostream>
#include <conio.h>
#include <gl\freeglut.h>
using namespace std;
bool running = true;
float angle = 0.0;
float RotationSpeed =0.01;
float potx = 0;
float poty = 0;
float potz = 1;
float potspeed = 0.05;
char input;
void init(void)
{
GLfloat mat_specular[] = { 2.0, 1.0, 2.0, 1.0 };
GLfloat mat_shininess[] = { 65.0};
GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
}
void keyboard(unsigned char Key, int x, int y)
{
switch (Key)
{
case 'a': potx=potx-potspeed; break;
case 'd': potx=potx+potspeed; break;
case 'w': poty=poty+potspeed; break;
case 's': poty=poty-potspeed; break;
case 'q': RotationSpeed=RotationSpeed+.01; break;
case 'e': RotationSpeed=RotationSpeed-.01; break;
case 'z': potz=potz+potspeed; break;
case 'x': potz=potz-potspeed; break;
case ' ': RotationSpeed=0.0; break;
break;
}
}
void onidle(void)
{
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(potx,poty,1);
glRotatef(angle,1.0,1.0,1.0);
glScalef(potz,potz,potz);
glutWireSphere(1.0, 20, 16);
glColor3f(0.065,0.050,1.0);
glutSolidTeapot(1);
glPopMatrix();
glFlush();
glutPostRedisplay();
angle += RotationSpeed;
if(angle > 360)
angle -= 360;
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
gluPerspective(45.0, (double)1300/(double)760, 1000.0, 1.0);
glLoadIdentity();
if (w <= h)
glOrtho (-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
1.5*(GLfloat)h/(GLfloat)w, -10.0, 1000.0);
else
glOrtho (-1.5*(GLfloat)w/(GLfloat)h,
1.5*(GLfloat)w/(GLfloat)h, -1.5, 1.5, -10.0, 1000.0);
//glOrtho or glFrustum?
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutIdleFunc (onidle);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
while (running){
glutMainLoopEvent();
}
return 0;
}
----------------------------------------
GM of Real-Life™
(\__/)
(='.'=)
(")_(")
GM of Real-Life™
(\__/)
(='.'=)
(")_(")
- Dust
- The Boss
- Posts: 9093
- Joined: 01 Jan 1970 01:00
- Contact:
Re: OpenGL - Nerds Needed
You should never use \ in #include paths, this is actually illegal.
Display Lists are not deprecated, along with the whole of immediate mode, and fixed function pipeline. So no shade model, no material, no lighting, no push matrix, rotate, scale or other matrix command.
These days, programmers are supposed to write their own vertex shaders (for projection and other transformations in 3D space), and fragment shaders (for pixel level transformations such as texturing, lighting and so on. Instead of display lists, VBOs are used to stream data into the shaders.
Display Lists are not deprecated, along with the whole of immediate mode, and fixed function pipeline. So no shade model, no material, no lighting, no push matrix, rotate, scale or other matrix command.
These days, programmers are supposed to write their own vertex shaders (for projection and other transformations in 3D space), and fragment shaders (for pixel level transformations such as texturing, lighting and so on. Instead of display lists, VBOs are used to stream data into the shaders.
I do what I think is right. But I don't think that what I think is right can not be wrong.
- Ixora
- Posts: 367
- Joined: 01 Jan 1970 01:00
- Contact:
Re: OpenGL - Nerds Needed
Mindy, you can look at this online book: http://arcsynthesis.org/gltut/
It is a quite good modern OpenGL tutorial.
It is a quite good modern OpenGL tutorial.
Frozen by The Frozen Throne.
- MindyMcfly
- Die-Harder
- Posts: 4283
- Joined: 17 Dec 2007 19:47
- Location: Nottingham, Midlands - Go Robin Hood!
- Contact:
Re: OpenGL - Nerds Needed
Woah, that quite a lot of difference but makes some sense. Its a shame its people constantly reinventing the wheel when all you want is a textured quad
Ill keep plugging away but that's a great resource, thank you
Ill keep plugging away but that's a great resource, thank you
----------------------------------------
GM of Real-Life™
(\__/)
(='.'=)
(")_(")
GM of Real-Life™
(\__/)
(='.'=)
(")_(")
Who is online
Users browsing this forum: No registered users and 3 guests