3D Farben ändern

Previous topic - Next topic

sundown

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

Schranz0r

#1
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:


Code (glbasic) Select
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
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

mentalthink

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!!!

backslider

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.

kanonet

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
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

Schranz0r

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.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

mentalthink

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.




Kitty Hello

Schranzors Idee ist gut. Mach eine Textur statt der Farbe. Ist auch schneller beim Rendern.