Guten Tag zusammen,
ich habe gerade mit 3D angefangen. Dabei bin ich auf das Problem gestoßen, dass ich viel einem einzigen Dreieck arbeite was eine weisse Farbe hat aber immer wieder verwendet wird. Kann man die Farbe dieses Objekts ändern OHNE gleich zu resetten mit X_OBJSTART ? Das wäre viel zu langsam und bei z.B. 1000 Dreiecken müsste ich zur Laufzeit pro Screen 1000 Dreiecke neu erschaffen. Ich hatte GETRÄUMT von einer Farbwahl bei X_DRAWOBJ, aber das war zu einfach gedacht, oder ?
Danke, Jan
Versuchst mal mit einem Rechteck zeichen, 16x16 oder so und das dann mit Grabsprite zu packen,dann als Textur auf deinem Objekt zu verwenden.
Sonst würde ich sagen Shader?!
EDIT:
X_OBJSTART 1
X_OBJADDVERTEX 3, -3,0, 0,0, RGB(0xff, 0xff, 0xff)
X_OBJADDVERTEX -3, -3,0, 0,0, RGB(0xff, 0xff, 0xff)
X_OBJADDVERTEX 0, 3,0, 0,0, RGB(0xff, 0xff, 0xff)
X_OBJEND
LOCAL timer%, phi%
WHILE TRUE
X_MAKE3D .1,1000,45
X_CAMERA 0,10,-10, 0,0,0
INC phi,1
X_ROTATION phi, 0,1,0
X_SETTEXTURE 1,-1
X_DRAWOBJ 1,0
X_MAKE2D
IF timer < GETTIMERALL()
CREATESCREEN 1,1,16,16
USESCREEN 1
DRAWRECT 0,0,16,16,RGB(0xff+timer, 0xff+timer*3, 0xff+timer/2)
USESCREEN -1
timer = GETTIMERALL()+250
ENDIF
SHOWSCREEN
WEND
END
If you translate to English perhaps I can help you in something more whit 3D... I think I´m the only or we are only 2 guys we do 3d whit GLBasic... but my Deutsch not it's enough yet for understand your questions?¿, sorry... my English it's bad too, but I understand a bit more...
Regards, and welcome to the Community!!!
I do 3d with GLBasic, too!
When I do sth. with GLBasic... :D
But I think a texture - like Schranz0r said - is the simplest way.
Im a 3D guy too (sometimes). ;)
I vote for texture too. You should not use X_OBJ_START in runtime. If you definitely dont want to go the texture way, use native opengl glbegin etc. can be used in runtime and you can change colours. But if you a beginner you should not even think about this way. :P
Hmmm yes you can do it in opengl, but pls use the texture way to solve this. Much easier to do if you new to 3D stuff.
Your are hide guys :D , too much very good things, physics engines and net and opengl... but you are :x whit the 3D :D
Well how my Deutsch it's practically 0 (my english 0.5), a thing it's learn whit internet and another thing it's read a standard conversation, it's really hard, I really don't understood the question...
Regards Guys,
Iván J.
Schranzors Idee ist gut. Mach eine Textur statt der Farbe. Ist auch schneller beim Rendern.