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 8339253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:50:05+00:00 2026-06-09T04:50:05+00:00

The Java OpenGL GL interface contains about 2000 methods, for debugging purposes I would

  • 0

The Java OpenGL GL interface contains about 2000 methods, for debugging purposes I would like to wrap an instance and delegate calls to it while doing some logging. The logging code can be pushed to the same method in each case, so the task of writing out the method implementations looks like it could be automated. An example of what I am trying to do:

import javax.media.opengl.GL;

public class GLErrorLogger implements GL {
  private final GL backing;

  public GLErrorLogger(GL delegateToMe) {
    backing = delegateToMe;
  }

  private void checkErrorCode() {
    // Log frame and thread details depending on gl state
  }

  /**
   * Example of a method
   */
  @Override
  public int glGenLists(int arg0) {
    checkErrorCode();
    int retVal = backing.glGenLists(arg0);
    checkErrorCode();
    return retVal;
  }

  // rest of methods here...
}

In other words copy the method name and parameters (minus their types) into a call on the backing object, surround with calls to the logging method, and if there is a return type then assign the result to a variable of this type and return it at the end of the method.

I looked at creating a one shot eclipse code template to autogenerate the methods, but there wasn’t an immediately obvious way to do pattern matching on the return type. Can anyone suggest a way to do this in Eclipse or any of its code generation tools to save me pulling out the regex toolkit?

  • 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-06-09T04:50:07+00:00Added an answer on June 9, 2026 at 4:50 am

    You might want to use an Aspect to create the necessary bytecode for you instead of producing all the source code. Take a look at the Traceing Aspect example here: Traceing Aspect Example.

    As an Alternative, you can create a Java Dynamic Proxy, if you do not want to use AspectJ as Thrid party Library. Please refer to Dynamic Proxy Tutorial

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

Sidebar

Related Questions

Can you blend Java and native OpenGL calls. For instance having the setup happen
I'd like to resize an image using OpenGL. I'd prefer it in Java, but
When using openGL in Java (in bindings like jogl), do you have to worry
I'm making a game in lwjgl (java opengl) which contains a mesh of textured
I've just started learning LWJGL (Java OpenGL), and i'm encountering an enormous amount of
I've been developing an Android app in Eclipse (java) using openGL ES 1.0 on
I'm starting to play with OpenGL from Java, and I'm encountering a situation where
In the context of a Java/OpenGL application I am drawing a black wired only
I'm implementing a height map with GL_TRIANGLE_STRIPS and the LWJGL OpenGL Java Bindings. When
I am started to deal with OpenGL. My application is written in Java using

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.