@dave1707 great, didn’t know about that!
@piinthesky You can use that to create icons to take you to any web page.
@Simeon - getting the problem with the comment delimiters acting up again. We resolved that in a previous version. I’ll see if I can cut out a small section of code to demonstrate.
Edit: played with the code again but couldn’t duplicate it, it was in the working editor. If it occurs again I’ll post it.
@Simeon @John - is the difference between sprite and mesh here genuine or a bug?
-- TestText
displayMode(OVERLAY)
function setup()
--
bkg = readImage("Environments:Night Up")
mX,mY = WIDTH/2, HEIGHT/2
myMesh = mesh()
sz = 480
-- build mesh and add texture
myMesh.vertices = {
vec2(200,200),vec2(200+sz,200),vec2(200,200+sz),
vec2(200,200+sz),vec2(200+sz,200+sz),vec2(200+sz,200)
}
myMesh.texture = bkg
myMesh.texCoords = {
vec2(0,0),vec2(1,0),vec2(0,1),
vec2(0,1),vec2(1,1),vec2(1,0)
}
-- take image and stretch to same size as mesh
itest = image(sz,sz)
spriteMode(CENTER)
setContext(itest)
sprite(bkg,sz/2,sz/2,sz,sz)
setContext()
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
myMesh:draw()
sprite(itest,240,700,480,480)
end
Does it relate to 3D and light settings?
@Bri_G I’m not sure what you’re trying to show. Is it the difference in the color of the images. If so, try putting fill(255) after background(40,40,40).
@Bri_G Odd, looks like a bug but fairly minor — the default mesh vertex colours are not white, which is causing the mesh colour to multiply with the texture colour and dim the image.
Try setting the mesh vertex colours to white like this:
myMesh.colors = {
color(255), color(255), color(255),
color(255), color(255), color(255),
}
Will double check with @John what our default should be here.
@dave1707 @Simeon - thanks for the replies, from your posts I am assuming that a mesh is transparent and requires a background of white to show true colours. Will test your suggestions out when I get access to my pad.
Seem to remember in early mesh examples setting default color to white.
Yeah white as the default makes sense. Not sure what’s going on there.
@dave1707 - thanks, it is due to transparency. If you do as you suggested but put fill(back) in after the background and parameter.color(“back”) at the beginning of setup() you can change the default background for meshes. The default must be transparent.
Interesting, as a sprite the white background is present, but in a mesh it is removed?
@Simeon - just tried OMG = image(CAMERA) in setup() and it didn’t take a snapshot. Is that deliberate? Is CAMERA only available from draw() ?
Makes sense in a way - you can’t see the image your taking a snapshot of.
@Bri_G Apparently setup has to finish before CAMERA works. If I run this code, I have to tap the screen twice before an image shows. If I uncomment the line in setup, then I only have to tap the screen once. If I add a large for loop around img=image(CAMERA) in setup, it still doesn’t show the image until I tap the screen.
function setup()
--img=image(CAMERA)
end
function draw()
background(0)
fill(255)
text("tap screen for camera",WIDTH/2,HEIGHT-50)
if img~=nil then
sprite(img,0,0)
end
end
function touched(t)
if t.state==BEGAN then
img=image(CAMERA)
print("image info ",img)
end
end
@dave1707 @Simeon - just loaded 137 and ran this, camera image not full image, tried changing spriteMode() to center no change. Does seem to give correct aspect but only part of image.
@Simeon - piccies attached showing the problem with comment lines.
@Bri_G @dave13259 It takes at least one frame for the camera to initialise I think.
@Simeon @John I haven’t played around with the camera for awhile, but when I run the code below sometimes the image is too dark to see it. If I tap the screen to try again it’s OK. @John I put in a delay to go thru a few draw cycles but the image is still dark.
function setup()
displayMode(FULLSCREEN)
cnt=0
end
function draw()
background(0)
fill(255)
text("tap screen for camera",WIDTH/2,HEIGHT-50)
if img~=nil then
sprite(img,WIDTH/2,HEIGHT/2)
elseif cnt>5 then
img=image(CAMERA)
end
cnt=cnt+1
end
function touched(t)
if t.state==BEGAN then
img=image(CAMERA)
end
end
@Simeon in something i’m doing i see different behaviour starting from scratch (first start after launching the project) than when restarting after an exit. Should that be possible? (this was present in previous versions of codea).
@Bri_G oh I don’t think they’re transparent. The default fill colour is 200, 200, 200. A light grey. That grey is multiplying with the texture colours because the vertex colours default to the current fill. So this is not a bug, just a bit unintuitive though.
@piinthesky what’s the behaviour change? If it happens then it seems like a bug to me and I’d like to investigate.
@Bri_G did that problem with the comments go away after a bit or stick around?
@Simeon it’s a 3D model that will display from first start but then will not display after restart. Weird, as i use many models and the others all display correctly! Its quite difficult to give you the program as you need to have all the models. I’ll investigate more and see if i can find a way to make it work.