Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Kareem Naouri

GL4Java in a JFrame

This topic is 5334 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, i''m trying to design a program in java that draws a simple shape (rectangle, triangle or circle) then the user can choose to translate, scale or rotate that shape.. I created two classes: Transformations and OpenGLPart, the Transformations class is a JFrame containing the control panel for the user and a component with the size of 400x400 in which the openGL part is supposed to appear, and the OpenGLPart class contains the openGL code.. There is a button called applyButton in the control panel, when clicked, the values for scaling, rotating, translating and the required shape are stored then a new object from class OpenGLPart is created with these values as constructor parameters, here''s the code: void draw() { translateX = (float)(translateXSlider.getValue()); translateY = (float)(translateYSlider.getValue()); scaleX = (float)(scaleXSlider.getValue()); scaleY = (float)(scaleYSlider.getValue()); rotate = Float.parseFloat(rotateField.getText()); OpenGLPart ogl = new OpenGLPart(shape, translateX, translateY, scaleX, scaleY, rotate); canvas = (Component)(ogl); layout.add(canvas , BorderLayout.CENTER); contents.revalidate(); } The problem is.. nothing shows.. only empty space.. can anyone help me please? Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
Don''t mean to be rude but why are you using GL4Java is pretty much redundant now. There is an official OpenGL binding supported by Sun & SGI now called JOGL, its quite easy to use, the website is here https://jogl.dev.java.net/ and here is an introductory tutorial on setting up & using jogl http://today.java.net/pub/a/today/2003/09/11/jogl2d.html . Also a lot of the NeHe tutorials have ports for jogl here http://nehe.gamedev.net/

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!