0

I'm working on a Program to Render a basic box, but through googling, I have not found a solution for Drawing a face(or group of faces) on screen.

Currently every tutorial I've found uses glPushMatrix/glBegin/glEnd/glPopMatrix like this

GL11.glPushMatrix();

GL11.glRotatef(pit, 1, 0, 0);
GL11.glRotatef(yaw, 0, 1, 0);
GL11.glRotatef(rol, 0, 0, 1);
GL11.glTranslatef(pos.x, pos.y, pos.z);

GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3f(-1.0f, -1.0f,  1.0f);   // Bottom Left Of The Quad
GL11.glVertex3f( 1.0f, -1.0f,  1.0f);   // Bottom Right Of The Quad
GL11.glVertex3f( 1.0f,  1.0f,  1.0f);   // Top Right Of The Quad
GL11.glVertex3f(-1.0f,  1.0f,  1.0f);   // Top Left Of The Quad
//insert similar code here for all 6 faces
GL11.glEnd();

GL11.glPopMatrix();

I have read that in OGL 3.0 they Deprecated glPushMatrix/glBegin/glEnd/glPopMatrix but I cant seem to find what the "proper" way to render a Object. Is there a method I should be using?

4
  • 1
    "Currently every tutorial Ive found uses glPushMatrix/glBegin/glEnd/glPopMatrix like this" Please consider looking harder. Mar 9, 2013 at 1:05
  • Someone else pointed me to This as well as This , which one of them is on that page.
    – Snowdrama
    Mar 9, 2013 at 1:11
  • Both of them are on that page. And neither of them use those removed functions. Mar 9, 2013 at 1:14
  • Just* pointed me, I just started reading them less the 20 minutes ago.
    – Snowdrama
    Mar 9, 2013 at 1:27

1 Answer 1

1

You need to forget about the idea of OpenGL managing matrices for you. You will need to implement this stuff yourself using a vector math library. The java 3D Api does a great job of providing a robust set of Matrix and Vector classes and methods. Sorry to be the one to tell you that there is more work for you to do on your end of things, but this is the direction that graphics programming is going.

2
  • I figured as much, I know a little about matrices so it wont be super hard, I figure its a matter sending my vertex array somewhere with some function call.
    – Snowdrama
    Mar 9, 2013 at 1:20
  • Yes, there is a lot to learn when switching to OpenGL 3+ from previous version. This book helped me transition very well: amazon.com/OpenGL-4-0-Shading-Language-Cookbook/dp/1849514763/…
    – aeskreis
    Mar 9, 2013 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.