LWJGL
May 22, 2012, 04:43:05 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: 3D-Graphics  (Read 1417 times)
Iron
Newbie
*
Posts: 2


« on: December 08, 2009, 07:38:33 »

hey,
after searching for an hour or two on the internet, and in this forum i didn't fond what i was looking for....

so here's my question:
how can i make 3d graphics in OpenGL?

i tryed simply
Code:
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

        GL11.glPushMatrix();
        {
            GL11.glTranslatef(width/2, height/2,depth);
            GL11.glRotatef(depth, 0, 0, depth);
            GL11.glBegin(GL11.GL_QUADS);
            {
                GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glVertex3f(-50, -50f, 0);
                GL11.glColor3f(1.0f, 0.0f, 1.0f); GL11.glVertex3f(50, -50f, 0);
                GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glVertex3f(50, 50, 0);
                GL11.glColor3f(0.0f, 1.0f, 1.0f); GL11.glVertex3f(-50, 50, 0);
            }
            GL11.glEnd();
        }
        GL11.glPopMatrix();
but it didn't work... that means i could only see what was on the level 0 (z-acsis)...

hope you can help me..
Logged

Sorry for my English
kappa
Administrator
Nerdus Imperius
*****
Posts: 961



« Reply #1 on: December 08, 2009, 07:52:50 »

you have to setup a 3d view before you can start using 3d with opengl. Have a look at glOrtho, glFrustum and gluPerspective.
Logged
elias4444
Nerdus Imperius
*****
Posts: 636



WWW
« Reply #2 on: December 08, 2009, 07:57:36 »

You might want to check out the Nehe tutorials at http://nehe.gamedev.net/, or consider buying a book to help you learn OpenGL.
Logged

=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com
Iron
Newbie
*
Posts: 2


« Reply #3 on: December 08, 2009, 08:37:09 »

you have to setup a 3d view before you can start using 3d with opengl. Have a look at glOrtho, glFrustum and gluPerspective.

hmm thats what i have thougt, wrong initialisation... but i didn't find the good way anywhere....
You might want to check out the Nehe tutorials at http://nehe.gamedev.net/, or consider buying a book to help you learn OpenGL.

could you suggest me a good book, please.

so here's my init
Code:
GL11.glViewport(0, 0, disp.getWidth(), disp.getHeight());
        GL11.glMatrixMode(GL11.GL_PROJECTION);
   GL11.glLoadIdentity();
        GLU.gluOrtho2D(0, disp.getWidth(), 0, disp.getHeight());
   GL11.glMatrixMode(GL11.GL_MODELVIEW);
   GL11.glLoadIdentity();
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL11.GL_TEXTURE_2D);

i hope you can tell me how to modify it
Logged

Sorry for my English
kappa
Administrator
Nerdus Imperius
*****
Posts: 961



« Reply #4 on: December 08, 2009, 09:20:32 »

yup your view is set to 2d, grab the Red Book for Opengl http://www.glprogramming.com/red/ (google can probably find you a pdf version of it) Chapter 3 should contain all you need to know.
Logged
Evil-Devil
Prolific Timewaster
****
Posts: 268



WWW
« Reply #5 on: December 09, 2009, 08:32:16 »

@book: OpenGL Superbible is a good one. It starts with the plain basics and won't teach to much math (other books do better) and at 2/3 of the book it will switch over to shaders.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!