Static background in a render...
Static background in a render...
Static background in a render...
Static background in a render...
Static background in a render...
Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render...
Static background in a render... Static background in a render...
Static background in a render...
Go Back  Xtreme Visual Basic Talk > > > > Static background in a render...


Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2006, 02:04 PM
afwasborstel afwasborstel is offline
Centurion
 
Join Date: Apr 2003
Posts: 142
Default Static background in a render...


How can i make a static background in a render? I need a grid on wich directx can draw it's stuff...
Reply With Quote
  #2  
Old 10-27-2006, 03:17 PM
Iceplug's Avatar
IceplugStatic background in a render... Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

A static background?
Load up a texture and set up a vertex buffer that will hold TransformedColoredTextured vertices. In the vertex buffer vertices, specify the size of the visible area of your form as the high values for the vertices.

When you draw the vertices, make sure that you apply the texture and set the ZBufferWriteEnable to fallse.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 10-27-2006, 04:19 PM
afwasborstel afwasborstel is offline
Centurion
 
Join Date: Apr 2003
Posts: 142
Default

Ok...got it so far...but it doesn't show in the render...

Code:
Private textureBackground As Direct3D.Texture = Nothing Private vertexBackground As Direct3D.VertexBuffer = Nothing Public Sub Create(ByVal device As Direct3D.Device, ByVal texture As String, ByVal position As DirectX.Vector3) vertexBackground = New Direct3D.VertexBuffer(GetType(Direct3D.CustomVertex.TransformedColoredTextured), 4, device, Direct3D.Usage.WriteOnly, Direct3D.CustomVertex.TransformedColoredTextured.Format, Direct3D.Pool.Default) textureBackground = Direct3D.TextureLoader.FromFile(device, texture) Dim v(3) As Direct3D.CustomVertex.TransformedColoredTextured Dim i As Integer For i = 0 To 3 v(i).Position = (New DirectX.Vector4(position.X, position.Y, position.Z, 1.0F)) v(i).Color = 255 Next v(0).Y = CType(device.PresentationParameters.BackBufferHeight, Single) v(2).Y = CType(device.PresentationParameters.BackBufferHeight, Single) v(2).X = CType(device.PresentationParameters.BackBufferWidth, Single) v(3).X = CType(device.PresentationParameters.BackBufferWidth, Single) v(0).Tu = 0.0F : v(0).Tv = 1.0F v(1).Tu = 0.0F : v(1).Tv = 0.0F v(2).Tu = 1.0F : v(2).Tv = 1.0F v(3).Tu = 1.0F : v(3).Tv = 0.0F End Sub

Wich is called by: Create(device, "c:\back.bmp", New DirectX.Vector3(0, 0, 1))


And in the render...

Code:
Public Sub RenderBackground(ByVal device As Direct3D.Device) ' Render the background device.SetTexture(0, textureBackground) device.VertexFormat = Direct3D.CustomVertex.TransformedColoredTextured.Format device.SetStreamSource(0, vertexBackground, 0) device.DrawPrimitives(Direct3D.PrimitiveType.TriangleStrip, 0, 2) End Sub

Any ideas?

Last edited by afwasborstel; 10-27-2006 at 05:39 PM.
Reply With Quote
  #4  
Old 10-28-2006, 04:36 AM
Iceplug's Avatar
IceplugStatic background in a render... Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Ensure that you've set the RenderState ZBufferWriteEnable to False.
Also, make sure that you have RenderBackground between BeginScene and EndScene, the scene has been cleared, and you don't have culling enabled.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #5  
Old 10-28-2006, 04:50 AM
afwasborstel afwasborstel is offline
Centurion
 
Join Date: Apr 2003
Posts: 142
Default

No luck yet...

This is the render sub I use...

Code:
Private Sub Render() If Me.device Is Nothing Then Return End If Me.device.Clear(Direct3D.ClearFlags.Target, Color.FromArgb(0, 0, 0, 0), 1.0F, 0) Me.device.RenderState.CullMode = Direct3D.Cull.None Me.device.BeginScene() device.RenderState.ZBufferWriteEnable = False RenderBackground(device) device.RenderState.ZBufferWriteEnable = True Renderotherthingys(device) Me.device.EndScene() Me.device.Present() End Sub

What I'm doing wrong here?
Reply With Quote
  #6  
Old 10-29-2006, 03:18 AM
Iceplug's Avatar
IceplugStatic background in a render... Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Wait a minute, are you actually locking and unlocking the vertex buffer so that you can put the vertices in there? It doesn't look like you are.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #7  
Old 10-29-2006, 02:12 PM
afwasborstel afwasborstel is offline
Centurion
 
Join Date: Apr 2003
Posts: 142
Default

Did all that...no luck sofar...attached a sample of the project....maybe if any one could take a look....
Attached Files
File Type: zip BackGroundSample.zip (42.5 KB, 9 views)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Static background in a render...
Static background in a render...
Static background in a render... Static background in a render...
Static background in a render...
Static background in a render...
Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render... Static background in a render...
Static background in a render...
Static background in a render...
 
Static background in a render...
Static background in a render...
 
-->