Trouble getting a simple JOGL program running on OSX 10.10

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble getting a simple JOGL program running on OSX 10.10

roger
Hi, I've been trying to get a very simple JOGL program running on OSX 10.10, and I can't seem to pass the vertex information to the shaders correctly. After trying everything I could think of in my actual program, I've created a basic test case to help me figure out where I'm going wrong. This program draws a triangle, with the vertex information acting as the colors.

Here is the basic idea of the code:
https://gist.github.com/danem/574312cb32aac8a3f1a6f9b8279e0bba

My program generates this:

http://imgur.com/1PSOaoy

This indicates that the vertex data is all 0s. And I'm not seeing any errors when I repeatedly check glGetError.

See what I'm missing?
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting a simple JOGL program running on OSX 10.10

roger
So after a ton of frustration, and poking around other people's source code. I've discovered that my problem was that I didn't use Direct Buffers. Instead, I was creating my buffers with FloatBuffer.allocate(). Is this noted in the documentation anywhere?

Hopefully this will help others who get hung up on this later.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting a simple JOGL program running on OSX 10.10

elect
roger wrote
So after a ton of frustration, and poking around other people's source code. I've discovered that my problem was that I didn't use Direct Buffers. Instead, I was creating my buffers with FloatBuffer.allocate().
You should use either GLBuffers.newDirectFloatBuffer() or ByteBuffer.allocateDirect().order(native).asFloatBuffer()

roger wrote
Is this noted in the documentation anywhere?

Hopefully this will help others who get hung up on this later.

Thanks
Unfortunately not, but good hint, we will add it into the wiki