Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / Re: Can someone help find the bug here? on: 2006-04-20 11:40:13

        I attach the original quiz with graphic output sample for your perusal.

thanks very much

bernie

--eager noob
2  Java Game APIs & Engines / JOGL Development / Can someone help find the bug here? on: 2006-04-20 11:28:02
This original from my c++ code was an inclass quiz...the java version I'm doing just for the heck of it.  Not for a grade. Can someone point out what I need to do to
get display draw Triangle in a loop - should print the # of triangles specified by the variable "num"

thanks..Bernie


import javax.media.opengl.*;
import javax.swing.*;

public class Quiz1{

  public static void main (String []args){
final int num = 1;     
      JFrame.setDefaultLookAndFeelDecorated(true);
      JFrame jframe = new JFrame(Quiz1.class.getSimpleName());
      jframe.setSize(500,500);
      jframe.setLocationRelativeTo(null);//center of screen
     
      GLCanvas canvas = new GLCanvas();
     
      canvas.addGLEventListener(new GLEventListener(){
          public void init(GLAutoDrawable drawable){}
         
          public void display(GLAutoDrawable drawable){
              GL gl = drawable.getGL();
             
              for (int i = 0; i< num; i++){
                  gl.glPushMatrix();
                  gl.glScalef(1/num,1/num,1);
                  gl.glTranslatef((1/num*i), 0, 0);
                 
                  drawTriangle();
                  gl.glPopMatrix();
                 
                }
            }
            public void drawTriangle(){
                gl.glClearColor(0.0f,0.0f,0.0f,0.0f);
                gl.glClear(GL.GL_COLOR_BUFFER_BIT);
                gl.glColor3f(1.0f,1.0f,0.0f);
                gl.glMatrixMode(GL.GL_PROJECTION);
                gl.glLoadIsentity();
                gl.glOrtho2D(0,1,0,1);
                gl.glBegin(GL.GL_POLYGON);
                gl.glVertex2f(0.0,0.0);
                gl.glVertex2f(.5,1.0);
                gl.glVertex2f(1.0,0.0);
                gl.glEnd();
                gl.glFlush();
            }
       
       
        public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
       
        public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged){}
       
    });
    jframe.add(canvas);
    jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jframe.setVisible(true);
}
}


       
3  Java Game APIs & Engines / JOGL Development / Re: The OpenGL Red Book in Java on: 2006-03-31 17:44:55
thank you for your efforts,

bernie
4  Java Game APIs & Engines / JOGL Development / GLDisplay error on: 2006-03-29 16:43:25
Hi all, what do I need to change not to get this error?

@hum301-09 ~]$ javac Lesson01.java
Lesson01.java:10: cannot find symbol
symbol  : class GLDisplay
location: class Lesson01
        GLDisplay neheGLDisplay = GLDisplay.createGLDisplay("Lesson 01: An OpenGL Window");
        ^
Lesson01.java:10: cannot find symbol
symbol  : variable GLDisplay
location: class Lesson01
        GLDisplay neheGLDisplay = GLDisplay.createGLDisplay("Lesson 01: An OpenGL Window");
                                  ^

5  Java Game APIs & Engines / JOGL Development / Animator and drawable.setGL() on: 2006-03-25 04:34:47
Hi folks,

what import statements do I use to get access to:

Animator

drawable.setGL()
drawable.getGL()

thanks,
bernie
6  Java Game APIs & Engines / JOGL Development / NeHe tutorials for JoGL on: 2006-03-24 02:45:18
hi all..
having recently installed the JOGL libraries on Ubuntu, I still dont have it working. I get a lot of
"depreciated" this and that when trying NEHE tutorials. Are they in fact out of date with the current standard?

thanks,
bernie
7  Java Game APIs & Engines / JOGL Development / Re: My first JOGL program ...advice anyone? on: 2006-03-15 02:47:23
Thank you both..I'm working on it...

bernie
Smiley
8  Java Game APIs & Engines / JOGL Development / My first JOGL program ...advice anyone? on: 2006-03-14 18:28:57
hi folks...question: this program doesnt work yet, what's wrong with it...
this is my first Java program with JOGL (i've only been programming for 6months in my life, so I'm new at this. any advice will be appreciated.)



import java.awt.*;
import java.awt.event.*;
import net.java.games.jogl.*;
import javax.*;
public class Simple {
  public static void main (Strng args []){

   Frame simpleFrame = new Frame ("simple"); //awt window
   GLCapabilities glc = new GLCapabilities();//config OPen GL
   glc.setDoubleBuffered(false);
   GLCanvas drawable = GLDrawableFactory.getFactory().createGLCanvas(glc);
   drawable.addGLEventListener(new simpleRnderer());
   simpleFrame.add(drawable);

    simpleFrame.setLocation(100,100);
   simpleFrame.setSize(500,500);
   simpleFrame.show();}

   public void init(GLDrawable drawable){
   GL gl = drawable.getGL();
   GLU glu = drawable.getGLU();

   gl.glClearColor(0f,0f,0f,0f);
        glglColor3f(1.0f,1.0f,1.0f,1.0f);

   gl.glMatrixMode(GL.GL_PROJECTION);
   gl.glLoadIdentity();
   gl.glOrtho(-1.0,1.0,-1.0,1.0,1.0);
   }

   static class SimpleRenderer implements GLEventListener{
   public void display(GlDrawable drawable){
      GL gl = drawable.getGL();
      GLU glu = drawable.getGLU();
          gl.glClear(GL.GL_COLOR_BUFFER_BIT);
     gl.glBegin(GL.GL_POLYGON);
          gl.glVertex2f(-0.5f,-0.5f);
          gl.glVertex2f(-0.5f,0.5f);
          gl.glVertex2f(0.5f,0.5f);
       gl.glEnd();
gl.glFlush();
}
}
}



9  Java Game APIs & Engines / JOGL Development / Re: Rotation and Translation on: 2006-03-07 16:09:30
So, here's some code, but  what this does, every time I resize the window, It re calculates the origin, and moves right off the screen..
so what gives....thanks
bernie (yes, I know its c code, but you people are so nice Smiley )


#include <iostream>
#include <cstdlib>
#include <glut.h>
#include <math.h>

const float DEG2RAD = 3.1416/180;

void init(void){
   glClearColor(1.0,1.0,1.0,0.0);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0,1.0,0,1.0);
  glMatrixMode (GL_MODELVIEW);
  glLoadIdentity();

}


void disp(void){
  glClear(GL_COLOR_BUFFER_BIT);

  glColor3f(0.0,0.0,0.0);
 float xradius = 0.25;
 float yradius = 0.125;

 
  glBegin(GL_LINE_LOOP);

  for (int i = 0; i<360; i++){
       float degInRad = i*DEG2RAD;
      glVertex2f(cos(degInRad)*xradius, sin(degInRad)*yradius);
   }
  glEnd();


glRotatef (45,0,0,1);
glTranslatef(.75,.25,0);
 glBegin(GL_LINE_LOOP);

  for (int j = 0; j<360; j++){
       float degInRad = j*DEG2RAD;
      glVertex2f(cos(degInRad)*xradius, sin(degInRad)*yradius);
   }
  glEnd();
glFlush();
}
  void main(int argc, char** argv){
glutInit (&argc, argv); // Initialize GLUT.
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); // Set display mode.
glutInitWindowPosition (50, 100); // Set top-left display-window position.
glutInitWindowSize (400, 300); // Set display-window width and height.
glutCreateWindow ("ellipse"); // Create display window.
init ( ); // Execute initialization procedure.
glutDisplayFunc (disp); // Send graphics to display window.

glutMainLoop ( ); // Display everything and wait.
}
   
10  Java Game APIs & Engines / JOGL Development / Rotation and Translation on: 2006-03-07 15:40:40
Hi people, please help me understand how to make the following:

I have an ellipse, centered at the origin,  defined by the parametric equation
(x (t ), y (t )) = (a cos(t), b(sin(t)),    t being from   {0, 2pi}

what is the parametric representation of the same figure translated by +2 along the x-axis, +3 along the y-axis
and then rotated by 45 degrees

I get,

x'        =   cos(pi/4)     -sin(pi/4)    |x|   + |2|
y'             sin(pi/4)      cos(pi/4)     |y|      |3|

to be read as the matrix multiplication of cos, -sin  by original coordinates
plus the vector 2, 3 yielding the new coordinates....but this is not in homogeneous
coordinates....how to make it homogeneous.....

and any additional info will be appreciated for the Math-phobic among us...

thanks,

bernie
11  Java Game APIs & Engines / JOGL Development / Re: JOGL Project Template available for NetBeans 5 on: 2006-02-21 00:18:48
thanks so much
12  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-21 00:14:50
Yay..small success..

13  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-21 00:06:33
Whoa...there's a ton of stuff there in the GL app you wrote...Will play with it...any other pointers to use....also what are
NBPROJECT
ORG
TEST
(including subdirectories)...

directories for?

seems like a lot of stuff...
thanks SO much

bernie
14  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-21 00:01:16
Ok,  netbeans is cool
15  Java Game APIs & Engines / JOGL Development / Re: JOGL Project Template available for NetBeans 5 on: 2006-02-20 23:54:46
hi there..thanks so much for the info!! I did what you suggested, and downloaded netbeans and set an auto config to your URL...yay! so, now, can you please tell me more about properly using it.. is there JOGL documentation available?


bernie
16  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-20 23:14:06
hi..For netbeans environement, I just d/l Netbeans 5.0 IDE, one file only...Or do I need anything additional? Then I add your module...

thanks for all the help.

bernie
17  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-19 01:27:48
Below, my current C++ code for this assignment (see pdf attachement earlier) ..please comment if you are willing to look at c code
thanks
bernie

ps, yes, I've pulled down the Gears demo and am getting into it. Thanks

#include<iostream>
#include <cstdlib>
#include <glut.h>
using namespace std;

class Point{
   double x;
   double y;
   Point (double x=0, double y=0){this.x=x;this.y=y;}
   //constructor connects x and y values of the calling object
   //'this'

};

class House{
private:
   double w; //width
   double h; // height
   double p; //the peak
   Point O; //House origin.  bottom left corner of the shell of
   //the house

public:
   House(double w, double h, double p, Point origin); // constructor
   //for a house

/*   void draw_shell();
   void draw_door();
   void draw_chimney();
   void draw_window();
*/
   

   void draw_shell(){
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (0.0, 0.0, 1.0); .
   glBegin (GL_LINES);
      glVertex2i(O.x, O.y); //vertices of shell in terms of origin(O.x, O.y)
      glVertex2i(O.x, O.y+h);
      glVertex2i(O.x+w, O.y);
      glVertex2i(O.x+(1/2)w, p);
      glVertex2i(O.x+w, O.y+h);

   glEnd ( );
   glFlush ( );
   }

   void draw_door(){
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (0.0, 0.0, 1.0); .
   glBegin (GL_LINES);
      glVertex2i(O.x+(1/8)w, O.y);
      glVeretex2i(O.x+(1/8)w, O.y+h);
      glVertex2i(O.x+(1/4)w, O.y+h);
      glVertex2i(O.x+(1/4)w, O.y);

   glEnd ( );
   glFlush ( );
   }
   void draw_window(){
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (0.0, 0.0, 1.0); .
   glBegin (GL_LINES);
      glVertex2i(O.x+(5/8)w, O.y+(1/2)h);
      glVertex2i(O.x+(5/8)w, O.y+(3/4)h);
      glVertex2i(O.x+(7/8)w, O.y+(3/4)h);
      glVertex2i(O.x+(7/8)w, O.y+(1/2)h);

   glEnd ( );
   glFlush ( );
   }

   void draw_chimney(){
   glClear (GL_COLOR_BUFFER_BIT);
   glColor3f (0.0, 0.0, 1.0); .
   glBegin (GL_LINES);
      glVertex2i(O.x+(1/8)w, O.y+((1/4)*(p-h)+h);
      glVertex2i(O.x+(1/8)w, O.y+p);
      glVertex2i(O.x+(3/16)w, O.y+p);
      glVertex2i(O.x+(3/16)w, O.y+((3/8)*(p-h)+h);

   glEnd ( );
   glFlush ( );
   }

   void init(){


   glClearColor (1.0, .0, .0, 0.6);
   //glMatrixMode (GL_PROJECTION);
   gluOrtho2D (0.0, 200.0, 0.0, 200.0);
}

void display_house(){
      draw_shell();
      draw_door();
      draw_window();
      draw_chimney();

   }

   void display(){
      House h1(100, 150, 200, Point (0,0) );
      House h2 (100, 200, 280, Point(150,0) );
      House h3 (50, 70, 90, Point (0, 300) );
   //some gl code

      h1.display_house();
      //maybe some more gl code
      h2.display_house();
      h3.display_house();
   }


};

void main (int argc, char** argv)
{
   Point origin(20,20);
   House h4(2, 10, 15, origin);
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition (50, 100);
glutInitWindowSize (400, 300);
glutCreateWindow ("Bernie Project 1");
//init ( ); //
glutDisplayFunc (display_house);
glutMainLoop ( );
}










18  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-18 23:47:46
Can Somone give me a consise list of all import statements that use GL...
thanks
bernie
19  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-18 23:27:41
I have one semester of programming in C++ (accelerated, with data structures)... That's it. So..newbee-ish...Any help is appreciated.

thanks to all

bernie
20  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-17 22:59:33
Most appreciated, the impression I got from my instructor was that it would be "worth it" to use Java for these things.

Does anyone suggest a book for OpenGL with Java?

bernie
21  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-17 18:04:06
PS, thank you all for replying...most appreciated
22  Java Game APIs & Engines / JOGL Development / Re: Making the transition from C++ to Java on: 2006-02-17 18:03:30
Hi, no, I havent done any Java before, thus I am more like asking, what Development environments are you using, how to install
a jogl library to said environment, and are the functions the same...you could say, in a sense I need help more with Java than with open GL.
I think that is reasonable.  Meanwhile I'm doing the assignment in C++ myself.  So, I guess if someone could just help me get an openGL for Java environment up and running, that would be good.

bernie 
23  Java Game APIs & Engines / JOGL Development / Making the transition from C++ to Java on: 2006-02-17 16:14:42
Hello everyone,
I'm a student in a computer graphics course at SUNY Newpaltz, and our instructor is using C++.  He said he will give extra credit if I can learn to do it with Java, but he will provide no support, as his focus is C.   He has given me permission to use any help I can find to do it in Java, and so I come to you people.  I attach a file  of my current exercise I wish to accomplish with OpenGL for your help and viewing pleasure..Its to draw a simple house.

Most appreciatively,

bernie

Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (31 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (44 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!