Revision: 6596
http://playerstage.svn.sourceforge.net/playerstage/?rev=6596&view=rev
Author: jeremy_asher
Date: 2008-06-16 16:25:32 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
Endian correction to model picker
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-06-16 23:09:03 UTC (rev 6595)
+++ code/stage/trunk/libstage/canvas.cc 2008-06-16 23:25:32 UTC (rev 6596)
@@ -93,13 +93,18 @@
StgModel* mod = (StgModel*)it->data;
if( mod->GuiMask() & (STG_MOVE_TRANS | STG_MOVE_ROT ))
- {
- glColor4ubv( (GLubyte*)&mod->id );
+ {
+ uint8_t rByte, gByte, bByte, aByte;
+ uint32_t modelId = mod->id;
+ rByte = modelId;
+ gByte = modelId >> 8;
+ bByte = modelId >> 16;
+ aByte = modelId >> 24;
- // printf( "model %d color %d
%x\n",
- // mod->id, mod->id, mod->id );
-
- mod->DrawPicker();
+ //printf("mod->Id(): 0x%X, rByte: 0x%X, gByte: 0x%X,
bByte: 0x%X, aByte: 0x%X\n", modelId, rByte, gByte, bByte, aByte);
+
+ glColor4ub( rByte, gByte, bByte, aByte );
+ mod->DrawPicker();
}
}
@@ -108,11 +113,27 @@
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT,viewport);
- uint32_t id;
+ uint8_t rByte, gByte, bByte, aByte;
+ uint32_t modelId;
+
glReadPixels( x,viewport[3]-y,1,1,
- GL_RGBA,GL_UNSIGNED_BYTE,(void*)&id );
+ GL_RED,GL_UNSIGNED_BYTE,(void*)&rByte );
+ glReadPixels( x,viewport[3]-y,1,1,
+ GL_GREEN,GL_UNSIGNED_BYTE,(void*)&gByte );
+ glReadPixels( x,viewport[3]-y,1,1,
+ GL_BLUE,GL_UNSIGNED_BYTE,(void*)&bByte );
+ glReadPixels( x,viewport[3]-y,1,1,
+ GL_ALPHA,GL_UNSIGNED_BYTE,(void*)&aByte );
- StgModel* mod = (StgModel*)g_hash_table_lookup( StgModel::modelsbyid,
(void*)id );
+ modelId = rByte;
+ modelId |= gByte << 8;
+ modelId |= bByte << 16;
+ modelId |= aByte << 24;
+
+ //printf("Clicked rByte: 0x%X, gByte: 0x%X, bByte: 0x%X, aByte:
0x%X\n", rByte, gByte, bByte, aByte);
+ //printf("-->model Id = 0x%X\n", modelId);
+
+ StgModel* mod = (StgModel*)g_hash_table_lookup( StgModel::modelsbyid,
(void*)modelId );
//printf("%p %s %d %x\n", mod, mod ? mod->Token() : "(none)", id, id );
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit