Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4018286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:57:52+00:00 2026-05-20T09:57:52+00:00

I am new to using OpenGL and am experimenting with jogl. I am able

  • 0

I am new to using OpenGL and am experimenting with jogl. I am able to draw triangles without a problem however when I try and draw quads (used in many tutorials) eclipse keeping telling me GL.GL_QUADS cannot be resolved.

gl.glBegin(GL.GL_QUADS);

Not sure what I’m doing wrong.

Thanks,

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.*;

public class SimpleScene implements GLEventListener {
    public static void main(String[] args) {
        GLProfile glp = GLProfile.getDefault();
        GLCapabilities caps = new GLCapabilities(glp);
        GLCanvas canvas = new GLCanvas(caps);

        final Frame frame = new Frame("AWT Window Test");
        frame.setSize(300, 300);
        frame.add(canvas);
        frame.setVisible(true);

        // by default, an AWT Frame doesn't do anything when you click
        // the close button; this bit of code will terminate the program when
        // the window is asked to close
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                frame.dispose();
                System.exit(0);
            }
        });
    canvas.addGLEventListener(new SimpleScene());
    FPSAnimator animator = new FPSAnimator(canvas, 60);
    animator.add(canvas);
    animator.start();
    }

    @Override
    public void display(GLAutoDrawable arg0) {
        update();
        render(arg0);
    }

    private void update() {
        // TODO Auto-generated method stub

    }
    private void render(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();
//      gl.glViewport(0, 0, 300, 300); //Possibly use to move around object
        gl.glClear(GL.GL_COLOR_BUFFER_BIT);

        gl.glPushMatrix();
        gl.glTranslatef(-1.5f,1.5f,0.0f);                  // Move left 1.5 units, up 1.5 units, and back 8 units

        gl.glBegin(GL.GL_TRIANGLES); 
        gl.glColor3f(10, 0, 0);
// Begin drawing triangles
        gl.glVertex3f( 0.0f, 1.0f, 0.0f);                   // Top vertex
        gl.glVertex3f(-1.0f,-1.0f, 0.0f);                   // Bottom left vertex
        gl.glVertex3f( 1.0f,-1.0f, 0.0f);                   // Bottom right vertex
        gl.glEnd();                                         // Finish drawing triangles
        gl.glPopMatrix();


    }

    @Override
    public void dispose(GLAutoDrawable arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void init(GLAutoDrawable arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3,
            int arg4) {
        // TODO Auto-generated method stub

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:57:53+00:00Added an answer on May 20, 2026 at 9:57 am

    The javax.media.opengl.GL interface contains a subset of OpenGL common to GL 3, GL 2, GL ES 2.0 and GL ES 1.x, and GL_QUADS is not part of this subset.

    If you use the javax.media.opengl.GL2, you get GL2.GL_QUADS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm quite new to OpenGL ES and I'm trying to draw some textured quads.
I am new to the opengl so i am using guide of the android
I'm new using the excellent stuff of css twitter bootstrap and having a problem,
Very new to using Raphael.js I'm looking at the tutorials and I am able
I'm experimenting with framebuffers to create a glow effect using Java and JOGL, but
i'm quite new on using opengl, i wonder if there is any way to
I am using openGL and am currently passing it a vertex array. The problem
I am using OpenGL ES 2.0 and GLSL to draw objects. Then I want
I'm currently using OpenGL on Android to draw set width lines, which work great
I need to draw 3d projections and i am using opengl wrapper for JAVA.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.