How can i isolate Opengl code from my view class?

Hello everybody,

i have tried to isolate some methods and OpenGL ES calls to some normal c++ classes. But they doesn’t work. The same code works when i use it in the Objective C class with the context. How can i solve this problem? I like to make a little wrapper class with the context and the view because i like to make the same code on Android.

Can someone explain how to isolate the whole methods and OpenGL calls?

Greets
krikit.

Hello,

i have solved the problem.

It seems that in OpenGL ES a GLuint variable isn’t the same like a casted variable.

So the following code snippet shows the differences.


GLuint i = 20;
int j = 20;
glReadPixels(0, 0, i, (GLuint)j, GL_RGBA, GL_UNSIGNED_BYTE, pictureDest);

best regards
krikit

The GLuint is an unsigned int, thus unsigned int j would work. Although some compilers only give warnings and some gives errors

Hi,

thanks! It’s right i didn’t use an unsigned int. I use the gcc compiler under iOS and it doesn’t give me a warning. So i didn’t find the solution for a while ^^ and it takes a lot of time to figure it out.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.