glGenTextures in ofApp

Hi all,

i’m trying to use

	glGenTextures(1, (GLuint *)&texture.texData.textureID);

inside ofApp, but getting always glError 0x500, as glGenTexures can’t create the texture…

during ofApp::setup() im in the render thread or not?
anyway in ofApp::draw() im in the opengl thread for sure, but always the same error…

can somebody explain me what’s wrong?

Hi gh00st,

glGenTextures() creates one or more texture handles and populates the int[s] that are passed in with the object handle id. Following this you would have to set up the width/height/format/data using some more GL commands.

The only time you would be doing it this way is if you were coding in pure GL outside of OF or creating your own texture handling facilities as you did not want to use ofTexture.

Can you explain a bit more what you’re trying to achieve and maybe I can suggest some ways of going about it?

Cheers!
James

Notice that ofTexture::allocate(…) already does the texture generation for you. You can try reading the function to see the specifics.

oh sorry, i’ve misplaced the topic, actually the problem was on Android.

Anyway my problem was to generate an ofTexture with a custom textureData, and attach it as a render texure to an ofFbo.
I was getting some problem so i was trying to mimic the used in ofVideoPlayer, android version, to configure a texture and pass it to the java side with JNI, passing the GLUint of the texture.

I already solved the original problem here Record ofFbo with MediaCodec , the texture configuration was not the problem.

Anyway i have not understood why i got the problem in my original question in this post, jamesacres maybe you’re right and i was missing something on the other opengl calls to configure the texture right…

Dont know, but anyway for you answers!!