c# - Can't see textures or colors on vertices being drawn -


i have following code in opentk:

        unsafe         {             vector3* data = (vector3*)marshal.allochglobal(                                   marshal.sizeof(typeof(vector3)) * simplevertices.count);             vector2* uv = (vector2*)marshal.allochglobal(                                   marshal.sizeof(typeof(vector2)) * simplevertices.count);             for(int = 0; < simplevertices.count; i++)             {                 ((vector3*)data)[i] = simplevertices[i];                 vector2 thisuv = uvdata[i];                 ((vector2*)uv)[i] = uvdata[i];              }              gl.bindtexture(all.texture2d, texture.gltexture.openglname);             gl.texparameter(all.texture2d, all.texturewraps, (int)texturewrapmode.repeat);             gl.texparameter(all.texture2d, all.texturewrapt, (int)texturewrapmode.repeat);              byte []squarecolors = new byte[simplevertices.count];             random.nextbytes(squarecolors);              gl.colorpointer (vertices.count, all.unsignedbyte, 0, squarecolors);              gl.vertexpointer(3, all.float, sizeof(vector3), new intptr(data));             gl.drawarrays(all.triangles, 0, simplevertices.count);               marshal.freehglobal((intptr)data);             marshal.freehglobal((intptr)uv);         } 

i know data being given vertices anduv correct (at least work fine in xna renderer) , i'm seeing white polygons being drawn correctly on screen.

from code above should seeing assortment of colours since i'm populating squarecolours random number of bytes (i've verified squarecolors being filled random bytes) i'm not, vertices being drawn white.

i've tried binding texture (via gl.bindtexture) , has failed.

any ideas why isn't working?

edit: when added enable color (see first comment on post) app crashed out following output:

stacktrace:

at (wrapper managed-to-native) opentk.graphics.es11.gl/core.drawarrays (opentk.graphics.es11.all,int,int) @ opentk.graphics.es11.gl.drawarrays (opentk.graphics.es11.all,int,int) [0x00000] in /users/plasma/source/iphone/monotouch/opengles/opentk/graphics/es11.iphone/gl.cs:1326 @ jabber.j3d.shape.draw_ios () [0x00171] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/j3d/shape_ios.cs:136 @ jabber.j3d.shape.draw () [0x00000] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/j3d/shape.cs:255 @ jabber.j3d.physicshape.draw () [0x00000] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/j3d/physicshape.cs:46 @ jabber.scene.gamescene.draw () [0x0001d] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/scene/gamescene.cs:299 @ jabber.gamescreenmanager.screen.draw () [0x0001f] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/gamescreenmanager/screen.cs:150 @ chicksnvixens.screens.gameplayscreen.draw () [0x00000] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/chicksnvixens/screens/gameplayscreen.cs:481 @ jabber.gamescreenmanager.screenmanager.draw () [0x00054] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/gamescreenmanager/screenmanager.cs:92 @ jabber.basegame.draw (microsoft.xna.framework.gametime) [0x0002c] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/engine/basegame.cs:95 @ chicksnvixens.chicksnvixensgame.draw (microsoft.xna.framework.gametime) [0x00000] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/chicksnvixens/chicksnvixensgame.cs:414 @ microsoft.xna.framework.game.dodraw (microsoft.xna.framework.gametime) [0x0001e] in /users/ahmedhakeem/documents/projects/jabberengine2/exen/exencommon/game/gamecommon.cs:205 @ microsoft.xna.framework.exenemtouchgameview.onrenderframe (opentk.frameeventargs) [0x0002e] in /users/ahmedhakeem/documents/projects/jabberengine2/exen/exenemtouch/exenemtouchgameview.cs:329 @ opentk.platform.iphoneos.iphoneosgameview.runiteration () [0x000af] in /users/plasma/source/iphone/monotouch/opengles/opentk/platform/iphoneos/iphoneosgameview.cs:592 @ monotouch.foundation.nsactiondispatcher.apply () [0x00000] in /users/plasma/source/iphone/monotouch/shared/foundation/nsaction.cs:45 @ (wrapper runtime-invoke) object.runtime_invoke_void_this_ (object,intptr,intptr,intptr) @ (wrapper managed-to-native) monotouch.uikit.uiapplication.uiapplicationmain (int,string[],intptr,intptr) @ monotouch.uikit.uiapplication.main (string[],string,string) [0x00038] in /users/plasma/source/iphone/monotouch/uikit/uiapplication.cs:26 @ chicksnvixens.program.main (string[]) [0x00000] in /users/ahmedhakeem/documents/projects/jabberengine2/mycode/chicksnvixens/monotouch program.cs:24 @ (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)

native stacktrace:

0 achicks
0x000c5d00 mono_handle_native_sigsegv + 343 1 achicks 0x0000fce0 mono_sigsegv_signal_handler + 322 2 libsystem.b.dylib 0x95fee48b _sigtramp + 43 3 ???
0xffffffff 0x0 + 4294967295 4
glengine
0x08645753 glellvmarrayfunc + 67 5
glengine
0x0863cba2 gledrawarraysorelements_execcore + 856 6 glengine
0x08642bbe gldrawarrays_imm_exec + 332 7 opengles
0x0087c308 gldrawarrays + 57 8 ??? 0x0c3c9b34 0x0 + 205298484 9 ???
0x0c3c9a9c 0x0 + 205298332 10 ???
0x0f0956c8 0x0 + 252270280 11 ???
0x0f0939c4 0x0 + 252262852 12 ???
0x0f09397c 0x0 + 252262780 13 ???
0x0ecdb286 0x0 + 248361606 14 ???
0x0c3c709a 0x0 + 205287578 15 ???
0x0f0927c4 0x0 + 252258244 16 ???
0x0c3c44cd 0x0 + 205276365 17 ???
0x0c3c3fed 0x0 + 205275117 18 ???
0x0c3c3e9a 0x0 + 205274778 19 ???
0x0c3c3d73 0x0 + 205274483 20 ???
0x0cc03166 0x0 + 213922150 21 ???
0x0cbfd578 0x0 + 213898616 22 ???
0x0cbfd130 0x0 + 213897520 23 ???
0x05e861e8 0x0 + 99115496 24 achicks 0x0000fa9b mono_jit_runtime_invoke + 1332 25 achicks
0x001d9f01 mono_runtime_invoke + 137 26 achicks
0x0027e52b monotouch_trampoline + 2527 27 foundation
0x00619749 nsfiretimer + 125 28 corefoundation
0x014398c3 __cfrunloop_is_calling_out_to_a_timer_callback_function
+ 19 29 corefoundation 0x0143ae74 __cfrunloopdotimer + 1220 30 corefoundation
0x013972c9 __cfrunlooprun + 1817 31 corefoundation
0x01396840 cfrunlooprunspecific + 208 32 corefoundation
0x01396761 cfrunloopruninmode + 97 33 graphicsservices
0x028bc1c4 gseventrunmodal + 217 34 graphicsservices
0x028bc289 gseventrun + 115 35 uikit 0x008abc93 uiapplicationmain + 1160 36 ???
0x05e84b8b 0x0 + 99109771 37 ???
0x05e83fb4 0x0 + 99106740 38 ???
0x05e83cee 0x0 + 99106030 39 ???
0x05e83e46 0x0 + 99106374 40 achicks 0x0000fa9b mono_jit_runtime_invoke + 1332 41 achicks
0x001d9f01 mono_runtime_invoke + 137 42 achicks
0x001dc560 mono_runtime_exec_main + 669 43 achicks
0x001db96e mono_runtime_run_main + 843 44 achicks
0x0009cdd2 mono_jit_exec + 200 45 achicks
0x00003362 main + 3838 46 achicks
0x00002249 _start + 208 47 achicks
0x00002178 start + 40

debug info gdb:

/tmp/mono-gdb-commands.zei8zh:1: error in sourced command file: unable debug self

you have wrong arguments colorpointer. first argument number of components per color. use 3 rgb-colors.

try this:

byte[] squarecolors = new byte[simplevertices.count * 3]; random.nextbytes(squarecolors); gl.colorpointer (3, all.unsignedbyte, 0, squarecolors); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -