简体   繁体   中英

IOS GLKit Textures for Cube

new to IOS OpenGL programming. I have worked through a few tutorials that talk about the basics of OpenGL ES and been able to create a small demo program that draws cubes in a scene at positions I want. Id like to apply a texture to the faces of the cube but for some reason this seems to be a near impossible task to figure out. Im using GLKit , Ive searched all over and can't find a dead simple tutorial on how to do this without a lot of other fluff. Can anyone point me in the correct direction or have a tutorial on this? It doesn't seem like this should be hard thing to do. I must be missing something..

Go here for many tutorials bout this http://www.raywenderlich.com/

or here

http://www.raywenderlich.com/5223/beginning-opengl-es-2-0-with-glkit-part-1

this one explains about textures in detail:

http://db-in.com/blog/2011/02/all-about-opengl-es-2-x-part-23/

Id recomend not to use glkit directly (maybe some helper methods) since even tho it is easier as it works like opengl 1 most of the tutorials for gl es 2.0 wont use it and you will get confused.

Use this one for glkit to load textures

https://developer.apple.com/library/ios/#documentation/GLkit/Reference/GLKTextureLoader_ClassRef/Reference/Reference.html#//apple_ref/doc/uid/TP40010922

Try google with something like glkit texture example

this is what i got :

https://github.com/jlamarche/iOS-OpenGLES-Stuff/blob/master/GLKit%20Stuff/GLKBaseEffect%20Drawing%20Example%20with%20Texture/blah/MCViewController.m

around line 119 you can see how to use the texture, i havent checked it but it seems valid. I usually prefer to just use normal opengl since even when you have a simple program the shader file is ridiculously simple, (like less than 10 lines).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM