I tried to draw on a texture with a render target created with render.CreateRenderTargetTexture, it failed. (Drawed it On-Screen instead)
But it worked with GetRenderTarget. Am I doing it wrong? D:
Are you by any chance trying to use renderx for this?
[url]http://www.facepunch.com/showpost.php?p=17318503&postcount=356[/url]
Because if you are, you don't need to.
[url]http://i30.tinypic.com/2wow1fq.jpg[/url]
Done without renderx. :D
[QUOTE=blackops7799;17327746]Are you by any chance trying to use renderx for this?
[url]http://www.facepunch.com/showpost.php?p=17318503&postcount=356[/url]
Because if you are, you don't need to.
Done without renderx. :D[/QUOTE]
Could you tell me how you made it that high-res? :d
I would like to know this too.
Err I'm at school right now, so I'll see if I can get this right..
You need to create a new rendertarget file in "settings/render_targets/"
Name it, and make it 1024x1024.
Then in your code you would use something like this.. It may be wrong since I just whipped it up now..
[lua]local MyRT = GetRenderTarget("NameOfYourRT",1024,1024)
local RtMat = Material( "Path of material we want to make an RT" )
--local RtMat = Material( "models/weapons/lens/lens_rt" ) --The texture for insurgency is something like this..
local function MyPaintHook()
RtMat:SetMaterialTexture( "basetexture", MyRT )
local CamData = {}
CamData.angles = EyeAngles()
CamData.origin = EyePos()
CamData.fov = 40
CamData.x = 0
CamData.y = 0
CamData.w = 1024
CamData.h = 1024
local ViewModel = LocalPlayer():GetViewModel()
local OldRT = render.GetRenderTarget()
render.SetRenderTarget( MyRT )
render.SetViewPort( 0, 0, 1024, 1024 )
render.Clear( 0, 0, 0, 255, true )
cam.Start2D()
ViewModel:SetNoDraw( true ) --Don't draw the view model while rendering the camera
render.RenderView( CamData )
ViewModel:SetNoDraw( false ) --Draw it now that we finished rendering the camera
--You can also draw other shit here like text/materials
cam.End2D()
render.SetViewPort( 0, 0, ScrW(), ScrH() )
render.SetRenderTarget( OldRT )
end
[/lua]
I would give the code I have, but I'm not at home.
[QUOTE=blackops7799;17336413]
[lua]
render.SetViewPort( 0, 0, 1024, 1024 )
render.Clear( 0, 0, 0, 255, true )
[/lua]
I would give the code I have, but I'm not at home.[/QUOTE]
Didn't have these 2 lines :p
can someone tell me were to poot the dll file bicose it dosent work for me in i relly nead it so pleas help.
[QUOTE=The Doci;17516888]can someone tell me were to poot the dll file bicose it dosent work for me in i relly nead it so pleas help.[/QUOTE]
First of all, let me fix your spelling :
[quote][b]C[/b]an someone tell me where to [b]put[/b] the dll file [b]because[/b] it [b]doesn't[/b] work for me[b], can someone please help me?[/b][/quote]
Now that we can understand you, place the file into garrysmod/lua/include/modules
I'm adding support for dynamic meshes and the mesh builder class of the SDK.
[lua]render.SetMaterial( material );
local mesh = render.GetDynamicMesh( true );
local builder = MeshBuilder();
local normal = Vector( 0, 0, 1 );
// build our triangle
builder:Begin( mesh, MATERIAL_TRIANGLES, 1 );
builder:Position( Vector( 128, 128, 16 ) );
builder:Normal( normal );
builder:TexCoord( 0, 0, 0 );
builder:Color( color_white );
builder:AdvanceVertex();
builder:Position( Vector( 128, 0, 16 ) );
builder:Normal( normal );
builder:TexCoord( 0, 1, 0 );
builder:Color( color_white );
builder:AdvanceVertex();
builder:Position( Vector( 0, 0, 16 ) );
builder:Normal( normal );
builder:TexCoord( 0, 1, 1 );
builder:Color( color_white );
builder:AdvanceVertex();
builder:End();
// draw the mesh
local matrix = Matrix();
matrix:Scale( Vector( 2, 2, 2 ) );
matrix:Translate( Vector( 0, 0, 64 ) );
cam.PushModelMatrix( matrix );
mesh:Draw();
cam.PopModelMatrix();
[/lua]
[media]http://cdbarrett.com/dump/gm_flatgrass0034.jpg[/media]
[media]http://cdbarrett.com/dump/gm_flatgrass0031.jpg[/media]
[media]http://cdbarrett.com/dump/gm_flatgrass0032.jpg[/media]
[media]http://cdbarrett.com/dump/gm_flatgrass0033.jpg[/media]
I have just a little more tweaking to do, then I'll release the update.
That's the gayest triangle I've ever seen.
Garry should add this to vanilla Garry's Mod.
[QUOTE=CowThing;17610577]Garry should add this to vanilla Garry's Mod.[/QUOTE]
This, and the gm_steamworks library. They're a GREAT addition to the game. Oh, also gmsv_vphysics, although i'm not sure it would be supported by everyone?
[QUOTE=mastersrp;17696384]This, and the gm_steamworks library. They're a GREAT addition to the game. Oh, also gmsv_vphysics, although i'm not sure it would be supported by everyone?[/QUOTE]
I doubt garry would add gm_steamworks, seeing as it's not using an official Steamworks API.
[QUOTE=Skondra;17704979]I doubt garry would add gm_steamworks, seeing as it's not using an official Steamworks API.[/QUOTE]
True, and iirc you can remove and add friends with it which means it can be exploited (Removing all your friends).
[QUOTE=Jinto;17579718]I have just a little more tweaking to do, then I'll release the update.[/QUOTE]
Are you done yet ?
[QUOTE=Callee;18064619]Are you done yet ?[/QUOTE]
Oh, nobody seemed interested so I put it on hold. But if you're interested I'll finish it.
[QUOTE=Jinto;18087810]Oh, nobody seemed interested so I put it on hold. But if you're interested I'll finish it.[/QUOTE]
I am very interested in it. Please finish it.
Hell yeah
[QUOTE=Spacetech;18089422]I am very interested in it. Please finish it.[/QUOTE]
Everyone's been interested about this, it's just that it's been the polite people who only ask once then wait quietly to see what you do.
[QUOTE=Jinto;18087810]Oh, nobody seemed interested so I put it on hold. But if you're interested I'll finish it.[/QUOTE]
[QUOTE=Levybreak;18103336]Everyone's been interested about this, it's just that it's been the polite people who only ask once then wait quietly to see what you do.[/QUOTE]
Having put two and two together...
[highlight]FUCKING FINISH THIS MASTERPIECE JINTO. FUCKING DO IT. DOOOO IIIIT. DO IT.[/highlight]
No timid cries of 'please' and 'thankyou'. FINISH IT.
Otherwise you'll be just another one of those half-assed programmers who does something really cool but then gives up on it because they can't commit to anything they do *glares at Night-Eagle... and himself.*
[QUOTE=TehDoomCat;18127825]Having put two and two together...
[highlight]FUCKING FINISH THIS MASTERPIECE JINTO. FUCKING DO IT. DOOOO IIIIT. DO IT.[/highlight]
No timid cries of 'please' and 'thankyou'. FINISH IT.
Otherwise you'll be just another one of those half-assed programmers who does something really cool but then gives up on it because they can't commit to anything they do *glares at Night-Eagle... and himself.*[/QUOTE]
To the last statement. Partially true, I have projects nobody has ever seen or heard of that just never got off the ground. However this, was released. I kept adding to it after it was released, slowly. I could have stopped after the last update and never added anything more. But with lack of people actually using it I just don't have motivation to finish it.
I have yet to see anything actually released that uses this. Which is why I lack motivation. No, the portal gun doesn't count.
[b]Functions:[/b]
[list]
[*]render.GetDynamicMesh( buffered )
[*]MeshBuilder()
[/list]
[b]Mesh Builder:[/b]
[list]
[*]CMeshBuilder:Begin( dynamic mesh, primitive type, primitive count )
[*]CMeshBuilder:End()
[*]CMeshBuilder:AdvanceVertex()
[*]CMeshBuilder:Position( vector )
[*]CMeshBuilder:Normal( unit vector )
[*]CMeshBuilder:Color( color )
[*]CMeshBuilder:TexCoord( stage, u, v )
[*]CMeshBuilder:Specular( color )
[*]CMeshBuilder:TangentS( unit vector )
[*]CMeshBuilder:TangentT( unit vector )
[*]CMeshBuilder:Reset()
[/list]
[b]Dynamic Mesh:[/b]
[list]
[*]Mesh:Draw()
[/list]
[b]Primitive Types[/b]
[list]
[*]MATERIAL_POINTS
[*]MATERIAL_LINES
[*]MATERIAL_TRIANGLES
[*]MATERIAL_TRIANGLE_STRIP
[*]MATERIAL_LINE_STRIP
[*]MATERIAL_LINE_LOOP
[*]MATERIAL_POLYGON
[*]MATERIAL_QUADS
[*]MATERIAL_INSTANCED_QUADS
[*]MATERIAL_HETEROGENOUS
[/list]
[url]http://www.cdbarrett.com/dump/releases/gmcl_renderx.zip[/url]
[url]http://www.cdbarrett.com/dump/releases/gmcl_renderx_src.zip[/url]
It will go through a rewrite though later on, as I'm cleaning up all my modules.
Do you happen to have an example of how to use that MeshBuilder code?
[QUOTE=Levybreak;18137259]Do you happen to have an example of how to use that MeshBuilder code?[/QUOTE]
Look a few posts up. That post made me realize I got a few arguments wrong in the documentation. Fixing.
[QUOTE=Jinto;18135093]I have yet to see anything actually released that uses this.[/QUOTE]
I believe that's because its not included in vanilla gmod. If someone was to make a gamemode that uses this module they would have to get their users to download it, which is sometimes hard. If this was included in gmod by default I'm sure many people would benefit from it.
[QUOTE=Jinto;18135093]
I have yet to see anything actually released that uses this.[/QUOTE]
Liar.
[url=http://www.garrysmod.org/downloads/?a=view&id=58648][img]http://www.garrysmod.org/img/?t=dll&id=58648[/img][/url]
Almost 1 year ago, now. :D
[QUOTE=Spacetech;18141227]I believe that's because its not included in vanilla gmod. If someone was to make a gamemode that uses this module they would have to get their users to download it, which is sometimes hard. If this was included in gmod by default I'm sure many people would benefit from it.[/QUOTE]
This.
Jinto, is it at all possible to create a function the gets the mesh information from a Model? That would be incredibly useful for effects, like props melting and such.
[editline]01:43PM[/editline]
Also as for people using it, I'm going to incorporate it into my Adaptive Shielding sent.
[editline]01:44PM[/editline]
And if i can ever figure out how to use MySql an inter sever hyperdrive
[QUOTE=DrFattyJr;18275880]Jinto, is it at all possible to create a function the gets the mesh information from a Model? That would be incredibly useful for effects, like props melting and such.[/QUOTE]
Elaborate. What specific info do you want about the mesh?