Using VBO's before window is created using JOGL

Started by
1 comment, last by Wilhelm van Huyssteen 12 years, 6 months ago
Hello all,

I am working on an application that reads in a collection of 3d models. Because the application is written in java, I decided to use JOGL to render the models to a window when the user presses "view model". I know how to create an opengl context by creating a GLCanvas and attaching a listener. In the init-method I can load in the models using VBO.

However, what I want to do is initialize opengl at the start of the application, so that I can load in the models on the GPU. When the user presses the view mesh button, the window should be created containing the GLCanvas and render the selected model. This prevents me from storing all vertex and normal data and just store one or two id's.

So, is there any way to obtain a handle to opengl without creating a GLCanvas?
[Or is hiding the window the most efficient way to go? I don't wanna ruin processor time by rendering/looping something that isn't visible]
Advertisement
You need to have a context and to have a context you need to create a window. You can make it hidden if you want.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
You can always just create the window but not render anything to it until the user clicks that button, Just becuase the model is loaded in the VBO doesnt mean you have to render it. <BR><BR>Alternitively if you realy dont want the window before the user clicks the button just load the model data into buffers in the correct format and keep it in memory. Then when the user wants to see the model create the window and just load that data into the VBO. It should stil be pretty much instant. Loading the model into the memory buffer from a flat file is the most time consuming part.

This topic is closed to new replies.

Advertisement