Hi, I’m very new to gl and jogl (and debated posting this here or newless cluebies). I want to use jogl for my 2D game so it will run well on more than just Windows. But in my research I’ve come up with some questions…
I’m a little stumped as to where the GL class resides? I have downloaded the jogl source out of cvs. There’s no GL.java in jogl, and searching for things like “class GL” or “interface GL” turns up nothing. I assume all gl* functions from the standard C implementation of openGL would be found in the GL class? Searching for things like glBegin show a lot of other classes using the method, but not where it’s originating from.
What about glDrawPixels, glBitmap, etc? I also was unable to find those as well. I am curious how much of the 2D side of openGl is implemented, or if I’m even on the right track at all.
In doing some small toy programs with jogl, I can’t get the color to change no matter what I do. For example I stripped the Gears demo down and replaced drawing the gears with just drawing a few polys, I have something like:
public void display(GLDrawable drawable)
{
// glClearColor set to black
gl.glclear( GL.GL_COLOR_BUFFER_BIT );
gl.glColor3f( 0.0f, 1.0f, 0.0f );
gl.glBegin( GL.GL_POLYGON );
gl.glVertex2f( 0.0f, 0.0f );
gl.glVertex2f( 1.0f, 0.0f );
gl.glVertex2f( 0.0f, 1.0f );
gl.glEnd();
gl.glFlush();
}
but no matter what the triangle is always a dark red. Weird that’s dark red, I’d think if anything it’d be (1.0, 0.0, 0.0) red, I’ve experimented with specifying the color at other times and such with no luck.
My game currently has a render class that all sprites register themselves with. When it comes time to draw the frame the renderer’s Graphic object is passed around to everyone and they all do their thing. Is this a feasable approach with jogl? Obviously not a Graphics object, but perhaps a small inner class of my renderer that accepts an image and coordinates and draws it to the GLCanvas with I assume glDrawPixels or something like it?
I’m also curious on the whole pasting sprites onto polygons as textures vs just blitting the sprites as is. In searching (not just these forums but the internet for openGL stuff in general) I’ve found it split about 50/50. It seems that generally the more game oriented people seem to prefer the polygon/texture route. Should that be the way I head? I have a feeling that’d drastically change my game’s structure.