
-----------------------------------
Thuged_Out_G
Tue Mar 23, 2004 5:45 pm

openGL
-----------------------------------
how much expereince do you need with C++ do get into openGl?
is it a difficult langauge to use?

could someone possibly post some openGl code just so i can see what it looks like. 

for some reason, i dont think it will be as easy as Draw.FillBox(x,y,x1,y1,clr)  :o

-----------------------------------
tinhnho
Tue Mar 23, 2004 6:32 pm


-----------------------------------
It's hard to say that it easy or not.It's depend on peoples.here is some code for openGL:


#ifdef unix		      
#include 	  
#include "aux.h"	  
#define CALLBACK	  
#else
#include
#include
#include
#endif

GLdouble vertex[][3]={
	{0.0,0.0,0.0},
	{1.0,0.0,0.0},
	{1.0,1.0,0.0},
	{0.0,1.0,0.0},
	{0.0,0.0,1.0},
	{1.0,0.0,1.0},
	{1.0,1.0,1.0},
	{0.0,1.0,1.0}
};

int edge[][2]={
	{0,1},
	{1,2},
	{2,3},
	{0,3},
	{4,5},
	{5,6},
	{6,7},
	{7,4},
	{0,4},
	{1,5},
	{2,6},
	{3,7}
};

GLvoid CALLBACK none(void)
{
}

GLvoid CALLBACK draw(void)
{
	int i;
	static int r=0;

	glClearColor(0.0,0.0,0.0,0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glLoadIdentity();
	gluLookAt(3.0,4.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
	glRotated((double)r,0.0,1.0,0.0);

	glColor3d(1.0,1.0,1.0);
	glBegin(GL_LINES);
	for(i=0;i=360) r=0;
}

GLvoid CALLBACK resize(GLsizei w,GLsizei h)
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glViewport(0,0,w,h);
	gluPerspective(30.0,1.0,1.0,10.0);
	glMatrixMode(GL_MODELVIEW);
}
	
int main(int argc, char *argv[])
{
	auxInitPosition(200,100,512,512);
	auxInitDisplayMode(AUX_RGBA);
	auxInitWindow(argv[0]);
	auxReshapeFunc(resize);
	auxIdleFunc(draw);
	auxMainLoop(none);
	return 0;
}

-----------------------------------
Catalyst
Tue Mar 23, 2004 6:33 pm


-----------------------------------
once u get past setting up the window opengl isnt very difficult to use

some example code that draws an orange rectangle

   glColor3f (1,1,0);//Red,green,blue
   glBegin (GL_QUADS);//Draw Quads
      glVertex3f (-0.5,+0.5,-1);//Each corner
      glVertex3f (-0.5,-0.5,-1);
      glVertex3f (+0.5,-0.5,-1);
      glVertex3f (+0.5,+0.5,-1);
   glEnd();


There is a lot (and i mean a lot) more stuff in ogl (e.g. Matrices,Textures,Vertex Arrays, Depth-buffers,extensions,etc)

note: posted at the same time

-----------------------------------
Thuged_Out_G
Tue Mar 23, 2004 7:08 pm


-----------------------------------
woah....i was reading the tut on nehe.gamedev about opening a window....it was like 350 lines of code just to open a window with a black background....i think ill just stick with C++ for the time being...since i just started with it...umm, lets see...yesterday :D haha

-----------------------------------
Mazer
Tue Mar 23, 2004 8:23 pm


-----------------------------------
Try printint out the window lesson and reading it over a few times every once in a while when you're bored and you'll see that it isn't that difficult. It isn't something you have to write often when you're making a game, it's just a bit fugly the first time you see it. If you really don't like the window creation code you can check out [url=http://www.xmission.com/~nate/glut.html]GLUT which allows you to create a window in a few simple lines and get straight into the OpenGL right away. You'll see that OpenGL really isn't that difficult compared to turing's draw commands, it's just the way you need to use them.

EDIT: Although, having one day's experience with C++ may have some factor in this.  :wink: 
Play around with C++ more and when you feel ready jump back into the nehe tutorials, they're quite nice.

-----------------------------------
Catalyst
Tue Mar 23, 2004 8:32 pm


-----------------------------------
once you are ready (give it a little bit of time)
try SDL it also simplifies window creation and input 
and is cross-platform :D

-----------------------------------
Thuged_Out_G
Tue Mar 23, 2004 10:33 pm


-----------------------------------
i wasnt planning on jumping right into oGL ..i just wanted to see what it was all about. and try to gain a bit of an understanding of it. but just the opening a window code, kidna blew me away haha

-----------------------------------
rizzix
Fri Mar 26, 2004 10:33 am


-----------------------------------
woah....i was reading the tut on nehe.gamedev about opening a window....it was like 350 lines of code just to open a window with a black background....i think ill just stick with C++ for the time being...since i just started with it...umm, lets see...yesterday :D haha

u can use the GLUT to speed things up.. this way u can concentrate only on OpenGL
