Hey guys, I’d like to have a pretty urgent question. So, I have an application ready to release for a customer, but I forgot to add the mechanism to switch between the sd and hd assets.
So, whenever it’s possible (the GL_MAX_TEXTURE_SIZE says so) to load max. 4096x4096 sized textures, I’d like to. I was reading the docs, I tried to get the GLint on code side, etc - nothing really worked.
Long story short: I’m looking for a function/whatever which tells me the current maximum texture size.
See the class CCConfiguration (http://www.cocos2d-x.org/reference/native-cpp/V2.1.4/d3/dd6/classcocos2d_1_1_c_c_configuration.html#a07aa43ba0c2ac6932b596257798e4cf1)
method gatherGPUInfo
In the implementation I see
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_nMaxTextureSize);
m_pValueDict~~>setObjectm_nMaxTextureSize), “gl.max_texture_size”);
You can use one of the getters of the class to access to gl.max_texture_size to load max. 4096x4096 sized textures, I’d like to. I was reading the docs, I tried to get the GLint on code side, etc~~ nothing really worked.
>
Long story short: I’m looking for a function/whatever which tells me the current maximum texture size.
Hey, thanks for the reply.
Unfortunately I tried to use the glGetIntegerv function, but it crashed on the iOS simulator. Didn’t really check that on Android tho. My OpenGL is a bit rusty, but if I’m right, it crashes because it can’t find a valid OpenGL context. However, I tried to do this in the AppDelegate.cpp file, right after setting the design resolution, so I’d assume it has a valid context to work with.
Gonna try the second idea, seems to be a good one.
Will do it later today.
Thanks again
I have read in the paste that the simulator has some issues with the OpenGL context. This might be one of the cases.
Have you tried on a real device?
Let me know
Massimo
Hey, just wanted to let you know, that it’s working on the device.
The code I’ve been using:
GLint m_maxTextureSize = 0;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
with the CC_TARGET_PLATFORM directives, so it won’t crash on the simulator.
Many thanks for pointing to the right direction (to test it on the device).