cameraviewport()

Blitz3D Forums/Blitz3D Beginners Area/cameraviewport()

El Neil(Posted 2007) [#1]
ok heres the deal.

im trying to render a 1280x480 screen which is split into 2 640x480 halves. i have set up two cameras in order to render (pretty much) the same thing to each half. heres my code:


Const scrw = 1280
Const scrh = 480
; constants for screen resolution

Graphics3D scrw,scrh,16,2

Global maincamLEFT = CreateCamera(mainpivot)
; makes the camera for the user's point of view and attaches it to the pivot

CameraRange maincamLEFT,0.1,1000
; set vision range for camera

Global maincamRIGHT = CreateCamera(mainpivot)
; makes the camera for the user's point of view and attaches it to the pivot

CameraRange maincamRIGHT,0.1,1000
; set vision range for camera

CameraViewport maincamLEFT,0,0,600,480
CameraViewport maincamRIGHT,640,0,640,480



when i run it i get a memory access violation. whats going on?

cheers,
neil


El Neil(Posted 2007) [#2]
Global mainpivot = CreatePivot()
; pivot for camera to attach to


ive also got this declared before the cameras


Neo Genesis10(Posted 2007) [#3]
Could you post your full source code? I can see no problems with the code as it stands (ran it on my own system without errors) so the issue is likely with other aspects of your code.

Generally, memory access violation errors occur when trying to do things with objects that do not exist. Try running it in debug mode and see if the error message received is more informative. If you still receive the same error, it might be an issue with your system and the chosen graphics mode.


El Neil(Posted 2007) [#4]
excellent! it was a problem later on. i was rotating a non-existent camera. forgot about debug mode, thank you so much Neo.

neil


El Neil(Posted 2007) [#5]
right, next problem.

when i run it, it says that it cannot set the graphics mode as fullscreen. the desired screen size is 1280 x 480 and my laptop is 1280 x 800. why won't it just stretch to fit?

also for the project i am doing i need to use 2 screens (control panel settings with a second monitor) and project the left camera to the left screen and the right camera to the right. any ideas?


neil


Gabriel(Posted 2007) [#6]
the desired screen size is 1280 x 480 and my laptop is 1280 x 800. why won't it just stretch to fit?

Because your graphics card is saying it can't do it. You can't set a resolution unless your videocard - via your videocard drivers - says it can do it. Evidently, your drivers are saying "no thanks".

also for the project i am doing i need to use 2 screens (control panel settings with a second monitor)

I'm pretty sure B3D doesn't like two monitors. If you can set them up so that Windows sees them both together as one giant desktop, you might be able to create a single fullscreen display which fits over both, but the monitors would need to have the same vertical resolution, and even then you'd need a dose of luck, I think.


Zethrax(Posted 2007) [#7]
Use something similar to the example code below to find the available video modes for a users system. Once you have a list of valid modes, either pick one, or let the user decide which mode to use via an options menu. Other commands you may wish to check out are GfxModeExists (width,height,depth) and Windowed3D()

; CountGFXModes()/GfxModeWidth/GfxModeHeight/GfxModeDepth example 

intModes=CountGfxModes() 

Print "There are " + intModes + "graphic modes available:" 

; Display all modes including width, height, and color depth 
For t = 1 To intModes 
Print "Mode " + t + ": 
Print "Width=" + GfxModeWidth(t) 
Print "Height=" + GfxModeHeight(t) 
Print "Height=" + GfxModeDepth(t) 
Next 



El Neil(Posted 2007) [#8]
ok, thanks for the help. this is bad news because i need to get this working for a final year uni project. im not surprised that my laptop wont run it, but ill just have to hope the uni computers do.

thanks again

neil


IPete2(Posted 2007) [#9]
Gabriel,

I have used and continue to use B3d across two monitors. I made a rope bridge with Tokamak physics and it was 2048 across both monitors, like you say, it has to be a single desktop though.

Again you need to ensure that the resolution you need is do-able by the hardware, easy enough to find out, just check the card's properties.

Here is a screenshot of the two monitor width ropebridge:
www.smartscreenuk.com/Ropebridge.jpg



Here is the link:
http://www.blitzbasic.co.nz/Community/posts.php?topic=54435#607583


IPete2.