Skip to main content
GameDev.net gamedev.net
🔒 Locked

GL4Java in a JFrame

Started by Kareem Naouri Jan 12, 2004 at 9:07 AM 0 replies 300+ views
Original Post
Kareem Naouri
Kareem Naouri
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
snk_kid
snk_kid
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/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.