PDA

View Full Version : How can i isolate Opengl code from my view class?



krikit
04-10-2012, 06:56 AM
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.

krikit
04-19-2012, 12:22 AM
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

gardin
04-20-2012, 11:05 AM
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

krikit
04-26-2012, 02:13 AM
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.