Main Menu

OpenGL Core

Started by David M, May 24, 2012, 19:14:52

Previous topic - Next topic

David M

Hello everybody,

I've used Slick to write a few programs and a game and decided to move to straight LWJGL to learn OpenGL. I'm reading the OpenGL Superbible 5th edition. This uses just OpenGL core from 3.0 on and I'm having trouble finding the corresponding LWJGL methods. For example, part of the first program on drawing a triangle:

#include <GLTools.h> // OpenGL toolkit
#include <GLShaderManager.h> // Shader Manager Class
#ifdef __APPLE__
#include <glut/glut.h> // OS X version of GLUT
#else
#define FREEGLUT_STATIC
#include <GL/glut.h> // Windows FreeGlut equivalent
#endif

GLBatch triangleBatch;
GLShaderManager shaderManager;

// This function does any needed initialization on the rendering context.
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
{
// Blue background
glClearColor(0.0f, 0.0f, 1.0f, 1.0f );
shaderManager.InitializeStockShaders();
// Load up a triangle
GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f };
triangleBatch.Begin(GL_TRIANGLES, 3);
triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}


Is there a Java wrapper available for GLTools and GLShaderManager or an equivalent? How do I know which OpenGL numbering to use in LWJGL and why are the numberings the way they are? glClearColor is only found in GL11 for example. Thanks,

David


David M

I hadn't seen that. Thanks.