• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Lights with MX

Cristiano

New member
Joined
May 15, 2018
Messages
27
Hello, friends.

This topic is related to Monkey-X. I’m trying to use light, but nothing happens. I’m doing a very simple sample. What could be wrong? Could it be related to my computer? It’s an old – more than 5 years – HP notebook with integrated video. But I found a link with a sample over the internet and the lights work fine… Here’s my code.

Code:
Import mojo2
Import mojo2.glutil
Function Main()
    New X()
End
Class X Extends App
    Field canvas:Canvas,img:Image
    Method OnCreate()
        SetDeviceWindow(320,240,False)
   
        canvas = New Canvas
        img=Image.Load("monkey://data/bg.png",0,0,Image.Filter)
        canvas.SetAmbientLight .2,.2,.2
    End Method
   
    Method OnUpdate()
    End Method
   
    Method OnRender()
   
        canvas.Clear
        canvas.SetLightType 0,1
        canvas.SetLightColor 0,.5,.5,.5
        canvas.SetLightPosition 0,MouseX(),MouseY(),-50
        canvas.SetLightRange 0,200
        For Local l:Int=0 To 639 Step 128
            For Local c:Int= 0 To 479 Step 128
                canvas.DrawImage img,l,c
            Next
        next
       
        canvas.Flush()
   
    End Method
End Class
 
For me it works with Cerberus-X when I change the path to just "bg.png" with the following file structure:
Code:
FILE app.cxs                  ← main application
DIR  app.data
        FILE bg.png           ← color texture
        FILE bg_NORMALS.png   ← the notmal map
        FILE bg_SPECULAR.png  ← specular map
You should also change the 3rd parameter of SetDeviceWindow() to an integer value (like SetDeviceWindow(320,240,2|4) for a resizable decorated window → see https://www.cerberus-x.com/community/cxDocs/Modules_mojo.app.html#SetDeviceWindow for a full list of parameters).
 
Well, when the sample works it can't be your computer. Can you provide the link to the sample you found please?
 
Sorry, Holzchopf, I lost it.... :(

Do you have any light sample that you can pass me? I'll be appreciated...
 
Hi, MikeHart.
Thanks for the reply, but this code doesn't run properly on my laptop.. I think that is the problem: my laptop.
I'll give up.... :(
 
You said you found a sample that works. Which one is it?
And please post your system specs.
Also what error message did you got? You can attach images into your post too. I was running integrated graphics too before. And it works for me.
 
Hi, MikeHart.

Actually, I can't remember the link, but I'm sure it works on my laptop. Sorry for that. :)
My laptop is an HP Core i3, 4GB Ram, Windows 7 and GPU integrated.
And there is no error message, the code just draws the image without any change in the ambient and no lights at all...
 
Odd...

Try writing
Code:
        img=Image.Load("monkey://data/bg.png",0,0,Image.Filter)
        img.Material.SetVector( "AmbientColor",[0.0,0.0,0.0,1.0] )

(Works in CX)

Seems like the shader's ambient light is added to the canvas' instead of multiplied, thus, when one is 1, you'll never see a shade. :confused:

edit
PLUS here it seems to scale either the default normal map or specular map in a funny way: The parts that light up don't match the color texture...
 
Very odd, Holzchopf...

I'll try, but this code runs on MX? Or some equivalent in MX? I mainly use MX, not CX (yet, 'cause I got fix some errors).
 
Yes it does. Which integrated graphics chip do you have? Which target did you try?
 
Probably kind of that Intel HD series. I had a 7 years old Macbook Air with HD 3000 on board which worked fine. Have you install proper graphics drivers?
 
Hi, guys.

Yes, my laptop has an Intel HD series integrated chip.. And it's fully updated. I don't know what else I can do. I tried all target, html5, glfw, android..

Thanks
 
The reason I as about which chip specifically is to find out which OpenGL ES support this chip has.
Intel HD series integrated chip

That doesn't help much. Can you look into the hardware informations? OR which I3 processor is it, as some have integrated graphics I think.
 
Looks like it runs an I3 Core 350m whihc seems to have an HD500 graphic chip build in.
If I read that right, it supports OpenGL ES 1.1 shading language. I think mojo2 does use version 2 for it.
 
So, if it only supports version 1.1, I won't be able to use lights in my games, right?
 
Just to be clear: Have you tried the code I posted and it still doesn't work?
 
You said you found a sample that works. Which one is it?
And please post your system specs.
Also what error message did you got? You can attach images into your post too. I was running integrated graphics too before. And it works for me.
Mike, I just tried yours own light sample and it did work fine on my computer...
 
Back
Top Bottom